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

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

Issue 1402943002: [Interpreter] Support for operator new. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: One more test. Created 5 years, 2 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/compiler/interpreter-assembler.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/builtins-ia32.cc
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc
index 4156123f28f41d29a9ef398a84736a2d2aad61a4..66a6c614c02736f1ee3f6f4ec73b8ad8fd72e03a 100644
--- a/src/ia32/builtins-ia32.cc
+++ b/src/ia32/builtins-ia32.cc
@@ -724,6 +724,22 @@ void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
}
+static void Generate_InterpreterPushArgs(MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- ebx : Pointer to the last argument in the args array.
+ // -- ebx : Pointer to one before the first argument in the args array.
+ // -----------------------------------
+ Label loop_header, loop_check;
+ __ jmp(&loop_check);
+ __ bind(&loop_header);
+ __ Push(Operand(ebx, 0));
+ __ sub(ebx, Immediate(kPointerSize));
+ __ bind(&loop_check);
+ __ cmp(ebx, ecx);
+ __ j(greater, &loop_header, Label::kNear);
+}
+
+
// static
void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
// ----------- S t a t e -------------
@@ -732,6 +748,7 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
// 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).
+ // -----------------------------------
// Pop return address to allow tail-call after pushing arguments.
__ Pop(edx);
@@ -743,15 +760,7 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
__ neg(ecx);
__ add(ecx, ebx);
- // Push the arguments.
- Label loop_header, loop_check;
- __ jmp(&loop_check);
- __ bind(&loop_header);
- __ Push(Operand(ebx, 0));
- __ sub(ebx, Immediate(kPointerSize));
- __ bind(&loop_check);
- __ cmp(ebx, ecx);
- __ j(greater, &loop_header, Label::kNear);
+ Generate_InterpreterPushArgs(masm);
// Call the target.
__ Push(edx); // Re-push return address.
@@ -759,6 +768,44 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
}
+// static
+void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- eax : the number of arguments (not including the receiver)
+ // -- edx : the original constructor
+ // -- edi : the constructor
+ // -- 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.
+ // -----------------------------------
+
+ // Save number of arguments on the stack below where arguments are pushed.
rmcilroy 2015/10/15 10:30:55 nit - arguments are going to be pushed
oth 2015/10/15 11:16:43 Done.
+ __ mov(ecx, eax);
+ __ neg(ecx);
+ __ mov(Operand(esp, ecx, times_pointer_size, -kPointerSize), eax);
+
+ // Pop return address to allow tail-call after pushing arguments.
+ __ Pop(eax);
+
+ // Find the address of the last argument.
+ __ shl(ecx, kPointerSizeLog2);
+ __ add(ecx, ebx);
+
+ // Push required padding.
+ __ Push(Immediate(0));
+
+ Generate_InterpreterPushArgs(masm);
+
+ // Restore number of arguments from slot on stack.
+ __ xchg(eax, ecx);
rmcilroy 2015/10/15 10:30:55 optional nit - I think you could avoid the xchg if
oth 2015/10/15 11:16:43 Done. Also looked at stashing the stack address in
+ __ mov(eax, Operand(esp, -kPointerSize));
+
+ // Call the target.
+ __ Push(ecx); // Re-push return address.
+ __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
+}
+
+
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
CallRuntimePassFunction(masm, Runtime::kCompileLazy);
GenerateTailCallToReturnedCode(masm);
« no previous file with comments | « src/compiler/interpreter-assembler.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698