Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: src/v8natives.js

Issue 1222363002: Revert of Revert of [es6] Bound function names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/function-bind-name.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
24 25
25 var MathAbs; 26 var MathAbs;
26 var ProxyDelegateCallAndConstruct; 27 var ProxyDelegateCallAndConstruct;
27 var ProxyDerivedHasOwnTrap; 28 var ProxyDerivedHasOwnTrap;
28 var ProxyDerivedKeysTrap; 29 var ProxyDerivedKeysTrap;
29 var StringIndexOf; 30 var StringIndexOf;
30 31
31 utils.Import(function(from) { 32 utils.Import(function(from) {
32 MathAbs = from.MathAbs; 33 MathAbs = from.MathAbs;
33 StringIndexOf = from.StringIndexOf; 34 StringIndexOf = from.StringIndexOf;
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 var argc = %_ArgumentsLength(); 1758 var argc = %_ArgumentsLength();
1758 if (argc > 0) argc--; // Don't count the thisArg as parameter. 1759 if (argc > 0) argc--; // Don't count the thisArg as parameter.
1759 new_length = old_length - argc; 1760 new_length = old_length - argc;
1760 if (new_length < 0) new_length = 0; 1761 if (new_length < 0) new_length = 0;
1761 } 1762 }
1762 // This runtime function finds any remaining arguments on the stack, 1763 // This runtime function finds any remaining arguments on the stack,
1763 // so we don't pass the arguments object. 1764 // so we don't pass the arguments object.
1764 var result = %FunctionBindArguments(boundFunction, this, 1765 var result = %FunctionBindArguments(boundFunction, this,
1765 this_arg, new_length); 1766 this_arg, new_length);
1766 1767
1768 var name = this.name;
1769 var bound_name = IS_STRING(name) ? name : "";
1770 SetFunctionName(result, bound_name, "bound");
1771
1767 // We already have caller and arguments properties on functions, 1772 // We already have caller and arguments properties on functions,
1768 // which are non-configurable. It therefore makes no sence to 1773 // which are non-configurable. It therefore makes no sence to
1769 // try to redefine these as defined by the spec. The spec says 1774 // try to redefine these as defined by the spec. The spec says
1770 // that bind should make these throw a TypeError if get or set 1775 // that bind should make these throw a TypeError if get or set
1771 // is called and make them non-enumerable and non-configurable. 1776 // is called and make them non-enumerable and non-configurable.
1772 // To be consistent with our normal functions we leave this as it is. 1777 // To be consistent with our normal functions we leave this as it is.
1773 // TODO(lrn): Do set these to be thrower. 1778 // TODO(lrn): Do set these to be thrower.
1774 return result; 1779 return result;
1775 } 1780 }
1776 1781
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; 1870 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys;
1866 to.ObjectHasOwnProperty = ObjectHasOwnProperty; 1871 to.ObjectHasOwnProperty = ObjectHasOwnProperty;
1867 to.ObjectIsFrozen = ObjectIsFrozen; 1872 to.ObjectIsFrozen = ObjectIsFrozen;
1868 to.ObjectIsSealed = ObjectIsSealed; 1873 to.ObjectIsSealed = ObjectIsSealed;
1869 to.ObjectToString = ObjectToString; 1874 to.ObjectToString = ObjectToString;
1870 to.OwnPropertyKeys = OwnPropertyKeys; 1875 to.OwnPropertyKeys = OwnPropertyKeys;
1871 to.ToNameArray = ToNameArray; 1876 to.ToNameArray = ToNameArray;
1872 }); 1877 });
1873 1878
1874 }) 1879 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/function-bind-name.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698