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 var $delete; | 5 var $delete; |
6 var $functionSourceString; | 6 var $functionSourceString; |
7 var $getIterator; | 7 var $getIterator; |
8 var $getMethod; | 8 var $getMethod; |
9 var $globalEval; | 9 var $globalEval; |
10 var $installConstants; | 10 var $installConstants; |
(...skipping 14 matching lines...) Expand all Loading... |
25 var $objectLookupGetter; | 25 var $objectLookupGetter; |
26 var $objectLookupSetter; | 26 var $objectLookupSetter; |
27 var $objectToString; | 27 var $objectToString; |
28 var $overrideFunction; | 28 var $overrideFunction; |
29 var $ownPropertyKeys; | 29 var $ownPropertyKeys; |
30 var $setFunctionName; | 30 var $setFunctionName; |
31 var $setUpLockedPrototype; | 31 var $setUpLockedPrototype; |
32 var $toCompletePropertyDescriptor; | 32 var $toCompletePropertyDescriptor; |
33 var $toNameArray; | 33 var $toNameArray; |
34 | 34 |
35 (function(global, utils) { | 35 (function(global, shared, exports) { |
36 | 36 |
37 %CheckIsBootstrapping(); | 37 %CheckIsBootstrapping(); |
38 | 38 |
39 // ---------------------------------------------------------------------------- | 39 // ---------------------------------------------------------------------------- |
40 // Imports | 40 // Imports |
41 | 41 |
42 var GlobalArray = global.Array; | 42 var GlobalArray = global.Array; |
43 var GlobalBoolean = global.Boolean; | 43 var GlobalBoolean = global.Boolean; |
44 var GlobalFunction = global.Function; | 44 var GlobalFunction = global.Function; |
45 var GlobalNumber = global.Number; | 45 var GlobalNumber = global.Number; |
46 var GlobalObject = global.Object; | 46 var GlobalObject = global.Object; |
47 var InternalArray = utils.InternalArray; | 47 var InternalArray = shared.InternalArray; |
48 | |
49 var MathAbs; | |
50 var StringIndexOf; | |
51 | |
52 utils.Import(function(from) { | |
53 MathAbs = from.MathAbs; | |
54 StringIndexOf = from.StringIndexOf; | |
55 }); | |
56 | 48 |
57 // ---------------------------------------------------------------------------- | 49 // ---------------------------------------------------------------------------- |
58 | 50 |
59 // ES6 - 9.2.11 SetFunctionName | 51 // ES6 - 9.2.11 SetFunctionName |
60 function SetFunctionName(f, name, prefix) { | 52 function SetFunctionName(f, name, prefix) { |
61 if (IS_SYMBOL(name)) { | 53 if (IS_SYMBOL(name)) { |
62 name = "[" + %SymbolDescription(name) + "]"; | 54 name = "[" + %SymbolDescription(name) + "]"; |
63 } | 55 } |
64 if (IS_UNDEFINED(prefix)) { | 56 if (IS_UNDEFINED(prefix)) { |
65 %FunctionSetName(f, name); | 57 %FunctionSetName(f, name); |
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 function NumberIsNaN(number) { | 1690 function NumberIsNaN(number) { |
1699 return IS_NUMBER(number) && NUMBER_IS_NAN(number); | 1691 return IS_NUMBER(number) && NUMBER_IS_NAN(number); |
1700 } | 1692 } |
1701 | 1693 |
1702 | 1694 |
1703 // Harmony isSafeInteger | 1695 // Harmony isSafeInteger |
1704 function NumberIsSafeInteger(number) { | 1696 function NumberIsSafeInteger(number) { |
1705 if (NumberIsFinite(number)) { | 1697 if (NumberIsFinite(number)) { |
1706 var integral = TO_INTEGER(number); | 1698 var integral = TO_INTEGER(number); |
1707 if (integral == number) { | 1699 if (integral == number) { |
1708 return MathAbs(integral) <= GlobalNumber.MAX_SAFE_INTEGER; | 1700 return $abs(integral) <= GlobalNumber.MAX_SAFE_INTEGER; |
1709 } | 1701 } |
1710 } | 1702 } |
1711 return false; | 1703 return false; |
1712 } | 1704 } |
1713 | 1705 |
1714 | 1706 |
1715 // ---------------------------------------------------------------------------- | 1707 // ---------------------------------------------------------------------------- |
1716 | 1708 |
1717 %SetCode(GlobalNumber, NumberConstructor); | 1709 %SetCode(GlobalNumber, NumberConstructor); |
1718 %FunctionSetPrototype(GlobalNumber, new GlobalNumber(0)); | 1710 %FunctionSetPrototype(GlobalNumber, new GlobalNumber(0)); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1883 var n = args.length; | 1875 var n = args.length; |
1884 var p = ''; | 1876 var p = ''; |
1885 if (n > 1) { | 1877 if (n > 1) { |
1886 p = $toString(args[0]); | 1878 p = $toString(args[0]); |
1887 for (var i = 1; i < n - 1; i++) { | 1879 for (var i = 1; i < n - 1; i++) { |
1888 p += ',' + $toString(args[i]); | 1880 p += ',' + $toString(args[i]); |
1889 } | 1881 } |
1890 // If the formal parameters string include ) - an illegal | 1882 // If the formal parameters string include ) - an illegal |
1891 // character - it may make the combined function expression | 1883 // character - it may make the combined function expression |
1892 // compile. We avoid this problem by checking for this early on. | 1884 // compile. We avoid this problem by checking for this early on. |
1893 if (%_CallFunction(p, ')', StringIndexOf) != -1) { | 1885 if (%_CallFunction(p, ')', $stringIndexOf) != -1) { |
1894 throw MakeSyntaxError(kParenthesisInArgString); | 1886 throw MakeSyntaxError(kParenthesisInArgString); |
1895 } | 1887 } |
1896 // If the formal parameters include an unbalanced block comment, the | 1888 // If the formal parameters include an unbalanced block comment, the |
1897 // function must be rejected. Since JavaScript does not allow nested | 1889 // function must be rejected. Since JavaScript does not allow nested |
1898 // comments we can include a trailing block comment to catch this. | 1890 // comments we can include a trailing block comment to catch this. |
1899 p += '\n/' + '**/'; | 1891 p += '\n/' + '**/'; |
1900 } | 1892 } |
1901 var body = (n > 0) ? $toString(args[n - 1]) : ''; | 1893 var body = (n > 0) ? $toString(args[n - 1]) : ''; |
1902 return '(' + function_token + '(' + p + ') {\n' + body + '\n})'; | 1894 return '(' + function_token + '(' + p + ') {\n' + body + '\n})'; |
1903 } | 1895 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 $objectLookupSetter = ObjectLookupSetter; | 1962 $objectLookupSetter = ObjectLookupSetter; |
1971 $objectToString = ObjectToString; | 1963 $objectToString = ObjectToString; |
1972 $overrideFunction = OverrideFunction; | 1964 $overrideFunction = OverrideFunction; |
1973 $ownPropertyKeys = OwnPropertyKeys; | 1965 $ownPropertyKeys = OwnPropertyKeys; |
1974 $setFunctionName = SetFunctionName; | 1966 $setFunctionName = SetFunctionName; |
1975 $setUpLockedPrototype = SetUpLockedPrototype; | 1967 $setUpLockedPrototype = SetUpLockedPrototype; |
1976 $toCompletePropertyDescriptor = ToCompletePropertyDescriptor; | 1968 $toCompletePropertyDescriptor = ToCompletePropertyDescriptor; |
1977 $toNameArray = ToNameArray; | 1969 $toNameArray = ToNameArray; |
1978 | 1970 |
1979 }) | 1971 }) |
OLD | NEW |