| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 RUNTIME_FUNCTION(Runtime_FunctionBindArguments) { | 389 RUNTIME_FUNCTION(Runtime_FunctionBindArguments) { |
| 390 HandleScope scope(isolate); | 390 HandleScope scope(isolate); |
| 391 DCHECK(args.length() == 4); | 391 DCHECK(args.length() == 4); |
| 392 CONVERT_ARG_HANDLE_CHECKED(JSFunction, bound_function, 0); | 392 CONVERT_ARG_HANDLE_CHECKED(JSFunction, bound_function, 0); |
| 393 CONVERT_ARG_HANDLE_CHECKED(Object, bindee, 1); | 393 CONVERT_ARG_HANDLE_CHECKED(Object, bindee, 1); |
| 394 CONVERT_ARG_HANDLE_CHECKED(Object, this_object, 2); | 394 CONVERT_ARG_HANDLE_CHECKED(Object, this_object, 2); |
| 395 CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3); | 395 CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3); |
| 396 | 396 |
| 397 // TODO(lrn): Create bound function in C++ code from premade shared info. | 397 // TODO(lrn): Create bound function in C++ code from premade shared info. |
| 398 bound_function->shared()->set_bound(true); | 398 bound_function->shared()->set_bound(true); |
| 399 bound_function->shared()->set_optimized_code_map(Smi::FromInt(0)); |
| 399 bound_function->shared()->set_inferred_name(isolate->heap()->empty_string()); | 400 bound_function->shared()->set_inferred_name(isolate->heap()->empty_string()); |
| 400 // Get all arguments of calling function (Function.prototype.bind). | 401 // Get all arguments of calling function (Function.prototype.bind). |
| 401 int argc = 0; | 402 int argc = 0; |
| 402 SmartArrayPointer<Handle<Object> > arguments = | 403 SmartArrayPointer<Handle<Object> > arguments = |
| 403 GetCallerArguments(isolate, 0, &argc); | 404 GetCallerArguments(isolate, 0, &argc); |
| 404 // Don't count the this-arg. | 405 // Don't count the this-arg. |
| 405 if (argc > 0) { | 406 if (argc > 0) { |
| 406 RUNTIME_ASSERT(arguments[0].is_identical_to(this_object)); | 407 RUNTIME_ASSERT(arguments[0].is_identical_to(this_object)); |
| 407 argc--; | 408 argc--; |
| 408 } else { | 409 } else { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 | 624 |
| 624 | 625 |
| 625 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 626 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
| 626 HandleScope scope(isolate); | 627 HandleScope scope(isolate); |
| 627 DCHECK(args.length() == 0); | 628 DCHECK(args.length() == 0); |
| 628 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 629 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
| 629 NewTypeError(MessageTemplate::kStrongArity)); | 630 NewTypeError(MessageTemplate::kStrongArity)); |
| 630 } | 631 } |
| 631 } // namespace internal | 632 } // namespace internal |
| 632 } // namespace v8 | 633 } // namespace v8 |
| OLD | NEW |