MIPS: To fully support hydrogen code stubs which accept a variable number of...

MIPS: To fully support hydrogen code stubs which accept a variable number of arguments, the HReturn/LReturn instruction needs to be able to determine argument count from a stack evaluation rather than as a constant from scope.

Port r13888 (33905114)

BUG=

Review URL: https://codereview.chromium.org/12414011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13910 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f2bcc90c
...@@ -2558,11 +2558,20 @@ void LCodeGen::DoReturn(LReturn* instr) { ...@@ -2558,11 +2558,20 @@ void LCodeGen::DoReturn(LReturn* instr) {
} }
} }
if (NeedsEagerFrame()) { if (NeedsEagerFrame()) {
int32_t sp_delta = (GetParameterCount() + 1) * kPointerSize;
__ mov(sp, fp); __ mov(sp, fp);
__ Pop(ra, fp); __ Pop(ra, fp);
if (!info()->IsStub()) {
__ Addu(sp, sp, Operand(sp_delta)); if (instr->has_constant_parameter_count()) {
int parameter_count = ToInteger32(instr->constant_parameter_count());
int32_t sp_delta = (parameter_count + 1) * kPointerSize;
if (sp_delta != 0) {
__ Addu(sp, sp, Operand(sp_delta));
}
} else {
Register reg = ToRegister(instr->parameter_count());
__ Addu(reg, reg, Operand(1));
__ sll(at, reg, kPointerSizeLog2);
__ Addu(sp, sp, at);
} }
} }
__ Jump(ra); __ Jump(ra);
......
...@@ -201,7 +201,6 @@ class LCodeGen BASE_EMBEDDED { ...@@ -201,7 +201,6 @@ class LCodeGen BASE_EMBEDDED {
Register temporary2); Register temporary2);
int GetStackSlotCount() const { return chunk()->spill_slot_count(); } int GetStackSlotCount() const { return chunk()->spill_slot_count(); }
int GetParameterCount() const { return info()->num_parameters(); }
void Abort(const char* reason); void Abort(const char* reason);
void Comment(const char* format, ...); void Comment(const char* format, ...);
......
...@@ -1804,7 +1804,9 @@ LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { ...@@ -1804,7 +1804,9 @@ LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
return new(zone()) LReturn(UseFixed(instr->value(), v0)); LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
return new(zone()) LReturn(UseFixed(instr->value(), v0),
parameter_count);
} }
......
...@@ -1343,14 +1343,24 @@ class LArithmeticT: public LTemplateInstruction<1, 2, 0> { ...@@ -1343,14 +1343,24 @@ class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
}; };
class LReturn: public LTemplateInstruction<0, 1, 0> { class LReturn: public LTemplateInstruction<0, 2, 0> {
public: public:
explicit LReturn(LOperand* value) { explicit LReturn(LOperand* value, LOperand* parameter_count) {
inputs_[0] = value; inputs_[0] = value;
inputs_[1] = parameter_count;
} }
LOperand* value() { return inputs_[0]; } LOperand* value() { return inputs_[0]; }
bool has_constant_parameter_count() {
return parameter_count()->IsConstantOperand();
}
LConstantOperand* constant_parameter_count() {
ASSERT(has_constant_parameter_count());
return LConstantOperand::cast(parameter_count());
}
LOperand* parameter_count() { return inputs_[1]; }
DECLARE_CONCRETE_INSTRUCTION(Return, "return") DECLARE_CONCRETE_INSTRUCTION(Return, "return")
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment