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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 isolate, argv[i], Object::GetElement(isolate, arguments, offset + i)); | 558 isolate, argv[i], Object::GetElement(isolate, arguments, offset + i)); |
559 } | 559 } |
560 | 560 |
561 Handle<Object> result; | 561 Handle<Object> result; |
562 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 562 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
563 isolate, result, Execution::Call(isolate, fun, receiver, argc, argv)); | 563 isolate, result, Execution::Call(isolate, fun, receiver, argc, argv)); |
564 return *result; | 564 return *result; |
565 } | 565 } |
566 | 566 |
567 | 567 |
568 RUNTIME_FUNCTION(Runtime_GetOriginalConstructor) { | 568 RUNTIME_FUNCTION(Runtime_GetNewTarget) { |
569 SealHandleScope shs(isolate); | 569 SealHandleScope shs(isolate); |
570 DCHECK(args.length() == 0); | 570 DCHECK(args.length() == 0); |
571 JavaScriptFrameIterator it(isolate); | 571 JavaScriptFrameIterator it(isolate); |
572 JavaScriptFrame* frame = it.frame(); | 572 JavaScriptFrame* frame = it.frame(); |
573 // TODO(4544): Currently we never inline any [[Construct]] calls where the | 573 // TODO(4544): Currently we never inline any [[Construct]] calls where the |
574 // actual constructor differs from the original constructor. Fix this soon! | 574 // actual target differs from the new target. Fix this soon! |
575 if (frame->HasInlinedFrames()) { | 575 if (frame->HasInlinedFrames()) { |
576 HandleScope scope(isolate); | 576 HandleScope scope(isolate); |
577 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); | 577 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
578 it.frame()->Summarize(&frames); | 578 it.frame()->Summarize(&frames); |
579 FrameSummary& summary = frames.last(); | 579 FrameSummary& summary = frames.last(); |
580 return summary.is_constructor() ? Object::cast(*summary.function()) | 580 return summary.is_constructor() ? Object::cast(*summary.function()) |
581 : isolate->heap()->undefined_value(); | 581 : isolate->heap()->undefined_value(); |
582 } | 582 } |
583 return frame->IsConstructor() ? frame->GetOriginalConstructor() | 583 return frame->IsConstructor() ? frame->GetNewTarget() |
584 : isolate->heap()->undefined_value(); | 584 : isolate->heap()->undefined_value(); |
585 } | 585 } |
586 | 586 |
587 | 587 |
588 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. | 588 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. |
589 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { | 589 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { |
590 HandleScope scope(isolate); | 590 HandleScope scope(isolate); |
591 DCHECK(args.length() == 1); | 591 DCHECK(args.length() == 1); |
592 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); | 592 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
593 if (receiver->IsNull() || receiver->IsUndefined()) { | 593 if (receiver->IsNull() || receiver->IsUndefined()) { |
(...skipping 24 matching lines...) Expand all Loading... |
618 | 618 |
619 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 619 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
620 HandleScope scope(isolate); | 620 HandleScope scope(isolate); |
621 DCHECK(args.length() == 0); | 621 DCHECK(args.length() == 0); |
622 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 622 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
623 NewTypeError(MessageTemplate::kStrongArity)); | 623 NewTypeError(MessageTemplate::kStrongArity)); |
624 } | 624 } |
625 | 625 |
626 } // namespace internal | 626 } // namespace internal |
627 } // namespace v8 | 627 } // namespace v8 |
OLD | NEW |