Skip to content

Commit d7da617

Browse files
targosindutny
authored andcommitted
deps: backport 6d32be2 from v8's upstream
Original commit message: [es6] Bound function name Instead of updating the SharedFuntionInfo set the name property on the function directly. BUG=v8:4278 LOG=N [email protected], [email protected] CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_chromium_rel_ng;tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1227523003 Cr-Commit-Position: refs/heads/master@{#29558} Fixes: #2754 PR-URL: #2916 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 2b8a06b commit d7da617

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

deps/v8/src/v8natives.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ var GlobalFunction = global.Function;
2121
var GlobalNumber = global.Number;
2222
var GlobalObject = global.Object;
2323
var InternalArray = utils.InternalArray;
24-
var SetFunctionName = utils.SetFunctionName;
2524

2625
var MathAbs;
2726
var ProxyDelegateCallAndConstruct;
@@ -1705,7 +1704,8 @@ function FunctionBind(this_arg) { // Length is 1.
17051704

17061705
var name = this.name;
17071706
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);
17091709

17101710
// We already have caller and arguments properties on functions,
17111711
// which are non-configurable. It therefore makes no sence to

deps/v8/test/mjsunit/function-bind-name.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
function f() {}
66
var fb = f.bind({});
77
assertEquals('bound f', fb.name);
8-
assertEquals('function bound f() { [native code] }', fb.toString());
98

109
Object.defineProperty(f, 'name', {value: 42});
1110
var fb2 = f.bind({});
1211
assertEquals('bound ', fb2.name);
13-
assertEquals('function bound () { [native code] }', fb2.toString());
12+
13+
function g() {}
14+
var gb = g.bind({});
15+
assertEquals('bound g', gb.name);
16+
assertEquals('bound f', fb.name);

0 commit comments

Comments
 (0)