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 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 var argc = %_ArgumentsLength(); | 1757 var argc = %_ArgumentsLength(); |
1759 if (argc > 0) argc--; // Don't count the thisArg as parameter. | 1758 if (argc > 0) argc--; // Don't count the thisArg as parameter. |
1760 new_length = old_length - argc; | 1759 new_length = old_length - argc; |
1761 if (new_length < 0) new_length = 0; | 1760 if (new_length < 0) new_length = 0; |
1762 } | 1761 } |
1763 // This runtime function finds any remaining arguments on the stack, | 1762 // This runtime function finds any remaining arguments on the stack, |
1764 // so we don't pass the arguments object. | 1763 // so we don't pass the arguments object. |
1765 var result = %FunctionBindArguments(boundFunction, this, | 1764 var result = %FunctionBindArguments(boundFunction, this, |
1766 this_arg, new_length); | 1765 this_arg, new_length); |
1767 | 1766 |
1768 var name = this.name; | |
1769 var bound_name = IS_STRING(name) ? name : ""; | |
1770 SetFunctionName(result, bound_name, "bound"); | |
1771 | |
1772 // We already have caller and arguments properties on functions, | 1767 // We already have caller and arguments properties on functions, |
1773 // which are non-configurable. It therefore makes no sence to | 1768 // which are non-configurable. It therefore makes no sence to |
1774 // try to redefine these as defined by the spec. The spec says | 1769 // try to redefine these as defined by the spec. The spec says |
1775 // that bind should make these throw a TypeError if get or set | 1770 // that bind should make these throw a TypeError if get or set |
1776 // is called and make them non-enumerable and non-configurable. | 1771 // is called and make them non-enumerable and non-configurable. |
1777 // To be consistent with our normal functions we leave this as it is. | 1772 // To be consistent with our normal functions we leave this as it is. |
1778 // TODO(lrn): Do set these to be thrower. | 1773 // TODO(lrn): Do set these to be thrower. |
1779 return result; | 1774 return result; |
1780 } | 1775 } |
1781 | 1776 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; | 1865 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; |
1871 to.ObjectHasOwnProperty = ObjectHasOwnProperty; | 1866 to.ObjectHasOwnProperty = ObjectHasOwnProperty; |
1872 to.ObjectIsFrozen = ObjectIsFrozen; | 1867 to.ObjectIsFrozen = ObjectIsFrozen; |
1873 to.ObjectIsSealed = ObjectIsSealed; | 1868 to.ObjectIsSealed = ObjectIsSealed; |
1874 to.ObjectToString = ObjectToString; | 1869 to.ObjectToString = ObjectToString; |
1875 to.OwnPropertyKeys = OwnPropertyKeys; | 1870 to.OwnPropertyKeys = OwnPropertyKeys; |
1876 to.ToNameArray = ToNameArray; | 1871 to.ToNameArray = ToNameArray; |
1877 }); | 1872 }); |
1878 | 1873 |
1879 }) | 1874 }) |
OLD | NEW |