Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: src/runtime/runtime-function.cc

Issue 1432493003: [turbofan] Fix new.target when a function is inlined to a constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@reland
Patch Set: Test added Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/frames.cc ('k') | test/mjsunit/es6/new-target.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 isolate, result, Execution::Call(isolate, fun, receiver, argc, argv)); 535 isolate, result, Execution::Call(isolate, fun, receiver, argc, argv));
536 return *result; 536 return *result;
537 } 537 }
538 538
539 539
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 // Currently we don't inline [[Construct]] calls.
546 : isolate->heap()->undefined_value(); 546 return frame->IsConstructor() && !frame->HasInlinedFrames()
547 ? frame->GetOriginalConstructor()
548 : isolate->heap()->undefined_value();
547 } 549 }
548 550
549 551
550 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. 552 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee.
551 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { 553 RUNTIME_FUNCTION(Runtime_ConvertReceiver) {
552 HandleScope scope(isolate); 554 HandleScope scope(isolate);
553 DCHECK(args.length() == 1); 555 DCHECK(args.length() == 1);
554 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); 556 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
555 if (receiver->IsNull() || receiver->IsUndefined()) { 557 if (receiver->IsNull() || receiver->IsUndefined()) {
556 return isolate->global_proxy(); 558 return isolate->global_proxy();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 612
611 613
612 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { 614 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) {
613 HandleScope scope(isolate); 615 HandleScope scope(isolate);
614 DCHECK(args.length() == 0); 616 DCHECK(args.length() == 0);
615 THROW_NEW_ERROR_RETURN_FAILURE(isolate, 617 THROW_NEW_ERROR_RETURN_FAILURE(isolate,
616 NewTypeError(MessageTemplate::kStrongArity)); 618 NewTypeError(MessageTemplate::kStrongArity));
617 } 619 }
618 } // namespace internal 620 } // namespace internal
619 } // namespace v8 621 } // namespace v8
OLDNEW
« no previous file with comments | « src/frames.cc ('k') | test/mjsunit/es6/new-target.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698