| Index: src/v8natives.js
|
| diff --git a/src/v8natives.js b/src/v8natives.js
|
| index 04444697d817a035c709ffcf9a044fb91bf3d81c..c502c2422065dfd3fd6ab31608d917ab240e0dc4 100644
|
| --- a/src/v8natives.js
|
| +++ b/src/v8natives.js
|
| @@ -1141,26 +1141,30 @@ function FunctionBind(this_arg) { // Length is 1.
|
| }
|
| }
|
| var fn = this;
|
| - var result = function() {
|
| - // Combine the args we got from the bind call with the args
|
| - // given as argument to the invocation.
|
| - var argc = %_ArgumentsLength();
|
| - var args = new $Array(argc + argc_bound);
|
| - // Add bound arguments.
|
| - for (var i = 0; i < argc_bound; i++) {
|
| - args[i] = bound_args[i];
|
| - }
|
| - // Add arguments from call.
|
| - for (var i = 0; i < argc; i++) {
|
| - args[argc_bound + i] = %_Arguments(i);
|
| - }
|
| - // If this is a construct call we use a special runtime method
|
| - // to generate the actual object using the bound function.
|
| - if (%_IsConstructCall()) {
|
| - return %NewObjectFromBound(fn, args);
|
| - }
|
| - return fn.apply(this_arg, args);
|
| - };
|
| + if (argc_bound == 0) {
|
| + var result = function() { return fn.apply(this_arg, arguments); };
|
| + } else {
|
| + var result = function() {
|
| + // Combine the args we got from the bind call with the args
|
| + // given as argument to the invocation.
|
| + var argc = %_ArgumentsLength();
|
| + var args = new $Array(argc + argc_bound);
|
| + // Add bound arguments.
|
| + for (var i = 0; i < argc_bound; i++) {
|
| + args[i] = bound_args[i];
|
| + }
|
| + // Add arguments from call.
|
| + for (var i = 0; i < argc; i++) {
|
| + args[argc_bound + i] = %_Arguments(i);
|
| + }
|
| + // If this is a construct call we use a special runtime method
|
| + // to generate the actual object using the bound function.
|
| + if (%_IsConstructCall()) {
|
| + return %NewObjectFromBound(fn, args);
|
| + }
|
| + return fn.apply(this_arg, args);
|
| + };
|
| + }
|
|
|
| // We already have caller and arguments properties on functions,
|
| // which are non-configurable. It therefore makes no sence to
|
|
|