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
This commit is contained in:
haitao.feng@intel.com 2013-08-05 12:43:04 +00:00
parent 274f254236
commit e8fe083eb0
5 changed files with 16 additions and 10 deletions

View File

@ -144,6 +144,8 @@ class MacroAssembler: public Assembler {
Condition cond = al);
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.
void Move(Register dst, Handle<Object> value);

View File

@ -512,7 +512,7 @@ void FullCodeGenerator::AccumulatorValueContext::Plug(Register reg) const {
void FullCodeGenerator::StackValueContext::Plug(Register reg) const {
__ push(reg);
__ Push(reg);
}
@ -530,7 +530,7 @@ void FullCodeGenerator::EffectContext::PlugTOS() const {
void FullCodeGenerator::AccumulatorValueContext::PlugTOS() const {
__ pop(result_register());
__ Pop(result_register());
}
@ -540,7 +540,7 @@ void FullCodeGenerator::StackValueContext::PlugTOS() const {
void FullCodeGenerator::TestContext::PlugTOS() const {
// For simplicity we always test the accumulator register.
__ pop(result_register());
__ Pop(result_register());
codegen()->PrepareForBailoutBeforeSplit(condition(), false, NULL, NULL);
codegen()->DoTest(this);
}
@ -1006,7 +1006,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) {
VisitForAccumulatorValue(left);
// We want the value in the accumulator for the test, and on the stack in
// case we need it.
__ push(result_register());
__ Push(result_register());
Label discard, restore;
if (is_logical_and) {
DoTest(left, &discard, &restore, &restore);
@ -1014,7 +1014,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) {
DoTest(left, &restore, &discard, &restore);
}
__ bind(&restore);
__ pop(result_register());
__ Pop(result_register());
__ jmp(&done);
__ bind(&discard);
__ Drop(1);
@ -1024,7 +1024,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) {
VisitForAccumulatorValue(left);
// We want the value in the accumulator for the test, and on the stack in
// case we need it.
__ push(result_register());
__ Push(result_register());
Label discard;
if (is_logical_and) {
DoTest(left, &discard, &done, &discard);
@ -1416,7 +1416,7 @@ void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) {
// Extend the context before executing the catch block.
{ Comment cmnt(masm_, "[ Extend catch context");
__ Push(stmt->variable()->name());
__ push(result_register());
__ Push(result_register());
PushFunctionArgumentForContextAllocation();
__ CallRuntime(Runtime::kPushCatchContext, 3);
StoreToFrameField(StandardFrameConstants::kContextOffset,
@ -1481,7 +1481,7 @@ void FullCodeGenerator::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
// preserved by the finally block. Call the finally block and then
// rethrow the exception if it returns.
__ Call(&finally_entry);
__ push(result_register());
__ Push(result_register());
__ CallRuntime(Runtime::kReThrow, 1);
// Finally block implementation.

View File

@ -807,6 +807,8 @@ class MacroAssembler: public Assembler {
void Drop(int element_count);
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.
void CallSelf() {

View File

@ -627,11 +627,11 @@ class MacroAssembler: public Assembler {
void MultiPushFPU(RegList regs);
void MultiPushReversedFPU(RegList regs);
// Lower case push() for compatibility with arch-independent code.
void push(Register src) {
Addu(sp, sp, Operand(-kPointerSize));
sw(src, MemOperand(sp, 0));
}
void Push(Register src) { push(src); }
// Push a handle.
void Push(Handle<Object> handle);
@ -676,11 +676,11 @@ class MacroAssembler: public Assembler {
void MultiPopFPU(RegList regs);
void MultiPopReversedFPU(RegList regs);
// Lower case pop() for compatibility with arch-independent code.
void pop(Register dst) {
lw(dst, MemOperand(sp, 0));
Addu(sp, sp, Operand(kPointerSize));
}
void Pop(Register dst) { pop(dst); }
// Pop two registers. Pops rightmost register first (from lower address).
void Pop(Register src1, Register src2) {

View File

@ -823,6 +823,8 @@ class MacroAssembler: public Assembler {
void Drop(int stack_elements);
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 PopReturnAddressTo(Register dst) { pop(dst); }