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

Unified Diff: src/ia32/lithium-codegen-ia32.cc

Issue 12613004: To fully support hydrogen code stubs which accept a variable number of arguments, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
index 7ce2f2d1256a86c9bcde861f3c0305338b51a27a..7ba98c0e88f4eceb3cd73fd5a9f31224ea1ee6be 100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -2736,18 +2736,43 @@ void LCodeGen::DoReturn(LReturn* instr) {
Label no_padding;
__ cmp(edx, Immediate(kNoAlignmentPadding));
__ j(equal, &no_padding);
- if (FLAG_debug_code) {
- __ cmp(Operand(esp, (GetParameterCount() + 2) * kPointerSize),
- Immediate(kAlignmentZapValue));
- __ Assert(equal, "expected alignment marker");
+
+ if (instr->has_constant_parameter_count()) {
+ if (FLAG_debug_code) {
danno 2013/03/07 15:11:14 Can't you combine this code path with the one belo
mvstanton 2013/03/07 16:48:49 Done.
+ __ cmp(Operand(esp,
+ (instr->constant_parameter_count() + 2) * kPointerSize),
+ Immediate(kAlignmentZapValue));
+ __ Assert(equal, "expected alignment marker");
+ }
+ __ Ret((instr->constant_parameter_count() + 2) * kPointerSize, ecx);
+ } else {
+ Register reg = ToRegister(instr->parameter_count());
+ Register temp_reg = reg.is(ecx) ? ebx : ecx;
+ if (FLAG_debug_code) {
+ __ cmp(Operand(esp, reg, times_pointer_size, 2 * kPointerSize),
+ Immediate(kAlignmentZapValue));
+ __ Assert(equal, "expected alignment marker");
+ }
+
+ // emit code to restore stack based on instr->parameter_count()
+ __ pop(temp_reg); // save return address
+ __ inc(reg); // 1 more for alignment
+ __ shl(reg, kPointerSizeLog2);
+ __ add(esp, reg);
+ __ jmp(temp_reg);
}
- __ Ret((GetParameterCount() + 2) * kPointerSize, ecx);
__ bind(&no_padding);
}
- if (info()->IsStub()) {
- __ Ret();
+
+ if (instr->has_constant_parameter_count()) {
danno 2013/03/07 15:11:14 if (instr->parameter_count()->IsConstantOperand())
mvstanton 2013/03/07 16:48:49 Done.
+ __ Ret((instr->constant_parameter_count() + 1) * kPointerSize, ecx);
danno 2013/03/07 15:11:14 int32_t parameter_count = ToInteger32(LConstantOpe
mvstanton 2013/03/07 16:48:49 Done.
} else {
- __ Ret((GetParameterCount() + 1) * kPointerSize, ecx);
+ Register reg = ToRegister(instr->parameter_count());
+ Register return_addr_reg = reg.is(ecx) ? ebx : ecx;
+ __ pop(return_addr_reg); // save return address
+ __ shl(reg, kPointerSizeLog2);
+ __ add(esp, reg);
+ __ jmp(return_addr_reg);
}
}

Powered by Google App Engine
This is Rietveld 408576698