| 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 isolate, argv[i], Object::GetElement(isolate, arguments, offset + i)); | 578 isolate, argv[i], Object::GetElement(isolate, arguments, offset + i)); |
| 579 } | 579 } |
| 580 | 580 |
| 581 Handle<Object> result; | 581 Handle<Object> result; |
| 582 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 582 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 583 isolate, result, Execution::Call(isolate, fun, receiver, argc, argv)); | 583 isolate, result, Execution::Call(isolate, fun, receiver, argc, argv)); |
| 584 return *result; | 584 return *result; |
| 585 } | 585 } |
| 586 | 586 |
| 587 | 587 |
| 588 RUNTIME_FUNCTION(Runtime_GetNewTarget) { | |
| 589 SealHandleScope shs(isolate); | |
| 590 DCHECK(args.length() == 0); | |
| 591 JavaScriptFrameIterator it(isolate); | |
| 592 JavaScriptFrame* frame = it.frame(); | |
| 593 // TODO(4544): By now the runtime function is only used by the interpreter, | |
| 594 // get rid of the entire runtime function once the interpreter is switched. | |
| 595 DCHECK(!frame->is_optimized() && !frame->HasInlinedFrames()); | |
| 596 return frame->IsConstructor() ? frame->GetNewTarget() | |
| 597 : isolate->heap()->undefined_value(); | |
| 598 } | |
| 599 | |
| 600 | |
| 601 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. | 588 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. |
| 602 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { | 589 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { |
| 603 HandleScope scope(isolate); | 590 HandleScope scope(isolate); |
| 604 DCHECK(args.length() == 1); | 591 DCHECK(args.length() == 1); |
| 605 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); | 592 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
| 606 if (receiver->IsNull() || receiver->IsUndefined()) { | 593 if (receiver->IsNull() || receiver->IsUndefined()) { |
| 607 return isolate->global_proxy(); | 594 return isolate->global_proxy(); |
| 608 } | 595 } |
| 609 return *Object::ToObject(isolate, receiver).ToHandleChecked(); | 596 return *Object::ToObject(isolate, receiver).ToHandleChecked(); |
| 610 } | 597 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 631 | 618 |
| 632 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 619 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
| 633 HandleScope scope(isolate); | 620 HandleScope scope(isolate); |
| 634 DCHECK(args.length() == 0); | 621 DCHECK(args.length() == 0); |
| 635 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 622 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
| 636 NewTypeError(MessageTemplate::kStrongArity)); | 623 NewTypeError(MessageTemplate::kStrongArity)); |
| 637 } | 624 } |
| 638 | 625 |
| 639 } // namespace internal | 626 } // namespace internal |
| 640 } // namespace v8 | 627 } // namespace v8 |
| OLD | NEW |