Commit 6d32be24 authored by arv's avatar arv Committed by Commit bot

[es6] Bound function name

Instead of updating the SharedFuntionInfo set the name property on
the function directly.

BUG=v8:4278
LOG=N
R=verwaest@chromium.org, littledan@chromium.org
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}
parent d42e81d5
...@@ -21,7 +21,6 @@ var GlobalFunction = global.Function; ...@@ -21,7 +21,6 @@ var GlobalFunction = global.Function;
var GlobalNumber = global.Number; var GlobalNumber = global.Number;
var GlobalObject = global.Object; var GlobalObject = global.Object;
var InternalArray = utils.InternalArray; var InternalArray = utils.InternalArray;
var SetFunctionName = utils.SetFunctionName;
var MathAbs; var MathAbs;
var ProxyDelegateCallAndConstruct; var ProxyDelegateCallAndConstruct;
...@@ -1705,7 +1704,8 @@ function FunctionBind(this_arg) { // Length is 1. ...@@ -1705,7 +1704,8 @@ function FunctionBind(this_arg) { // Length is 1.
var name = this.name; var name = this.name;
var bound_name = IS_STRING(name) ? name : ""; var bound_name = IS_STRING(name) ? name : "";
SetFunctionName(result, bound_name, "bound"); %DefineDataPropertyUnchecked(result, "name", "bound " + bound_name,
DONT_ENUM | READ_ONLY);
// We already have caller and arguments properties on functions, // We already have caller and arguments properties on functions,
// which are non-configurable. It therefore makes no sence to // which are non-configurable. It therefore makes no sence to
......
...@@ -5,9 +5,12 @@ ...@@ -5,9 +5,12 @@
function f() {} function f() {}
var fb = f.bind({}); var fb = f.bind({});
assertEquals('bound f', fb.name); assertEquals('bound f', fb.name);
assertEquals('function bound f() { [native code] }', fb.toString());
Object.defineProperty(f, 'name', {value: 42}); Object.defineProperty(f, 'name', {value: 42});
var fb2 = f.bind({}); var fb2 = f.bind({});
assertEquals('bound ', fb2.name); assertEquals('bound ', fb2.name);
assertEquals('function bound () { [native code] }', fb2.toString());
function g() {}
var gb = g.bind({});
assertEquals('bound g', gb.name);
assertEquals('bound f', fb.name);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment