| Index: src/builtins.cc
|
| diff --git a/src/builtins.cc b/src/builtins.cc
|
| index c596a9ca67d78858b52bf4ed98d27b058cd571ba..8d33428be5fc5743b3107ded7f790ebf3e601bc2 100644
|
| --- a/src/builtins.cc
|
| +++ b/src/builtins.cc
|
| @@ -4238,9 +4238,10 @@ BUILTIN(FunctionConstructor) {
|
| return *result;
|
| }
|
|
|
| +namespace {
|
|
|
| -// ES6 section 19.2.3.2 Function.prototype.bind ( thisArg, ...args )
|
| -BUILTIN(FunctionPrototypeBind) {
|
| +Object* DoFunctionBind(Isolate* isolate,
|
| + BuiltinArguments<BuiltinExtraArguments::kNone> args) {
|
| HandleScope scope(isolate);
|
| DCHECK_LE(1, args.length());
|
| if (!args.receiver()->IsCallable()) {
|
| @@ -4324,6 +4325,22 @@ BUILTIN(FunctionPrototypeBind) {
|
| return *function;
|
| }
|
|
|
| +} // namespace
|
| +
|
| +// ES6 section 19.2.3.2 Function.prototype.bind ( thisArg, ...args )
|
| +BUILTIN(FunctionPrototypeBind) { return DoFunctionBind(isolate, args); }
|
| +
|
| +// TODO(verwaest): This is a temporary helper until the FastFunctionBind stub
|
| +// can tailcall to the builtin directly.
|
| +RUNTIME_FUNCTION(Runtime_FunctionBind) {
|
| + DCHECK_EQ(2, args.length());
|
| + Arguments* incoming = reinterpret_cast<Arguments*>(args[0]);
|
| + // Rewrap the arguments as builtins arguments.
|
| + BuiltinArguments<BuiltinExtraArguments::kNone> caller_args(
|
| + incoming->length() + 1, incoming->arguments() + 1);
|
| + return DoFunctionBind(isolate, caller_args);
|
| +}
|
| +
|
| // ES6 section 19.2.3.5 Function.prototype.toString ( )
|
| BUILTIN(FunctionPrototypeToString) {
|
| HandleScope scope(isolate);
|
|
|