Index: src/ia32/builtins-ia32.cc |
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc |
index 1715ac156291f14d4e3d03c57872e2b169d29faf..1c37d9f0dcbc2474c393e425be2164346a41dc8b 100644 |
--- a/src/ia32/builtins-ia32.cc |
+++ b/src/ia32/builtins-ia32.cc |
@@ -675,6 +675,19 @@ static void Generate_InterpreterPushArgs(MacroAssembler* masm, |
__ j(greater, &loop_header, Label::kNear); |
} |
+static void Generate_InterpreterComputeLastArgumentAddress( |
+ MacroAssembler* masm) { |
+ // Find the address of the last argument. |
+ // ----------- S t a t e ------------- |
+ // input: ebx : Address of the first argument. |
+ // output: ecx: Address of the last argument. |
+ // ----------------------------------- |
+ __ mov(ecx, eax); |
+ __ add(ecx, Immediate(1)); // Add one for receiver. |
+ __ shl(ecx, kPointerSizeLog2); |
+ __ neg(ecx); |
+ __ add(ecx, ebx); |
+} |
// static |
void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { |
@@ -689,13 +702,7 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { |
// Pop return address to allow tail-call after pushing arguments. |
__ Pop(edx); |
- // Find the address of the last argument. |
- __ mov(ecx, eax); |
- __ add(ecx, Immediate(1)); // Add one for receiver. |
- __ shl(ecx, kPointerSizeLog2); |
- __ neg(ecx); |
- __ add(ecx, ebx); |
- |
+ Generate_InterpreterComputeLastArgumentAddress(masm); |
Generate_InterpreterPushArgs(masm, ecx); |
// Call the target. |
@@ -705,6 +712,42 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { |
// static |
+void Builtins::Generate_InterpreterPushArgsAndCallIC(MacroAssembler* masm) { |
+ // ----------- S t a t e ------------- |
+ // -- eax : the number of arguments (not including the receiver) |
+ // -- ebx : 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. |
+ // -- edi : the target to call (can be any Object). |
+ // -- edx : feedback slot id. |
+ // -- ecx : type feedback vector. |
+ // ----------------------------------- |
+ |
+ { |
+ FrameScope scope(masm, StackFrame::INTERNAL); |
+ // Store type feedback vector in a virtual register. |
+ ExternalReference virtual_register = |
mvstanton
2016/02/15 11:13:45
I'd love it if we don't have to expand the usage o
rmcilroy
2016/02/15 11:20:50
Sorry, this was my fault suggesting it as I though
mvstanton
2016/02/15 11:32:04
LOL, I know, I am tempted too..! I think the virtu
mythria
2016/02/17 11:02:48
Done.
|
+ ExternalReference::virtual_handler_register(masm->isolate()); |
+ __ mov(Operand::StaticVariable(virtual_register), ecx); |
+ |
+ Generate_InterpreterComputeLastArgumentAddress(masm); |
mvstanton
2016/02/15 11:13:45
It would be nice if InterpreterComputeLastArgument
mythria
2016/02/17 11:02:48
We just clobber ecx, though we use eax and ebx as
|
+ Generate_InterpreterPushArgs(masm, ecx); |
+ |
+ // Restore feedback vector to ebx from the virtual register. |
+ __ mov(ebx, Operand::StaticVariable(virtual_register)); |
+ |
+ // Call via the CallIC stub. |
+ CallICState call_ic_state(0, ConvertReceiverMode::kAny, |
+ TailCallMode::kDisallow, 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_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
// -- eax : the number of arguments (not including the receiver) |