Commit 4e4169d5 authored by plind44@gmail.com's avatar plind44@gmail.com

MIPS: Try to use Push instead of push sequences whenever possible.

Port r17466 (e519285)

BUG=
R=plind44@gmail.com

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

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17507 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4539c6ba
...@@ -301,17 +301,12 @@ static void CallRuntimePassFunction(MacroAssembler* masm, ...@@ -301,17 +301,12 @@ static void CallRuntimePassFunction(MacroAssembler* masm,
Runtime::FunctionId function_id) { Runtime::FunctionId function_id) {
FrameScope scope(masm, StackFrame::INTERNAL); FrameScope scope(masm, StackFrame::INTERNAL);
// Push a copy of the function onto the stack. // Push a copy of the function onto the stack.
__ push(a1); // Push call kind information and function as parameter to the runtime call.
// Push call kind information. __ Push(a1, t1, a1);
__ push(t1);
// Function is also the parameter to the runtime call.
__ push(a1);
__ CallRuntime(function_id, 1); __ CallRuntime(function_id, 1);
// Restore call kind information. // Restore call kind information and receiver.
__ pop(t1); __ Pop(a1, t1);
// Restore receiver.
__ pop(a1);
} }
...@@ -421,14 +416,11 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, ...@@ -421,14 +416,11 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ sb(t0, constructor_count); __ sb(t0, constructor_count);
__ Branch(&allocate, ne, t0, Operand(zero_reg)); __ Branch(&allocate, ne, t0, Operand(zero_reg));
__ Push(a1, a2); __ Push(a1, a2, a1); // a1 = Constructor.
__ push(a1); // Constructor.
// The call will replace the stub, so the countdown is only done once. // The call will replace the stub, so the countdown is only done once.
__ CallRuntime(Runtime::kFinalizeInstanceSize, 1); __ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
__ pop(a2); __ Pop(a1, a2);
__ pop(a1);
__ bind(&allocate); __ bind(&allocate);
} }
...@@ -1245,8 +1237,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { ...@@ -1245,8 +1237,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
// Out of stack space. // Out of stack space.
__ lw(a1, MemOperand(fp, kFunctionOffset)); __ lw(a1, MemOperand(fp, kFunctionOffset));
__ push(a1); __ Push(a1, v0);
__ push(v0);
__ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION); __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION);
// End of stack check. // End of stack check.
...@@ -1327,8 +1318,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { ...@@ -1327,8 +1318,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
// a0: current argument index // a0: current argument index
__ bind(&loop); __ bind(&loop);
__ lw(a1, MemOperand(fp, kArgsOffset)); __ lw(a1, MemOperand(fp, kArgsOffset));
__ push(a1); __ Push(a1, a0);
__ push(a0);
// Call the runtime to access the property in the arguments array. // Call the runtime to access the property in the arguments array.
__ CallRuntime(Runtime::kGetProperty, 2); __ CallRuntime(Runtime::kGetProperty, 2);
......
...@@ -5156,8 +5156,7 @@ void ICCompareStub::GenerateMiss(MacroAssembler* masm) { ...@@ -5156,8 +5156,7 @@ void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
ExternalReference(IC_Utility(IC::kCompareIC_Miss), masm->isolate()); ExternalReference(IC_Utility(IC::kCompareIC_Miss), masm->isolate());
FrameScope scope(masm, StackFrame::INTERNAL); FrameScope scope(masm, StackFrame::INTERNAL);
__ Push(a1, a0); __ Push(a1, a0);
__ push(ra); __ Push(ra, a1, a0);
__ Push(a1, a0);
__ li(t0, Operand(Smi::FromInt(op_))); __ li(t0, Operand(Smi::FromInt(op_)));
__ addiu(sp, sp, -kPointerSize); __ addiu(sp, sp, -kPointerSize);
__ CallExternalReference(miss, 3, USE_DELAY_SLOT); __ CallExternalReference(miss, 3, USE_DELAY_SLOT);
......
...@@ -631,12 +631,11 @@ void FullCodeGenerator::StackValueContext::Plug( ...@@ -631,12 +631,11 @@ void FullCodeGenerator::StackValueContext::Plug(
Label done; Label done;
__ bind(materialize_true); __ bind(materialize_true);
__ LoadRoot(at, Heap::kTrueValueRootIndex); __ LoadRoot(at, Heap::kTrueValueRootIndex);
__ push(at);
__ Branch(&done); __ Branch(&done);
__ bind(materialize_false); __ bind(materialize_false);
__ LoadRoot(at, Heap::kFalseValueRootIndex); __ LoadRoot(at, Heap::kFalseValueRootIndex);
__ push(at);
__ bind(&done); __ bind(&done);
__ push(at);
} }
...@@ -1617,9 +1616,8 @@ void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { ...@@ -1617,9 +1616,8 @@ void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
__ jmp(&allocated); __ jmp(&allocated);
__ bind(&runtime_allocate); __ bind(&runtime_allocate);
__ push(t1);
__ li(a0, Operand(Smi::FromInt(size))); __ li(a0, Operand(Smi::FromInt(size)));
__ push(a0); __ Push(t1, a0);
__ CallRuntime(Runtime::kAllocateInNewSpace, 1); __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
__ pop(t1); __ pop(t1);
...@@ -2060,8 +2058,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { ...@@ -2060,8 +2058,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos()));
__ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw" __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw"
__ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter
__ push(a3); // iter __ Push(a3, a0); // iter, exception
__ push(a0); // exception
__ jmp(&l_call); __ jmp(&l_call);
// try { received = %yield result } // try { received = %yield result }
...@@ -2099,8 +2096,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { ...@@ -2099,8 +2096,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
__ bind(&l_next); __ bind(&l_next);
__ LoadRoot(a2, Heap::knext_stringRootIndex); // "next" __ LoadRoot(a2, Heap::knext_stringRootIndex); // "next"
__ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter
__ push(a3); // iter __ Push(a3, a0); // iter, received
__ push(a0); // received
// result = receiver[f](arg); // result = receiver[f](arg);
__ bind(&l_call); __ bind(&l_call);
...@@ -2176,11 +2172,13 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator, ...@@ -2176,11 +2172,13 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
__ Call(&resume_frame); __ Call(&resume_frame);
__ jmp(&done); __ jmp(&done);
__ bind(&resume_frame); __ bind(&resume_frame);
__ push(ra); // Return address. // ra = return address.
__ push(fp); // Caller's frame pointer. // fp = caller's frame pointer.
__ mov(fp, sp); // cp = callee's context,
__ push(cp); // Callee's context. // t0 = callee's JS function.
__ push(t0); // Callee's JS Function. __ Push(ra, fp, cp, t0);
// Adjust FP to point to saved FP.
__ Addu(fp, sp, 2 * kPointerSize);
// Load the operand stack size. // Load the operand stack size.
__ lw(a3, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); __ lw(a3, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset));
...@@ -2211,8 +2209,8 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator, ...@@ -2211,8 +2209,8 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
__ push(a2); __ push(a2);
__ Branch(&push_operand_holes); __ Branch(&push_operand_holes);
__ bind(&call_resume); __ bind(&call_resume);
__ push(a1); ASSERT(!result_register().is(a1));
__ push(result_register()); __ Push(a1, result_register());
__ Push(Smi::FromInt(resume_mode)); __ Push(Smi::FromInt(resume_mode));
__ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3);
// Not reached: the runtime call returns elsewhere. // Not reached: the runtime call returns elsewhere.
...@@ -2442,8 +2440,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { ...@@ -2442,8 +2440,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
VisitForStackValue(prop->obj()); VisitForStackValue(prop->obj());
VisitForAccumulatorValue(prop->key()); VisitForAccumulatorValue(prop->key());
__ mov(a1, result_register()); __ mov(a1, result_register());
__ pop(a2); __ Pop(a0, a2); // a0 = restored value.
__ pop(a0); // Restore value.
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize() ? isolate()->builtins()->KeyedStoreIC_Initialize()
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
...@@ -2585,8 +2582,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { ...@@ -2585,8 +2582,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
// - a1 is the key, // - a1 is the key,
// - a2 is the receiver. // - a2 is the receiver.
__ mov(a0, result_register()); __ mov(a0, result_register());
__ pop(a1); // Key. __ Pop(a2, a1); // a1 = key.
__ pop(a2);
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize() ? isolate()->builtins()->KeyedStoreIC_Initialize()
...@@ -2714,27 +2710,25 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { ...@@ -2714,27 +2710,25 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) {
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
// Push copy of the first argument or undefined if it doesn't exist. // t2: copy of the first argument or undefined if it doesn't exist.
if (arg_count > 0) { if (arg_count > 0) {
__ lw(a1, MemOperand(sp, arg_count * kPointerSize)); __ lw(t2, MemOperand(sp, arg_count * kPointerSize));
} else { } else {
__ LoadRoot(a1, Heap::kUndefinedValueRootIndex); __ LoadRoot(t2, Heap::kUndefinedValueRootIndex);
} }
__ push(a1);
// Push the receiver of the enclosing function. // t1: the receiver of the enclosing function.
int receiver_offset = 2 + info_->scope()->num_parameters(); int receiver_offset = 2 + info_->scope()->num_parameters();
__ lw(a1, MemOperand(fp, receiver_offset * kPointerSize)); __ lw(t1, MemOperand(fp, receiver_offset * kPointerSize));
__ push(a1);
// Push the language mode. // t0: the language mode.
__ li(a1, Operand(Smi::FromInt(language_mode()))); __ li(t0, Operand(Smi::FromInt(language_mode())));
__ push(a1);
// Push the start position of the scope the calls resides in. // a1: the start position of the scope the calls resides in.
__ li(a1, Operand(Smi::FromInt(scope()->start_position()))); __ li(a1, Operand(Smi::FromInt(scope()->start_position())));
__ push(a1);
// Do the runtime call. // Do the runtime call.
__ Push(t2, t1, t0, a1);
__ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5);
} }
...@@ -2807,9 +2801,9 @@ void FullCodeGenerator::VisitCall(Call* expr) { ...@@ -2807,9 +2801,9 @@ void FullCodeGenerator::VisitCall(Call* expr) {
__ bind(&slow); __ bind(&slow);
// Call the runtime to find the function to call (returned in v0) // Call the runtime to find the function to call (returned in v0)
// and the object holding it (returned in v1). // and the object holding it (returned in v1).
__ push(context_register()); ASSERT(!context_register().is(a2));
__ li(a2, Operand(proxy->name())); __ li(a2, Operand(proxy->name()));
__ push(a2); __ Push(context_register(), a2);
__ CallRuntime(Runtime::kLoadContextSlot, 2); __ CallRuntime(Runtime::kLoadContextSlot, 2);
__ Push(v0, v1); // Function, receiver. __ Push(v0, v1); // Function, receiver.
...@@ -3521,8 +3515,7 @@ void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { ...@@ -3521,8 +3515,7 @@ void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
VisitForStackValue(args->at(1)); // index VisitForStackValue(args->at(1)); // index
VisitForStackValue(args->at(2)); // value VisitForStackValue(args->at(2)); // value
__ pop(value); __ Pop(index, value);
__ pop(index);
VisitForAccumulatorValue(args->at(0)); // string VisitForAccumulatorValue(args->at(0)); // string
if (FLAG_debug_code) { if (FLAG_debug_code) {
...@@ -3551,8 +3544,7 @@ void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { ...@@ -3551,8 +3544,7 @@ void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) {
VisitForStackValue(args->at(1)); // index VisitForStackValue(args->at(1)); // index
VisitForStackValue(args->at(2)); // value VisitForStackValue(args->at(2)); // value
__ pop(value); __ Pop(index, value);
__ pop(index);
VisitForAccumulatorValue(args->at(0)); // string VisitForAccumulatorValue(args->at(0)); // string
if (FLAG_debug_code) { if (FLAG_debug_code) {
...@@ -4313,9 +4305,9 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { ...@@ -4313,9 +4305,9 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
} else { } else {
// Non-global variable. Call the runtime to try to delete from the // Non-global variable. Call the runtime to try to delete from the
// context where the variable was introduced. // context where the variable was introduced.
__ push(context_register()); ASSERT(!context_register().is(a2));
__ li(a2, Operand(var->name())); __ li(a2, Operand(var->name()));
__ push(a2); __ Push(context_register(), a2);
__ CallRuntime(Runtime::kDeleteContextSlot, 2); __ CallRuntime(Runtime::kDeleteContextSlot, 2);
context()->Plug(v0); context()->Plug(v0);
} }
...@@ -4547,8 +4539,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4547,8 +4539,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
} }
case KEYED_PROPERTY: { case KEYED_PROPERTY: {
__ mov(a0, result_register()); // Value. __ mov(a0, result_register()); // Value.
__ pop(a1); // Key. __ Pop(a2, a1); // a1 = key, a2 = receiver.
__ pop(a2); // Receiver.
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize() ? isolate()->builtins()->KeyedStoreIC_Initialize()
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
......
...@@ -578,8 +578,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { ...@@ -578,8 +578,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
__ IncrementCounter(counters->keyed_call_generic_slow_load(), 1, a0, a3); __ IncrementCounter(counters->keyed_call_generic_slow_load(), 1, a0, a3);
{ {
FrameScope scope(masm, StackFrame::INTERNAL); FrameScope scope(masm, StackFrame::INTERNAL);
__ push(a2); // Save the key. __ Push(a2, a1, a2); // Save the key and pass the receiver and the key.
__ Push(a1, a2); // Pass the receiver and the key.
__ CallRuntime(Runtime::kKeyedGetProperty, 2); __ CallRuntime(Runtime::kKeyedGetProperty, 2);
__ pop(a2); // Restore the key. __ pop(a2); // Restore the key.
} }
......
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