| 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.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/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 RUNTIME_FUNCTION(Runtime_FunctionBindArguments) { | 384 RUNTIME_FUNCTION(Runtime_FunctionBindArguments) { |
| 385 HandleScope scope(isolate); | 385 HandleScope scope(isolate); |
| 386 DCHECK(args.length() == 4); | 386 DCHECK(args.length() == 4); |
| 387 CONVERT_ARG_HANDLE_CHECKED(JSFunction, bound_function, 0); | 387 CONVERT_ARG_HANDLE_CHECKED(JSFunction, bound_function, 0); |
| 388 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, bindee, 1); | 388 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, bindee, 1); |
| 389 CONVERT_ARG_HANDLE_CHECKED(Object, this_object, 2); | 389 CONVERT_ARG_HANDLE_CHECKED(Object, this_object, 2); |
| 390 CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3); | 390 CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3); |
| 391 | 391 |
| 392 // TODO(lrn): Create bound function in C++ code from premade shared info. | 392 // TODO(lrn): Create bound function in C++ code from premade shared info. |
| 393 bound_function->shared()->set_bound(true); | 393 bound_function->shared()->set_bound(true); |
| 394 bound_function->shared()->set_optimized_code_map(Smi::FromInt(0)); | 394 bound_function->shared()->set_optimized_code_map( |
| 395 isolate->heap()->cleared_optimized_code_map()); |
| 395 bound_function->shared()->set_inferred_name(isolate->heap()->empty_string()); | 396 bound_function->shared()->set_inferred_name(isolate->heap()->empty_string()); |
| 396 // Get all arguments of calling function (Function.prototype.bind). | 397 // Get all arguments of calling function (Function.prototype.bind). |
| 397 int argc = 0; | 398 int argc = 0; |
| 398 base::SmartArrayPointer<Handle<Object>> arguments = | 399 base::SmartArrayPointer<Handle<Object>> arguments = |
| 399 Runtime::GetCallerArguments(isolate, 0, &argc); | 400 Runtime::GetCallerArguments(isolate, 0, &argc); |
| 400 // Don't count the this-arg. | 401 // Don't count the this-arg. |
| 401 if (argc > 0) { | 402 if (argc > 0) { |
| 402 RUNTIME_ASSERT(arguments[0].is_identical_to(this_object)); | 403 RUNTIME_ASSERT(arguments[0].is_identical_to(this_object)); |
| 403 argc--; | 404 argc--; |
| 404 } else { | 405 } else { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 | 609 |
| 609 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 610 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
| 610 HandleScope scope(isolate); | 611 HandleScope scope(isolate); |
| 611 DCHECK(args.length() == 0); | 612 DCHECK(args.length() == 0); |
| 612 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 613 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
| 613 NewTypeError(MessageTemplate::kStrongArity)); | 614 NewTypeError(MessageTemplate::kStrongArity)); |
| 614 } | 615 } |
| 615 | 616 |
| 616 } // namespace internal | 617 } // namespace internal |
| 617 } // namespace v8 | 618 } // namespace v8 |
| OLD | NEW |