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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 RUNTIME_FUNCTION(Runtime_GetOriginalConstructor) { | 540 RUNTIME_FUNCTION(Runtime_GetOriginalConstructor) { |
541 SealHandleScope shs(isolate); | 541 SealHandleScope shs(isolate); |
542 DCHECK(args.length() == 0); | 542 DCHECK(args.length() == 0); |
543 JavaScriptFrameIterator it(isolate); | 543 JavaScriptFrameIterator it(isolate); |
544 JavaScriptFrame* frame = it.frame(); | 544 JavaScriptFrame* frame = it.frame(); |
545 return frame->IsConstructor() ? frame->GetOriginalConstructor() | 545 return frame->IsConstructor() ? frame->GetOriginalConstructor() |
546 : isolate->heap()->undefined_value(); | 546 : isolate->heap()->undefined_value(); |
547 } | 547 } |
548 | 548 |
549 | 549 |
| 550 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. |
| 551 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { |
| 552 HandleScope scope(isolate); |
| 553 DCHECK(args.length() == 1); |
| 554 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
| 555 if (receiver->IsNull() || receiver->IsUndefined()) { |
| 556 return isolate->global_proxy(); |
| 557 } |
| 558 return *Object::ToObject(isolate, receiver).ToHandleChecked(); |
| 559 } |
| 560 |
| 561 |
550 // TODO(bmeurer): Kill %_CallFunction ASAP as it is almost never used | 562 // TODO(bmeurer): Kill %_CallFunction ASAP as it is almost never used |
551 // correctly because of the weird semantics underneath. | 563 // correctly because of the weird semantics underneath. |
552 RUNTIME_FUNCTION(Runtime_CallFunction) { | 564 RUNTIME_FUNCTION(Runtime_CallFunction) { |
553 HandleScope scope(isolate); | 565 HandleScope scope(isolate); |
554 DCHECK(args.length() >= 2); | 566 DCHECK(args.length() >= 2); |
555 int argc = args.length() - 2; | 567 int argc = args.length() - 2; |
556 CONVERT_ARG_CHECKED(JSReceiver, fun, argc + 1); | 568 CONVERT_ARG_CHECKED(JSReceiver, fun, argc + 1); |
557 Object* receiver = args[0]; | 569 Object* receiver = args[0]; |
558 | 570 |
559 // If there are too many arguments, allocate argv via malloc. | 571 // If there are too many arguments, allocate argv via malloc. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 610 |
599 | 611 |
600 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 612 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
601 HandleScope scope(isolate); | 613 HandleScope scope(isolate); |
602 DCHECK(args.length() == 0); | 614 DCHECK(args.length() == 0); |
603 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 615 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
604 NewTypeError(MessageTemplate::kStrongArity)); | 616 NewTypeError(MessageTemplate::kStrongArity)); |
605 } | 617 } |
606 } // namespace internal | 618 } // namespace internal |
607 } // namespace v8 | 619 } // namespace v8 |
OLD | NEW |