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

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

Issue 2307903002: [Interpreter] Collect allocation site feedback in call bytecode handler. (Closed)
Patch Set: ia32, arm and arm64 ports. Created 4 years, 3 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
Index: src/builtins/ia32/builtins-ia32.cc
diff --git a/src/builtins/ia32/builtins-ia32.cc b/src/builtins/ia32/builtins-ia32.cc
index b1a5cccb2dc1602675c29c03313bdd0a7abf36aa..0df6538a3f6884a03074816f578c7c4caac28cd7 100644
--- a/src/builtins/ia32/builtins-ia32.cc
+++ b/src/builtins/ia32/builtins-ia32.cc
@@ -761,19 +761,12 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl(
}
}
-// static
-void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
- MacroAssembler* masm, CallableType construct_type) {
- // ----------- S t a t e -------------
- // -- eax : the number of arguments (not including the receiver)
- // -- edx : the new target
- // -- edi : the constructor
- // -- ebx : allocation site feedback (if available or undefined)
- // -- ecx : 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.
- // -----------------------------------
+namespace {
+// Does not assume any free registers. Maintains all registers in their
+// original state on return.
+void Generate_InterpreterPushArgsAndReturnAddress(MacroAssembler* masm,
+ bool is_receiver_available) {
rmcilroy 2016/09/06 10:59:35 Could you pass the registers which are used as arg
mythria 2016/09/07 08:59:44 Done.
// Store edi, edx onto the stack. We need two extra registers
// so store edi, edx temporarily on stack.
__ Push(edi);
@@ -837,12 +830,17 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
__ mov(edi, Operand(esp, eax, times_pointer_size, 3 * kPointerSize));
__ mov(Operand(esp, 2 * kPointerSize), edi);
- // Slot meant for receiver contains return address. Reset it so that
- // we will not incorrectly interpret return address as an object.
- __ mov(Operand(esp, eax, times_pointer_size, 3 * kPointerSize), Immediate(0));
-
// Step 5 copy arguments to correct locations.
- __ mov(edx, eax);
+ if (is_receiver_available) {
rmcilroy 2016/09/06 10:59:35 ditto (if possible)
mythria 2016/09/07 08:59:45 This is difficult. We do not have any free registe
+ __ mov(edx, eax);
+ __ add(edx, Immediate(1));
+ } else {
+ // Slot meant for receiver contains return address. Reset it so that
+ // we will not incorrectly interpret return address as an object.
+ __ mov(Operand(esp, eax, times_pointer_size, 3 * kPointerSize),
+ Immediate(0));
+ __ mov(edx, eax);
+ }
Label loop_header, loop_check;
__ jmp(&loop_check);
@@ -858,6 +856,25 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
// Restore edi and edx.
__ Pop(edx);
__ Pop(edi);
+}
+
+} // end anonymous namespace
+
+// static
+void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
+ MacroAssembler* masm, CallableType construct_type) {
+ // ----------- S t a t e -------------
+ // -- eax : the number of arguments (not including the receiver)
+ // -- edx : the new target
+ // -- edi : the constructor
+ // -- ebx : allocation site feedback (if available or undefined)
+ // -- ecx : 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.
+ // -----------------------------------
+
+ // Push arguments and move return address to the top of stack.
+ Generate_InterpreterPushArgsAndReturnAddress(masm, false);
__ AssertUndefinedOrAllocationSite(ebx);
if (construct_type == CallableType::kJSFunction) {
@@ -877,6 +894,28 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
}
}
+// static
+void Builtins::Generate_InterpreterPushArgsAndConstructArray(
+ MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- eax : the number of arguments (not including the receiver)
+ // -- edx : the target to call checked to be Array function.
+ // -- ebx : the allocation site feedback
+ // -- ecx : 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.
+ // -----------------------------------
+
+ // Push arguments and move return address to the top of stack.
+ Generate_InterpreterPushArgsAndReturnAddress(masm, true);
+
+ // Array constructor expects constructor in edi. It is same as edx here.
+ __ Move(edi, edx);
+
+ ArrayConstructorStub stub(masm->isolate());
+ __ TailCallStub(&stub);
+}
+
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the return address to the correct point in the interpreter entry
// trampoline.

Powered by Google App Engine
This is Rietveld 408576698