From d7da617b4d8e3ee37e6520090657ae5e3ed7469b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Wed, 16 Sep 2015 21:00:32 +0200 Subject: [PATCH] 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 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} Fixes: https://github.com/nodejs/node/issues/2754 PR-URL: https://github.com/nodejs/node/pull/2916 Reviewed-By: Fedor Indutny Reviewed-By: Trevor Norris Reviewed-By: Ben Noordhuis --- deps/v8/src/v8natives.js | 4 ++-- deps/v8/test/mjsunit/function-bind-name.js | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/deps/v8/src/v8natives.js b/deps/v8/src/v8natives.js index 72cb8caa29c076..92769e25d2f0d9 100644 --- a/deps/v8/src/v8natives.js +++ b/deps/v8/src/v8natives.js @@ -21,7 +21,6 @@ var GlobalFunction = global.Function; var GlobalNumber = global.Number; var GlobalObject = global.Object; var InternalArray = utils.InternalArray; -var SetFunctionName = utils.SetFunctionName; var MathAbs; var ProxyDelegateCallAndConstruct; @@ -1705,7 +1704,8 @@ function FunctionBind(this_arg) { // Length is 1. var name = this.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, // which are non-configurable. It therefore makes no sence to diff --git a/deps/v8/test/mjsunit/function-bind-name.js b/deps/v8/test/mjsunit/function-bind-name.js index 3bebf3e72d9da5..bbbc272918c424 100644 --- a/deps/v8/test/mjsunit/function-bind-name.js +++ b/deps/v8/test/mjsunit/function-bind-name.js @@ -5,9 +5,12 @@ function f() {} var fb = f.bind({}); assertEquals('bound f', fb.name); -assertEquals('function bound f() { [native code] }', fb.toString()); Object.defineProperty(f, 'name', {value: 42}); var fb2 = f.bind({}); 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);