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

Unified Diff: src/x64/code-stubs-x64.cc

Issue 1126783003: Handle the case when derived constructor is [[Call]]ed with 0 args. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | test/mjsunit/es6/regress/regress-474783.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index dd7346e9af13d8b6676c0fe87e9c5dcf3e6ca475..11cceb7b5e3a1a0044a9e8bdc84bf12958cc5677 100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -962,10 +962,17 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
__ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset));
if (has_new_target()) {
+ // If the constructor was [[Call]]ed, the call will not push a new.target
+ // onto the stack. In that case the arguments array we construct is bogus,
+ // bu we do not care as the constructor throws immediately.
+ __ Cmp(rcx, Smi::FromInt(0));
+ Label skip_decrement;
+ __ j(equal, &skip_decrement);
// Subtract 1 from smi-tagged arguments count.
__ SmiToInteger32(rcx, rcx);
__ decl(rcx);
__ Integer32ToSmi(rcx, rcx);
+ __ bind(&skip_decrement);
}
__ movp(args.GetArgumentOperand(2), rcx);
__ SmiToInteger64(rcx, rcx);
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | test/mjsunit/es6/regress/regress-474783.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698