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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { | 588 RUNTIME_FUNCTION(Runtime_GetNewTarget) { |
589 SealHandleScope shs(isolate); | 589 SealHandleScope shs(isolate); |
590 DCHECK(args.length() == 0); | 590 DCHECK(args.length() == 0); |
591 JavaScriptFrameIterator it(isolate); | 591 JavaScriptFrameIterator it(isolate); |
592 JavaScriptFrame* frame = it.frame(); | 592 JavaScriptFrame* frame = it.frame(); |
593 // TODO(4544): Currently we never inline any [[Construct]] calls where the | 593 // TODO(4544): By now the runtime function is only used by the interpreter, |
594 // actual target differs from the new target. Fix this soon! | 594 // get rid of the entire runtime function once the interpreter is switched. |
595 if (frame->HasInlinedFrames()) { | 595 DCHECK(!frame->is_optimized() && !frame->HasInlinedFrames()); |
596 HandleScope scope(isolate); | |
597 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); | |
598 it.frame()->Summarize(&frames); | |
599 FrameSummary& summary = frames.last(); | |
600 return summary.is_constructor() ? Object::cast(*summary.function()) | |
601 : isolate->heap()->undefined_value(); | |
602 } | |
603 return frame->IsConstructor() ? frame->GetNewTarget() | 596 return frame->IsConstructor() ? frame->GetNewTarget() |
604 : isolate->heap()->undefined_value(); | 597 : isolate->heap()->undefined_value(); |
605 } | 598 } |
606 | 599 |
607 | 600 |
608 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. | 601 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. |
609 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { | 602 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { |
610 HandleScope scope(isolate); | 603 HandleScope scope(isolate); |
611 DCHECK(args.length() == 1); | 604 DCHECK(args.length() == 1); |
612 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); | 605 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
(...skipping 25 matching lines...) Expand all Loading... |
638 | 631 |
639 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 632 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
640 HandleScope scope(isolate); | 633 HandleScope scope(isolate); |
641 DCHECK(args.length() == 0); | 634 DCHECK(args.length() == 0); |
642 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 635 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
643 NewTypeError(MessageTemplate::kStrongArity)); | 636 NewTypeError(MessageTemplate::kStrongArity)); |
644 } | 637 } |
645 | 638 |
646 } // namespace internal | 639 } // namespace internal |
647 } // namespace v8 | 640 } // namespace v8 |
OLD | NEW |