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

Unified Diff: src/builtins/arm64/builtins-arm64.cc

Issue 2190293003: [Interpreter] Collect type feedback for 'new' in the bytecode handler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updated cctest.status and mjsunit.status Created 4 years, 4 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/builtins/arm/builtins-arm.cc ('k') | src/builtins/builtins.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/arm64/builtins-arm64.cc
diff --git a/src/builtins/arm64/builtins-arm64.cc b/src/builtins/arm64/builtins-arm64.cc
index b4a728a9da3196e70baa786a2745156ab98d7119..039fcd457067712cfe40a1106288e7e30dc42fbe 100644
--- a/src/builtins/arm64/builtins-arm64.cc
+++ b/src/builtins/arm64/builtins-arm64.cc
@@ -1186,6 +1186,7 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl(
__ lsl(x3, x3, kPointerSizeLog2);
__ sub(x4, x2, x3);
+ // TODO(mythria): Add a stack check before pushing arguments.
// Push the arguments.
Label loop_header, loop_check;
__ Mov(x5, jssp);
@@ -1213,12 +1214,14 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl(
}
// static
-void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
+void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
+ MacroAssembler* masm, CallableType construct_type) {
// ----------- S t a t e -------------
// -- x0 : argument count (not including receiver)
// -- x3 : new target
// -- x1 : constructor to call
- // -- x2 : address of the first argument
+ // -- x2 : allocation site feedback if available, undefined otherwise
+ // -- x4 : address of the first argument
// -----------------------------------
// Find the address of the last argument.
@@ -1228,24 +1231,38 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
// Set stack pointer and where to stop.
__ Mov(x6, jssp);
__ Claim(x5, 1);
- __ sub(x4, x6, x5);
+ __ sub(x7, x6, x5);
// Push a slot for the receiver.
__ Str(xzr, MemOperand(x6, -kPointerSize, PreIndex));
Label loop_header, loop_check;
+ // TODO(mythria): Add a stack check before pushing arguments.
// Push the arguments.
__ B(&loop_check);
__ Bind(&loop_header);
// TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned.
- __ Ldr(x5, MemOperand(x2, -kPointerSize, PostIndex));
+ __ Ldr(x5, MemOperand(x4, -kPointerSize, PostIndex));
__ Str(x5, MemOperand(x6, -kPointerSize, PreIndex));
__ Bind(&loop_check);
- __ Cmp(x6, x4);
+ __ Cmp(x6, x7);
__ B(gt, &loop_header);
- // Call the constructor with x0, x1, and x3 unmodified.
- __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
+ __ AssertUndefinedOrAllocationSite(x2, x6);
+ if (construct_type == CallableType::kJSFunction) {
+ __ AssertFunction(x1);
+
+ // Tail call to the function-specific construct stub (still in the caller
+ // context at this point).
+ __ Ldr(x4, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
+ __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset));
+ __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag);
+ __ Br(x4);
+ } else {
+ DCHECK_EQ(construct_type, CallableType::kAny);
+ // Call the constructor with x0, x1, and x3 unmodified.
+ __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
+ }
}
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
« no previous file with comments | « src/builtins/arm/builtins-arm.cc ('k') | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698