Commit fefee7dc authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

[v8-extras] Remove `simpleBind`

The `simpleBind` function exposed by V8 Extras was initially added to
work around the terrible performance of `Function.prototype.bind` at
the time. Nowadays `Function.prototype.bind` is significantly faster
and fully optimized by TurboFan, however, so there’s no need for the
`simpleBind` helper anymore.

Bug: chromium:807522
Change-Id: I1a0456e2aa34f92a3c9a0234a812b660f969d016
Reviewed-on: https://chromium-review.googlesource.com/903164Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51108}
parent 71ea148e
......@@ -177,13 +177,7 @@ extrasUtils.createPrivateSymbol = function createPrivateSymbol(name) {
//
// Technically they could all be derived from combinations of
// Function.prototype.{bind,call,apply} but that introduces lots of layers of
// indirection and slowness given how un-optimized bind is.
extrasUtils.simpleBind = function simpleBind(func, thisArg) {
return function(...args) {
return %reflect_apply(func, thisArg, args);
};
};
// indirection.
extrasUtils.uncurryThis = function uncurryThis(func) {
return function(thisArg, ...args) {
......
......@@ -23,7 +23,7 @@
// Exercise all of the extras utils:
// - v8.createPrivateSymbol
// - v8.simpleBind, v8.uncurryThis
// - v8.uncurryThis
// - v8.InternalPackedArray
// - v8.createPromise, v8.resolvePromise, v8.rejectPromise
......@@ -35,7 +35,7 @@
const apply = v8.uncurryThis(Function.prototype.apply);
const Promise = global.Promise;
const Promise_resolve = v8.simpleBind(Promise.resolve, Promise);
const Promise_resolve = Promise.resolve.bind(Promise);
const arrayToTest = new v8.InternalPackedArray();
arrayToTest.push(1);
......
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