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 $functionSourceString; | 5 var $functionSourceString; |
6 var $globalEval; | 6 var $globalEval; |
7 var $objectDefineOwnProperty; | 7 var $objectDefineOwnProperty; |
8 var $objectGetOwnPropertyDescriptor; | 8 var $objectGetOwnPropertyDescriptor; |
9 var $toCompletePropertyDescriptor; | 9 var $toCompletePropertyDescriptor; |
10 | 10 |
11 (function(global, utils) { | 11 (function(global, utils) { |
12 | 12 |
13 %CheckIsBootstrapping(); | 13 %CheckIsBootstrapping(); |
14 | 14 |
15 // ---------------------------------------------------------------------------- | 15 // ---------------------------------------------------------------------------- |
16 // Imports | 16 // Imports |
17 | 17 |
18 var GlobalArray = global.Array; | 18 var GlobalArray = global.Array; |
19 var GlobalBoolean = global.Boolean; | 19 var GlobalBoolean = global.Boolean; |
20 var GlobalFunction = global.Function; | 20 var GlobalFunction = global.Function; |
21 var GlobalNumber = global.Number; | 21 var GlobalNumber = global.Number; |
22 var GlobalObject = global.Object; | 22 var GlobalObject = global.Object; |
23 var InternalArray = utils.InternalArray; | 23 var InternalArray = utils.InternalArray; |
24 var SetFunctionName = utils.SetFunctionName; | |
25 | 24 |
26 var MathAbs; | 25 var MathAbs; |
27 var ProxyDelegateCallAndConstruct; | 26 var ProxyDelegateCallAndConstruct; |
28 var ProxyDerivedHasOwnTrap; | 27 var ProxyDerivedHasOwnTrap; |
29 var ProxyDerivedKeysTrap; | 28 var ProxyDerivedKeysTrap; |
30 var StringIndexOf; | 29 var StringIndexOf; |
31 | 30 |
32 utils.Import(function(from) { | 31 utils.Import(function(from) { |
33 MathAbs = from.MathAbs; | 32 MathAbs = from.MathAbs; |
34 StringIndexOf = from.StringIndexOf; | 33 StringIndexOf = from.StringIndexOf; |
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 new_length = old_length - argc; | 1697 new_length = old_length - argc; |
1699 if (new_length < 0) new_length = 0; | 1698 if (new_length < 0) new_length = 0; |
1700 } | 1699 } |
1701 // This runtime function finds any remaining arguments on the stack, | 1700 // This runtime function finds any remaining arguments on the stack, |
1702 // so we don't pass the arguments object. | 1701 // so we don't pass the arguments object. |
1703 var result = %FunctionBindArguments(boundFunction, this, | 1702 var result = %FunctionBindArguments(boundFunction, this, |
1704 this_arg, new_length); | 1703 this_arg, new_length); |
1705 | 1704 |
1706 var name = this.name; | 1705 var name = this.name; |
1707 var bound_name = IS_STRING(name) ? name : ""; | 1706 var bound_name = IS_STRING(name) ? name : ""; |
1708 SetFunctionName(result, bound_name, "bound"); | 1707 %DefineDataPropertyUnchecked(result, "name", "bound " + bound_name, |
| 1708 DONT_ENUM | READ_ONLY); |
1709 | 1709 |
1710 // We already have caller and arguments properties on functions, | 1710 // We already have caller and arguments properties on functions, |
1711 // which are non-configurable. It therefore makes no sence to | 1711 // which are non-configurable. It therefore makes no sence to |
1712 // try to redefine these as defined by the spec. The spec says | 1712 // try to redefine these as defined by the spec. The spec says |
1713 // that bind should make these throw a TypeError if get or set | 1713 // that bind should make these throw a TypeError if get or set |
1714 // is called and make them non-enumerable and non-configurable. | 1714 // is called and make them non-enumerable and non-configurable. |
1715 // To be consistent with our normal functions we leave this as it is. | 1715 // To be consistent with our normal functions we leave this as it is. |
1716 // TODO(lrn): Do set these to be thrower. | 1716 // TODO(lrn): Do set these to be thrower. |
1717 return result; | 1717 return result; |
1718 } | 1718 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; | 1808 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; |
1809 to.ObjectHasOwnProperty = ObjectHasOwnProperty; | 1809 to.ObjectHasOwnProperty = ObjectHasOwnProperty; |
1810 to.ObjectIsFrozen = ObjectIsFrozen; | 1810 to.ObjectIsFrozen = ObjectIsFrozen; |
1811 to.ObjectIsSealed = ObjectIsSealed; | 1811 to.ObjectIsSealed = ObjectIsSealed; |
1812 to.ObjectToString = ObjectToString; | 1812 to.ObjectToString = ObjectToString; |
1813 to.OwnPropertyKeys = OwnPropertyKeys; | 1813 to.OwnPropertyKeys = OwnPropertyKeys; |
1814 to.ToNameArray = ToNameArray; | 1814 to.ToNameArray = ToNameArray; |
1815 }); | 1815 }); |
1816 | 1816 |
1817 }) | 1817 }) |
OLD | NEW |