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

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

Issue 1688283003: [Interpreter] Implements calls through CallICStub in the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removes an unused label declaration. Created 4 years, 10 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 | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/builtins-arm.cc
diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc
index 4d6c30ee679b6a230dc06a6fde803fa73296ce98..2bc1a5d3a0535a06b1c513d767837f84a2d8a9d1 100644
--- a/src/arm/builtins-arm.cc
+++ b/src/arm/builtins-arm.cc
@@ -969,6 +969,46 @@ static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index,
__ b(gt, &loop_header);
}
+static void Generate_InterpreterComputeLastArgumentAddress(
+ MacroAssembler* masm, Register num_args, Register start_address,
+ Register output_reg) {
+ __ add(output_reg, num_args, Operand(1)); // Add one for receiver.
+ __ mov(output_reg, Operand(output_reg, LSL, kPointerSizeLog2));
+ __ sub(output_reg, start_address, output_reg);
+}
+
+// static
+void Builtins::Generate_InterpreterPushArgsAndCallICImpl(
+ MacroAssembler* masm, TailCallMode tail_call_mode) {
+ // ----------- S t a t e -------------
+ // -- r0 : the number of arguments (not including the receiver)
+ // -- r4 : the address of the first argument to be pushed. Subsequent
+ // arguments should be consecutive above this, in the same order as
+ // they are to be pushed onto the stack.
+ // -- r1 : the target to call (can be any Object).
+ // -- r3 : feedback vector slot id
+ // -- r2 : type feedback vector
+ // -----------------------------------
+
+ {
+ FrameScope scope(masm, StackFrame::INTERNAL);
+
+ // Find the address of the last argument.
+ Generate_InterpreterComputeLastArgumentAddress(masm, r0, r4, r5);
+
+ // Push the arguments.
+ Generate_InterpreterPushArgs(masm, r4, r5, r6);
+
+ // Call via the CallIC stub.
+ CallICState call_ic_state(0, ConvertReceiverMode::kAny, tail_call_mode,
+ true);
+ CallICStub stub(masm->isolate(), call_ic_state);
+ // TODO(mythria): This should be replaced by a TailCallStub, when we
+ // update the code to find the target IC from jump instructions.
+ __ CallStub(&stub);
+ }
+ __ Ret();
+}
// static
void Builtins::Generate_InterpreterPushArgsAndCallImpl(
@@ -982,9 +1022,7 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl(
// -----------------------------------
// Find the address of the last argument.
- __ add(r3, r0, Operand(1)); // Add one for receiver.
- __ mov(r3, Operand(r3, LSL, kPointerSizeLog2));
- __ sub(r3, r2, r3);
+ Generate_InterpreterComputeLastArgumentAddress(masm, r0, r2, r3);
// Push the arguments.
Generate_InterpreterPushArgs(masm, r2, r3, r4);
@@ -1935,6 +1973,17 @@ void PrepareForTailCall(MacroAssembler* masm, Register args_reg,
__ cmp(scratch1, Operand(0));
__ b(ne, &done);
+ // Drop possible internal frame pushed for calling CallICStub.
+ // TODO(mythria): when we tail call the CallICStub, remove this.
+ {
+ Label no_internal_callic_frame;
+ __ ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset));
+ __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::INTERNAL)));
+ __ b(ne, &no_internal_callic_frame);
+ __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
+ __ bind(&no_internal_callic_frame);
+ }
+
// Drop possible interpreter handler/stub frame.
{
Label no_interpreter_frame;
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698