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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 RUNTIME_FUNCTION(Runtime_FunctionBindArguments) { | 385 RUNTIME_FUNCTION(Runtime_FunctionBindArguments) { |
386 HandleScope scope(isolate); | 386 HandleScope scope(isolate); |
387 DCHECK(args.length() == 4); | 387 DCHECK(args.length() == 4); |
388 CONVERT_ARG_HANDLE_CHECKED(JSFunction, bound_function, 0); | 388 CONVERT_ARG_HANDLE_CHECKED(JSFunction, bound_function, 0); |
389 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, bindee, 1); | 389 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, bindee, 1); |
390 CONVERT_ARG_HANDLE_CHECKED(Object, this_object, 2); | 390 CONVERT_ARG_HANDLE_CHECKED(Object, this_object, 2); |
391 CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3); | 391 CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3); |
392 | 392 |
393 // TODO(lrn): Create bound function in C++ code from premade shared info. | 393 // TODO(lrn): Create bound function in C++ code from premade shared info. |
394 bound_function->shared()->set_bound(true); | 394 bound_function->shared()->set_bound(true); |
395 bound_function->shared()->set_optimized_code_map(Smi::FromInt(0)); | 395 bound_function->shared()->set_optimized_code_map( |
| 396 isolate->heap()->cleared_optimized_code_map()); |
396 bound_function->shared()->set_inferred_name(isolate->heap()->empty_string()); | 397 bound_function->shared()->set_inferred_name(isolate->heap()->empty_string()); |
397 // Get all arguments of calling function (Function.prototype.bind). | 398 // Get all arguments of calling function (Function.prototype.bind). |
398 int argc = 0; | 399 int argc = 0; |
399 base::SmartArrayPointer<Handle<Object>> arguments = | 400 base::SmartArrayPointer<Handle<Object>> arguments = |
400 Runtime::GetCallerArguments(isolate, 0, &argc); | 401 Runtime::GetCallerArguments(isolate, 0, &argc); |
401 // Don't count the this-arg. | 402 // Don't count the this-arg. |
402 if (argc > 0) { | 403 if (argc > 0) { |
403 RUNTIME_ASSERT(arguments[0].is_identical_to(this_object)); | 404 RUNTIME_ASSERT(arguments[0].is_identical_to(this_object)); |
404 argc--; | 405 argc--; |
405 } else { | 406 } else { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 | 638 |
638 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 639 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
639 HandleScope scope(isolate); | 640 HandleScope scope(isolate); |
640 DCHECK(args.length() == 0); | 641 DCHECK(args.length() == 0); |
641 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 642 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
642 NewTypeError(MessageTemplate::kStrongArity)); | 643 NewTypeError(MessageTemplate::kStrongArity)); |
643 } | 644 } |
644 | 645 |
645 } // namespace internal | 646 } // namespace internal |
646 } // namespace v8 | 647 } // namespace v8 |
OLD | NEW |