Commit e8fe083e authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Introduce Push and Pop register macro instructions for all platforms

R=danno@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16051 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 274f2542
...@@ -144,6 +144,8 @@ class MacroAssembler: public Assembler { ...@@ -144,6 +144,8 @@ class MacroAssembler: public Assembler {
Condition cond = al); Condition cond = al);
void Call(Label* target); void Call(Label* target);
void Push(Register src) { push(src); }
void Pop(Register dst) { pop(dst); }
// Register move. May do nothing if the registers are identical. // Register move. May do nothing if the registers are identical.
void Move(Register dst, Handle<Object> value); void Move(Register dst, Handle<Object> value);
......
...@@ -512,7 +512,7 @@ void FullCodeGenerator::AccumulatorValueContext::Plug(Register reg) const { ...@@ -512,7 +512,7 @@ void FullCodeGenerator::AccumulatorValueContext::Plug(Register reg) const {
void FullCodeGenerator::StackValueContext::Plug(Register reg) const { void FullCodeGenerator::StackValueContext::Plug(Register reg) const {
__ push(reg); __ Push(reg);
} }
...@@ -530,7 +530,7 @@ void FullCodeGenerator::EffectContext::PlugTOS() const { ...@@ -530,7 +530,7 @@ void FullCodeGenerator::EffectContext::PlugTOS() const {
void FullCodeGenerator::AccumulatorValueContext::PlugTOS() const { void FullCodeGenerator::AccumulatorValueContext::PlugTOS() const {
__ pop(result_register()); __ Pop(result_register());
} }
...@@ -540,7 +540,7 @@ void FullCodeGenerator::StackValueContext::PlugTOS() const { ...@@ -540,7 +540,7 @@ void FullCodeGenerator::StackValueContext::PlugTOS() const {
void FullCodeGenerator::TestContext::PlugTOS() const { void FullCodeGenerator::TestContext::PlugTOS() const {
// For simplicity we always test the accumulator register. // For simplicity we always test the accumulator register.
__ pop(result_register()); __ Pop(result_register());
codegen()->PrepareForBailoutBeforeSplit(condition(), false, NULL, NULL); codegen()->PrepareForBailoutBeforeSplit(condition(), false, NULL, NULL);
codegen()->DoTest(this); codegen()->DoTest(this);
} }
...@@ -1006,7 +1006,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) { ...@@ -1006,7 +1006,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) {
VisitForAccumulatorValue(left); VisitForAccumulatorValue(left);
// We want the value in the accumulator for the test, and on the stack in // We want the value in the accumulator for the test, and on the stack in
// case we need it. // case we need it.
__ push(result_register()); __ Push(result_register());
Label discard, restore; Label discard, restore;
if (is_logical_and) { if (is_logical_and) {
DoTest(left, &discard, &restore, &restore); DoTest(left, &discard, &restore, &restore);
...@@ -1014,7 +1014,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) { ...@@ -1014,7 +1014,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) {
DoTest(left, &restore, &discard, &restore); DoTest(left, &restore, &discard, &restore);
} }
__ bind(&restore); __ bind(&restore);
__ pop(result_register()); __ Pop(result_register());
__ jmp(&done); __ jmp(&done);
__ bind(&discard); __ bind(&discard);
__ Drop(1); __ Drop(1);
...@@ -1024,7 +1024,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) { ...@@ -1024,7 +1024,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) {
VisitForAccumulatorValue(left); VisitForAccumulatorValue(left);
// We want the value in the accumulator for the test, and on the stack in // We want the value in the accumulator for the test, and on the stack in
// case we need it. // case we need it.
__ push(result_register()); __ Push(result_register());
Label discard; Label discard;
if (is_logical_and) { if (is_logical_and) {
DoTest(left, &discard, &done, &discard); DoTest(left, &discard, &done, &discard);
...@@ -1416,7 +1416,7 @@ void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { ...@@ -1416,7 +1416,7 @@ void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) {
// Extend the context before executing the catch block. // Extend the context before executing the catch block.
{ Comment cmnt(masm_, "[ Extend catch context"); { Comment cmnt(masm_, "[ Extend catch context");
__ Push(stmt->variable()->name()); __ Push(stmt->variable()->name());
__ push(result_register()); __ Push(result_register());
PushFunctionArgumentForContextAllocation(); PushFunctionArgumentForContextAllocation();
__ CallRuntime(Runtime::kPushCatchContext, 3); __ CallRuntime(Runtime::kPushCatchContext, 3);
StoreToFrameField(StandardFrameConstants::kContextOffset, StoreToFrameField(StandardFrameConstants::kContextOffset,
...@@ -1481,7 +1481,7 @@ void FullCodeGenerator::VisitTryFinallyStatement(TryFinallyStatement* stmt) { ...@@ -1481,7 +1481,7 @@ void FullCodeGenerator::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
// preserved by the finally block. Call the finally block and then // preserved by the finally block. Call the finally block and then
// rethrow the exception if it returns. // rethrow the exception if it returns.
__ Call(&finally_entry); __ Call(&finally_entry);
__ push(result_register()); __ Push(result_register());
__ CallRuntime(Runtime::kReThrow, 1); __ CallRuntime(Runtime::kReThrow, 1);
// Finally block implementation. // Finally block implementation.
......
...@@ -807,6 +807,8 @@ class MacroAssembler: public Assembler { ...@@ -807,6 +807,8 @@ class MacroAssembler: public Assembler {
void Drop(int element_count); void Drop(int element_count);
void Call(Label* target) { call(target); } void Call(Label* target) { call(target); }
void Push(Register src) { push(src); }
void Pop(Register dst) { pop(dst); }
// Emit call to the code we are currently generating. // Emit call to the code we are currently generating.
void CallSelf() { void CallSelf() {
......
...@@ -627,11 +627,11 @@ class MacroAssembler: public Assembler { ...@@ -627,11 +627,11 @@ class MacroAssembler: public Assembler {
void MultiPushFPU(RegList regs); void MultiPushFPU(RegList regs);
void MultiPushReversedFPU(RegList regs); void MultiPushReversedFPU(RegList regs);
// Lower case push() for compatibility with arch-independent code.
void push(Register src) { void push(Register src) {
Addu(sp, sp, Operand(-kPointerSize)); Addu(sp, sp, Operand(-kPointerSize));
sw(src, MemOperand(sp, 0)); sw(src, MemOperand(sp, 0));
} }
void Push(Register src) { push(src); }
// Push a handle. // Push a handle.
void Push(Handle<Object> handle); void Push(Handle<Object> handle);
...@@ -676,11 +676,11 @@ class MacroAssembler: public Assembler { ...@@ -676,11 +676,11 @@ class MacroAssembler: public Assembler {
void MultiPopFPU(RegList regs); void MultiPopFPU(RegList regs);
void MultiPopReversedFPU(RegList regs); void MultiPopReversedFPU(RegList regs);
// Lower case pop() for compatibility with arch-independent code.
void pop(Register dst) { void pop(Register dst) {
lw(dst, MemOperand(sp, 0)); lw(dst, MemOperand(sp, 0));
Addu(sp, sp, Operand(kPointerSize)); Addu(sp, sp, Operand(kPointerSize));
} }
void Pop(Register dst) { pop(dst); }
// Pop two registers. Pops rightmost register first (from lower address). // Pop two registers. Pops rightmost register first (from lower address).
void Pop(Register src1, Register src2) { void Pop(Register src1, Register src2) {
......
...@@ -823,6 +823,8 @@ class MacroAssembler: public Assembler { ...@@ -823,6 +823,8 @@ class MacroAssembler: public Assembler {
void Drop(int stack_elements); void Drop(int stack_elements);
void Call(Label* target) { call(target); } void Call(Label* target) { call(target); }
void Push(Register src) { push(src); }
void Pop(Register dst) { pop(dst); }
void PushReturnAddressFrom(Register src) { push(src); } void PushReturnAddressFrom(Register src) { push(src); }
void PopReturnAddressTo(Register dst) { pop(dst); } void PopReturnAddressTo(Register dst) { pop(dst); }
......
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