Conversions.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. * This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /* ECMAScript conversion operations. */
  6. #ifndef js_Conversions_h
  7. #define js_Conversions_h
  8. #include "mozilla/Casting.h"
  9. #include "mozilla/FloatingPoint.h"
  10. #include "mozilla/TypeTraits.h"
  11. #include <math.h>
  12. #include "jspubtd.h"
  13. #include "js/RootingAPI.h"
  14. #include "js/Value.h"
  15. struct JSContext;
  16. namespace js {
  17. /* DO NOT CALL THIS. Use JS::ToBoolean. */
  18. extern JS_PUBLIC_API(bool)
  19. ToBooleanSlow(JS::HandleValue v);
  20. /* DO NOT CALL THIS. Use JS::ToNumber. */
  21. extern JS_PUBLIC_API(bool)
  22. ToNumberSlow(JSContext* cx, JS::HandleValue v, double* dp);
  23. /* DO NOT CALL THIS. Use JS::ToInt8. */
  24. extern JS_PUBLIC_API(bool)
  25. ToInt8Slow(JSContext *cx, JS::HandleValue v, int8_t *out);
  26. /* DO NOT CALL THIS. Use JS::ToUint8. */
  27. extern JS_PUBLIC_API(bool)
  28. ToUint8Slow(JSContext *cx, JS::HandleValue v, uint8_t *out);
  29. /* DO NOT CALL THIS. Use JS::ToInt16. */
  30. extern JS_PUBLIC_API(bool)
  31. ToInt16Slow(JSContext *cx, JS::HandleValue v, int16_t *out);
  32. /* DO NOT CALL THIS. Use JS::ToInt32. */
  33. extern JS_PUBLIC_API(bool)
  34. ToInt32Slow(JSContext* cx, JS::HandleValue v, int32_t* out);
  35. /* DO NOT CALL THIS. Use JS::ToUint32. */
  36. extern JS_PUBLIC_API(bool)
  37. ToUint32Slow(JSContext* cx, JS::HandleValue v, uint32_t* out);
  38. /* DO NOT CALL THIS. Use JS::ToUint16. */
  39. extern JS_PUBLIC_API(bool)
  40. ToUint16Slow(JSContext* cx, JS::HandleValue v, uint16_t* out);
  41. /* DO NOT CALL THIS. Use JS::ToInt64. */
  42. extern JS_PUBLIC_API(bool)
  43. ToInt64Slow(JSContext* cx, JS::HandleValue v, int64_t* out);
  44. /* DO NOT CALL THIS. Use JS::ToUint64. */
  45. extern JS_PUBLIC_API(bool)
  46. ToUint64Slow(JSContext* cx, JS::HandleValue v, uint64_t* out);
  47. /* DO NOT CALL THIS. Use JS::ToString. */
  48. extern JS_PUBLIC_API(JSString*)
  49. ToStringSlow(JSContext* cx, JS::HandleValue v);
  50. /* DO NOT CALL THIS. Use JS::ToObject. */
  51. extern JS_PUBLIC_API(JSObject*)
  52. ToObjectSlow(JSContext* cx, JS::HandleValue v, bool reportScanStack);
  53. } // namespace js
  54. namespace JS {
  55. namespace detail {
  56. #ifdef JS_DEBUG
  57. /**
  58. * Assert that we're not doing GC on cx, that we're in a request as
  59. * needed, and that the compartments for cx and v are correct.
  60. * Also check that GC would be safe at this point.
  61. */
  62. extern JS_PUBLIC_API(void)
  63. AssertArgumentsAreSane(JSContext* cx, HandleValue v);
  64. #else
  65. inline void AssertArgumentsAreSane(JSContext* cx, HandleValue v)
  66. {}
  67. #endif /* JS_DEBUG */
  68. } // namespace detail
  69. /**
  70. * ES6 draft 20141224, 7.1.1, second algorithm.
  71. *
  72. * Most users shouldn't call this -- use JS::ToBoolean, ToNumber, or ToString
  73. * instead. This will typically only be called from custom convert hooks that
  74. * wish to fall back to the ES6 default conversion behavior shared by most
  75. * objects in JS, codified as OrdinaryToPrimitive.
  76. */
  77. extern JS_PUBLIC_API(bool)
  78. OrdinaryToPrimitive(JSContext* cx, HandleObject obj, JSType type, MutableHandleValue vp);
  79. /* ES6 draft 20141224, 7.1.2. */
  80. MOZ_ALWAYS_INLINE bool
  81. ToBoolean(HandleValue v)
  82. {
  83. if (v.isBoolean())
  84. return v.toBoolean();
  85. if (v.isInt32())
  86. return v.toInt32() != 0;
  87. if (v.isNullOrUndefined())
  88. return false;
  89. if (v.isDouble()) {
  90. double d = v.toDouble();
  91. return !mozilla::IsNaN(d) && d != 0;
  92. }
  93. if (v.isSymbol())
  94. return true;
  95. /* The slow path handles strings and objects. */
  96. return js::ToBooleanSlow(v);
  97. }
  98. /* ES6 draft 20141224, 7.1.3. */
  99. MOZ_ALWAYS_INLINE bool
  100. ToNumber(JSContext* cx, HandleValue v, double* out)
  101. {
  102. detail::AssertArgumentsAreSane(cx, v);
  103. if (v.isNumber()) {
  104. *out = v.toNumber();
  105. return true;
  106. }
  107. return js::ToNumberSlow(cx, v, out);
  108. }
  109. /* ES6 draft 20141224, ToInteger (specialized for doubles). */
  110. inline double
  111. ToInteger(double d)
  112. {
  113. if (d == 0)
  114. return d;
  115. if (!mozilla::IsFinite(d)) {
  116. if (mozilla::IsNaN(d))
  117. return 0;
  118. return d;
  119. }
  120. return d < 0 ? ceil(d) : floor(d);
  121. }
  122. /* ES6 draft 20141224, 7.1.5. */
  123. MOZ_ALWAYS_INLINE bool
  124. ToInt32(JSContext* cx, JS::HandleValue v, int32_t* out)
  125. {
  126. detail::AssertArgumentsAreSane(cx, v);
  127. if (v.isInt32()) {
  128. *out = v.toInt32();
  129. return true;
  130. }
  131. return js::ToInt32Slow(cx, v, out);
  132. }
  133. /* ES6 draft 20141224, 7.1.6. */
  134. MOZ_ALWAYS_INLINE bool
  135. ToUint32(JSContext* cx, HandleValue v, uint32_t* out)
  136. {
  137. detail::AssertArgumentsAreSane(cx, v);
  138. if (v.isInt32()) {
  139. *out = uint32_t(v.toInt32());
  140. return true;
  141. }
  142. return js::ToUint32Slow(cx, v, out);
  143. }
  144. /* ES6 draft 20141224, 7.1.7. */
  145. MOZ_ALWAYS_INLINE bool
  146. ToInt16(JSContext *cx, JS::HandleValue v, int16_t *out)
  147. {
  148. detail::AssertArgumentsAreSane(cx, v);
  149. if (v.isInt32()) {
  150. *out = int16_t(v.toInt32());
  151. return true;
  152. }
  153. return js::ToInt16Slow(cx, v, out);
  154. }
  155. /* ES6 draft 20141224, 7.1.8. */
  156. MOZ_ALWAYS_INLINE bool
  157. ToUint16(JSContext* cx, HandleValue v, uint16_t* out)
  158. {
  159. detail::AssertArgumentsAreSane(cx, v);
  160. if (v.isInt32()) {
  161. *out = uint16_t(v.toInt32());
  162. return true;
  163. }
  164. return js::ToUint16Slow(cx, v, out);
  165. }
  166. /* ES6 draft 20141224, 7.1.9 */
  167. MOZ_ALWAYS_INLINE bool
  168. ToInt8(JSContext *cx, JS::HandleValue v, int8_t *out)
  169. {
  170. detail::AssertArgumentsAreSane(cx, v);
  171. if (v.isInt32()) {
  172. *out = int8_t(v.toInt32());
  173. return true;
  174. }
  175. return js::ToInt8Slow(cx, v, out);
  176. }
  177. /* ES6 ECMA-262, 7.1.10 */
  178. MOZ_ALWAYS_INLINE bool
  179. ToUint8(JSContext *cx, JS::HandleValue v, uint8_t *out)
  180. {
  181. detail::AssertArgumentsAreSane(cx, v);
  182. if (v.isInt32()) {
  183. *out = uint8_t(v.toInt32());
  184. return true;
  185. }
  186. return js::ToUint8Slow(cx, v, out);
  187. }
  188. /*
  189. * Non-standard, with behavior similar to that of ToInt32, except in its
  190. * producing an int64_t.
  191. */
  192. MOZ_ALWAYS_INLINE bool
  193. ToInt64(JSContext* cx, HandleValue v, int64_t* out)
  194. {
  195. detail::AssertArgumentsAreSane(cx, v);
  196. if (v.isInt32()) {
  197. *out = int64_t(v.toInt32());
  198. return true;
  199. }
  200. return js::ToInt64Slow(cx, v, out);
  201. }
  202. /*
  203. * Non-standard, with behavior similar to that of ToUint32, except in its
  204. * producing a uint64_t.
  205. */
  206. MOZ_ALWAYS_INLINE bool
  207. ToUint64(JSContext* cx, HandleValue v, uint64_t* out)
  208. {
  209. detail::AssertArgumentsAreSane(cx, v);
  210. if (v.isInt32()) {
  211. *out = uint64_t(v.toInt32());
  212. return true;
  213. }
  214. return js::ToUint64Slow(cx, v, out);
  215. }
  216. /* ES6 draft 20141224, 7.1.12. */
  217. MOZ_ALWAYS_INLINE JSString*
  218. ToString(JSContext* cx, HandleValue v)
  219. {
  220. detail::AssertArgumentsAreSane(cx, v);
  221. if (v.isString())
  222. return v.toString();
  223. return js::ToStringSlow(cx, v);
  224. }
  225. /* ES6 draft 20141224, 7.1.13. */
  226. inline JSObject*
  227. ToObject(JSContext* cx, HandleValue v)
  228. {
  229. detail::AssertArgumentsAreSane(cx, v);
  230. if (v.isObject())
  231. return &v.toObject();
  232. return js::ToObjectSlow(cx, v, false);
  233. }
  234. namespace detail {
  235. /*
  236. * Convert a double value to ResultType (an unsigned integral type) using
  237. * ECMAScript-style semantics (that is, in like manner to how ECMAScript's
  238. * ToInt32 converts to int32_t).
  239. *
  240. * If d is infinite or NaN, return 0.
  241. * Otherwise compute d2 = sign(d) * floor(abs(d)), and return the ResultType
  242. * value congruent to d2 mod 2**(bit width of ResultType).
  243. *
  244. * The algorithm below is inspired by that found in
  245. * <http://trac.webkit.org/changeset/67825/trunk/JavaScriptCore/runtime/JSValue.cpp>
  246. * but has been generalized to all integer widths.
  247. */
  248. template<typename ResultType>
  249. inline ResultType
  250. ToUintWidth(double d)
  251. {
  252. static_assert(mozilla::IsUnsigned<ResultType>::value,
  253. "ResultType must be an unsigned type");
  254. uint64_t bits = mozilla::BitwiseCast<uint64_t>(d);
  255. unsigned DoubleExponentShift = mozilla::FloatingPoint<double>::kExponentShift;
  256. // Extract the exponent component. (Be careful here! It's not technically
  257. // the exponent in NaN, infinities, and subnormals.)
  258. int_fast16_t exp =
  259. int_fast16_t((bits & mozilla::FloatingPoint<double>::kExponentBits) >> DoubleExponentShift) -
  260. int_fast16_t(mozilla::FloatingPoint<double>::kExponentBias);
  261. // If the exponent's less than zero, abs(d) < 1, so the result is 0. (This
  262. // also handles subnormals.)
  263. if (exp < 0)
  264. return 0;
  265. uint_fast16_t exponent = mozilla::AssertedCast<uint_fast16_t>(exp);
  266. // If the exponent is greater than or equal to the bits of precision of a
  267. // double plus ResultType's width, the number is either infinite, NaN, or
  268. // too large to have lower-order bits in the congruent value. (Example:
  269. // 2**84 is exactly representable as a double. The next exact double is
  270. // 2**84 + 2**32. Thus if ResultType is int32_t, an exponent >= 84 implies
  271. // floor(abs(d)) == 0 mod 2**32.) Return 0 in all these cases.
  272. const size_t ResultWidth = CHAR_BIT * sizeof(ResultType);
  273. if (exponent >= DoubleExponentShift + ResultWidth)
  274. return 0;
  275. // The significand contains the bits that will determine the final result.
  276. // Shift those bits left or right, according to the exponent, to their
  277. // locations in the unsigned binary representation of floor(abs(d)).
  278. static_assert(sizeof(ResultType) <= sizeof(uint64_t),
  279. "Left-shifting below would lose upper bits");
  280. ResultType result = (exponent > DoubleExponentShift)
  281. ? ResultType(bits << (exponent - DoubleExponentShift))
  282. : ResultType(bits >> (DoubleExponentShift - exponent));
  283. // Two further complications remain. First, |result| may contain bogus
  284. // sign/exponent bits. Second, IEEE-754 numbers' significands (excluding
  285. // subnormals, but we already handled those) have an implicit leading 1
  286. // which may affect the final result.
  287. //
  288. // It may appear that there's complexity here depending on how ResultWidth
  289. // and DoubleExponentShift relate, but it turns out there's not.
  290. //
  291. // Assume ResultWidth < DoubleExponentShift:
  292. // Only right-shifts leave bogus bits in |result|. For this to happen,
  293. // we must right-shift by > |DoubleExponentShift - ResultWidth|, implying
  294. // |exponent < ResultWidth|.
  295. // The implicit leading bit only matters if it appears in the final
  296. // result -- if |2**exponent mod 2**ResultWidth != 0|. This implies
  297. // |exponent < ResultWidth|.
  298. // Otherwise assume ResultWidth >= DoubleExponentShift:
  299. // Any left-shift less than |ResultWidth - DoubleExponentShift| leaves
  300. // bogus bits in |result|. This implies |exponent < ResultWidth|. Any
  301. // right-shift less than |ResultWidth| does too, which implies
  302. // |DoubleExponentShift - ResultWidth < exponent|. By assumption, then,
  303. // |exponent| is negative, but we excluded that above. So bogus bits
  304. // need only |exponent < ResultWidth|.
  305. // The implicit leading bit matters identically to the other case, so
  306. // again, |exponent < ResultWidth|.
  307. if (exponent < ResultWidth) {
  308. ResultType implicitOne = ResultType(1) << exponent;
  309. result &= implicitOne - 1; // remove bogus bits
  310. result += implicitOne; // add the implicit bit
  311. }
  312. // Compute the congruent value in the signed range.
  313. return (bits & mozilla::FloatingPoint<double>::kSignBit) ? ~result + 1 : result;
  314. }
  315. template<typename ResultType>
  316. inline ResultType
  317. ToIntWidth(double d)
  318. {
  319. static_assert(mozilla::IsSigned<ResultType>::value,
  320. "ResultType must be a signed type");
  321. const ResultType MaxValue = (1ULL << (CHAR_BIT * sizeof(ResultType) - 1)) - 1;
  322. const ResultType MinValue = -MaxValue - 1;
  323. typedef typename mozilla::MakeUnsigned<ResultType>::Type UnsignedResult;
  324. UnsignedResult u = ToUintWidth<UnsignedResult>(d);
  325. if (u <= UnsignedResult(MaxValue))
  326. return static_cast<ResultType>(u);
  327. return (MinValue + static_cast<ResultType>(u - MaxValue)) - 1;
  328. }
  329. } // namespace detail
  330. /* ES5 9.5 ToInt32 (specialized for doubles). */
  331. inline int32_t
  332. ToInt32(double d)
  333. {
  334. // clang crashes compiling this when targeting arm:
  335. // https://llvm.org/bugs/show_bug.cgi?id=22974
  336. #if defined (__arm__) && defined (__GNUC__) && !defined(__clang__)
  337. int32_t i;
  338. uint32_t tmp0;
  339. uint32_t tmp1;
  340. uint32_t tmp2;
  341. asm (
  342. // We use a pure integer solution here. In the 'softfp' ABI, the argument
  343. // will start in r0 and r1, and VFP can't do all of the necessary ECMA
  344. // conversions by itself so some integer code will be required anyway. A
  345. // hybrid solution is faster on A9, but this pure integer solution is
  346. // notably faster for A8.
  347. // %0 is the result register, and may alias either of the %[QR]1 registers.
  348. // %Q4 holds the lower part of the mantissa.
  349. // %R4 holds the sign, exponent, and the upper part of the mantissa.
  350. // %1, %2 and %3 are used as temporary values.
  351. // Extract the exponent.
  352. " mov %1, %R4, LSR #20\n"
  353. " bic %1, %1, #(1 << 11)\n" // Clear the sign.
  354. // Set the implicit top bit of the mantissa. This clobbers a bit of the
  355. // exponent, but we have already extracted that.
  356. " orr %R4, %R4, #(1 << 20)\n"
  357. // Special Cases
  358. // We should return zero in the following special cases:
  359. // - Exponent is 0x000 - 1023: +/-0 or subnormal.
  360. // - Exponent is 0x7ff - 1023: +/-INFINITY or NaN
  361. // - This case is implicitly handled by the standard code path anyway,
  362. // as shifting the mantissa up by the exponent will result in '0'.
  363. //
  364. // The result is composed of the mantissa, prepended with '1' and
  365. // bit-shifted left by the (decoded) exponent. Note that because the r1[20]
  366. // is the bit with value '1', r1 is effectively already shifted (left) by
  367. // 20 bits, and r0 is already shifted by 52 bits.
  368. // Adjust the exponent to remove the encoding offset. If the decoded
  369. // exponent is negative, quickly bail out with '0' as such values round to
  370. // zero anyway. This also catches +/-0 and subnormals.
  371. " sub %1, %1, #0xff\n"
  372. " subs %1, %1, #0x300\n"
  373. " bmi 8f\n"
  374. // %1 = (decoded) exponent >= 0
  375. // %R4 = upper mantissa and sign
  376. // ---- Lower Mantissa ----
  377. " subs %3, %1, #52\n" // Calculate exp-52
  378. " bmi 1f\n"
  379. // Shift r0 left by exp-52.
  380. // Ensure that we don't overflow ARM's 8-bit shift operand range.
  381. // We need to handle anything up to an 11-bit value here as we know that
  382. // 52 <= exp <= 1024 (0x400). Any shift beyond 31 bits results in zero
  383. // anyway, so as long as we don't touch the bottom 5 bits, we can use
  384. // a logical OR to push long shifts into the 32 <= (exp&0xff) <= 255 range.
  385. " bic %2, %3, #0xff\n"
  386. " orr %3, %3, %2, LSR #3\n"
  387. // We can now perform a straight shift, avoiding the need for any
  388. // conditional instructions or extra branches.
  389. " mov %Q4, %Q4, LSL %3\n"
  390. " b 2f\n"
  391. "1:\n" // Shift r0 right by 52-exp.
  392. // We know that 0 <= exp < 52, and we can shift up to 255 bits so 52-exp
  393. // will always be a valid shift and we can sk%3 the range check for this case.
  394. " rsb %3, %1, #52\n"
  395. " mov %Q4, %Q4, LSR %3\n"
  396. // %1 = (decoded) exponent
  397. // %R4 = upper mantissa and sign
  398. // %Q4 = partially-converted integer
  399. "2:\n"
  400. // ---- Upper Mantissa ----
  401. // This is much the same as the lower mantissa, with a few different
  402. // boundary checks and some masking to hide the exponent & sign bit in the
  403. // upper word.
  404. // Note that the upper mantissa is pre-shifted by 20 in %R4, but we shift
  405. // it left more to remove the sign and exponent so it is effectively
  406. // pre-shifted by 31 bits.
  407. " subs %3, %1, #31\n" // Calculate exp-31
  408. " mov %1, %R4, LSL #11\n" // Re-use %1 as a temporary register.
  409. " bmi 3f\n"
  410. // Shift %R4 left by exp-31.
  411. // Avoid overflowing the 8-bit shift range, as before.
  412. " bic %2, %3, #0xff\n"
  413. " orr %3, %3, %2, LSR #3\n"
  414. // Perform the shift.
  415. " mov %2, %1, LSL %3\n"
  416. " b 4f\n"
  417. "3:\n" // Shift r1 right by 31-exp.
  418. // We know that 0 <= exp < 31, and we can shift up to 255 bits so 31-exp
  419. // will always be a valid shift and we can skip the range check for this case.
  420. " rsb %3, %3, #0\n" // Calculate 31-exp from -(exp-31)
  421. " mov %2, %1, LSR %3\n" // Thumb-2 can't do "LSR %3" in "orr".
  422. // %Q4 = partially-converted integer (lower)
  423. // %R4 = upper mantissa and sign
  424. // %2 = partially-converted integer (upper)
  425. "4:\n"
  426. // Combine the converted parts.
  427. " orr %Q4, %Q4, %2\n"
  428. // Negate the result if we have to, and move it to %0 in the process. To
  429. // avoid conditionals, we can do this by inverting on %R4[31], then adding
  430. // %R4[31]>>31.
  431. " eor %Q4, %Q4, %R4, ASR #31\n"
  432. " add %0, %Q4, %R4, LSR #31\n"
  433. " b 9f\n"
  434. "8:\n"
  435. // +/-INFINITY, +/-0, subnormals, NaNs, and anything else out-of-range that
  436. // will result in a conversion of '0'.
  437. " mov %0, #0\n"
  438. "9:\n"
  439. : "=r" (i), "=&r" (tmp0), "=&r" (tmp1), "=&r" (tmp2), "=&r" (d)
  440. : "4" (d)
  441. : "cc"
  442. );
  443. return i;
  444. #else
  445. return detail::ToIntWidth<int32_t>(d);
  446. #endif
  447. }
  448. /* ES5 9.6 (specialized for doubles). */
  449. inline uint32_t
  450. ToUint32(double d)
  451. {
  452. return detail::ToUintWidth<uint32_t>(d);
  453. }
  454. /* WEBIDL 4.2.4 */
  455. inline int8_t
  456. ToInt8(double d)
  457. {
  458. return detail::ToIntWidth<int8_t>(d);
  459. }
  460. /* ECMA-262 7.1.10 ToUInt8() specialized for doubles. */
  461. inline int8_t
  462. ToUint8(double d)
  463. {
  464. return detail::ToUintWidth<uint8_t>(d);
  465. }
  466. /* WEBIDL 4.2.6 */
  467. inline int16_t
  468. ToInt16(double d)
  469. {
  470. return detail::ToIntWidth<int16_t>(d);
  471. }
  472. inline uint16_t
  473. ToUint16(double d)
  474. {
  475. return detail::ToUintWidth<uint16_t>(d);
  476. }
  477. /* WEBIDL 4.2.10 */
  478. inline int64_t
  479. ToInt64(double d)
  480. {
  481. return detail::ToIntWidth<int64_t>(d);
  482. }
  483. /* WEBIDL 4.2.11 */
  484. inline uint64_t
  485. ToUint64(double d)
  486. {
  487. return detail::ToUintWidth<uint64_t>(d);
  488. }
  489. } // namespace JS
  490. #endif /* js_Conversions_h */