| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
| 8 | 8 |
| 9 // ---------------------------------------------------------------------------- | 9 // ---------------------------------------------------------------------------- |
| 10 // Imports | 10 // Imports |
| 11 | 11 |
| 12 var FLAG_harmony_tostring; | 12 var FLAG_harmony_tostring; |
| 13 var GlobalArray = global.Array; | 13 var GlobalArray = global.Array; |
| 14 var GlobalBoolean = global.Boolean; | 14 var GlobalBoolean = global.Boolean; |
| 15 var GlobalFunction = global.Function; | 15 var GlobalFunction = global.Function; |
| 16 var GlobalNumber = global.Number; | 16 var GlobalNumber = global.Number; |
| 17 var GlobalObject = global.Object; | 17 var GlobalObject = global.Object; |
| 18 var InternalArray = utils.InternalArray; | 18 var InternalArray = utils.InternalArray; |
| 19 var iteratorSymbol = utils.ImportNow("iterator_symbol"); | 19 var iteratorSymbol = utils.ImportNow("iterator_symbol"); |
| 20 var MathAbs; | 20 var MathAbs; |
| 21 var NaN = %GetRootNaN(); |
| 21 var ObserveBeginPerformSplice; | 22 var ObserveBeginPerformSplice; |
| 22 var ObserveEndPerformSplice; | 23 var ObserveEndPerformSplice; |
| 23 var ObserveEnqueueSpliceRecord; | 24 var ObserveEnqueueSpliceRecord; |
| 24 var ProxyDelegateCallAndConstruct; | 25 var ProxyDelegateCallAndConstruct; |
| 25 var ProxyDerivedHasOwnTrap; | 26 var ProxyDerivedHasOwnTrap; |
| 26 var ProxyDerivedKeysTrap; | 27 var ProxyDerivedKeysTrap; |
| 27 var StringIndexOf; | 28 var StringIndexOf; |
| 28 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 29 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
| 29 | 30 |
| 30 utils.Import(function(from) { | 31 utils.Import(function(from) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Truncate number. | 75 // Truncate number. |
| 75 return string | 0; | 76 return string | 0; |
| 76 } | 77 } |
| 77 string = TO_STRING(string); | 78 string = TO_STRING(string); |
| 78 radix = radix | 0; | 79 radix = radix | 0; |
| 79 } else { | 80 } else { |
| 80 // The spec says ToString should be evaluated before ToInt32. | 81 // The spec says ToString should be evaluated before ToInt32. |
| 81 string = TO_STRING(string); | 82 string = TO_STRING(string); |
| 82 radix = TO_INT32(radix); | 83 radix = TO_INT32(radix); |
| 83 if (!(radix == 0 || (2 <= radix && radix <= 36))) { | 84 if (!(radix == 0 || (2 <= radix && radix <= 36))) { |
| 84 return NAN; | 85 return NaN; |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 | 88 |
| 88 if (%_HasCachedArrayIndex(string) && | 89 if (%_HasCachedArrayIndex(string) && |
| 89 (radix == 0 || radix == 10)) { | 90 (radix == 0 || radix == 10)) { |
| 90 return %_GetCachedArrayIndex(string); | 91 return %_GetCachedArrayIndex(string); |
| 91 } | 92 } |
| 92 return %StringParseInt(string, radix); | 93 return %StringParseInt(string, radix); |
| 93 } | 94 } |
| 94 | 95 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 113 } | 114 } |
| 114 | 115 |
| 115 | 116 |
| 116 // ---------------------------------------------------------------------------- | 117 // ---------------------------------------------------------------------------- |
| 117 | 118 |
| 118 // Set up global object. | 119 // Set up global object. |
| 119 var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY; | 120 var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY; |
| 120 | 121 |
| 121 utils.InstallConstants(global, [ | 122 utils.InstallConstants(global, [ |
| 122 // ECMA 262 - 15.1.1.1. | 123 // ECMA 262 - 15.1.1.1. |
| 123 "NaN", NAN, | 124 "NaN", NaN, |
| 124 // ECMA-262 - 15.1.1.2. | 125 // ECMA-262 - 15.1.1.2. |
| 125 "Infinity", INFINITY, | 126 "Infinity", INFINITY, |
| 126 // ECMA-262 - 15.1.1.2. | 127 // ECMA-262 - 15.1.1.2. |
| 127 "undefined", UNDEFINED, | 128 "undefined", UNDEFINED, |
| 128 ]); | 129 ]); |
| 129 | 130 |
| 130 // Set up non-enumerable function on the global object. | 131 // Set up non-enumerable function on the global object. |
| 131 utils.InstallFunctions(global, DONT_ENUM, [ | 132 utils.InstallFunctions(global, DONT_ENUM, [ |
| 132 "isNaN", GlobalIsNaN, | 133 "isNaN", GlobalIsNaN, |
| 133 "isFinite", GlobalIsFinite, | 134 "isFinite", GlobalIsFinite, |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 // Set up the constructor property on the Number prototype object. | 1594 // Set up the constructor property on the Number prototype object. |
| 1594 %AddNamedProperty(GlobalNumber.prototype, "constructor", GlobalNumber, | 1595 %AddNamedProperty(GlobalNumber.prototype, "constructor", GlobalNumber, |
| 1595 DONT_ENUM); | 1596 DONT_ENUM); |
| 1596 | 1597 |
| 1597 utils.InstallConstants(GlobalNumber, [ | 1598 utils.InstallConstants(GlobalNumber, [ |
| 1598 // ECMA-262 section 15.7.3.1. | 1599 // ECMA-262 section 15.7.3.1. |
| 1599 "MAX_VALUE", 1.7976931348623157e+308, | 1600 "MAX_VALUE", 1.7976931348623157e+308, |
| 1600 // ECMA-262 section 15.7.3.2. | 1601 // ECMA-262 section 15.7.3.2. |
| 1601 "MIN_VALUE", 5e-324, | 1602 "MIN_VALUE", 5e-324, |
| 1602 // ECMA-262 section 15.7.3.3. | 1603 // ECMA-262 section 15.7.3.3. |
| 1603 "NaN", NAN, | 1604 "NaN", NaN, |
| 1604 // ECMA-262 section 15.7.3.4. | 1605 // ECMA-262 section 15.7.3.4. |
| 1605 "NEGATIVE_INFINITY", -INFINITY, | 1606 "NEGATIVE_INFINITY", -INFINITY, |
| 1606 // ECMA-262 section 15.7.3.5. | 1607 // ECMA-262 section 15.7.3.5. |
| 1607 "POSITIVE_INFINITY", INFINITY, | 1608 "POSITIVE_INFINITY", INFINITY, |
| 1608 | 1609 |
| 1609 // --- Harmony constants (no spec refs until settled.) | 1610 // --- Harmony constants (no spec refs until settled.) |
| 1610 | 1611 |
| 1611 "MAX_SAFE_INTEGER", %_MathPow(2, 53) - 1, | 1612 "MAX_SAFE_INTEGER", %_MathPow(2, 53) - 1, |
| 1612 "MIN_SAFE_INTEGER", -%_MathPow(2, 53) + 1, | 1613 "MIN_SAFE_INTEGER", -%_MathPow(2, 53) + 1, |
| 1613 "EPSILON", %_MathPow(2, -52) | 1614 "EPSILON", %_MathPow(2, -52) |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 %InstallToContext([ | 1848 %InstallToContext([ |
| 1848 "global_eval_fun", GlobalEval, | 1849 "global_eval_fun", GlobalEval, |
| 1849 "object_value_of", ObjectValueOf, | 1850 "object_value_of", ObjectValueOf, |
| 1850 "object_to_string", ObjectToString, | 1851 "object_to_string", ObjectToString, |
| 1851 "object_define_own_property", DefineOwnPropertyFromAPI, | 1852 "object_define_own_property", DefineOwnPropertyFromAPI, |
| 1852 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, | 1853 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, |
| 1853 "to_complete_property_descriptor", ToCompletePropertyDescriptor, | 1854 "to_complete_property_descriptor", ToCompletePropertyDescriptor, |
| 1854 ]); | 1855 ]); |
| 1855 | 1856 |
| 1856 }) | 1857 }) |
| OLD | NEW |