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

Unified Diff: src/arm/cfg-arm.cc

Issue 165056: Add support for (some) assignment expressions to the CFG builder and... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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
« no previous file with comments | « no previous file | src/cfg.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/cfg-arm.cc
===================================================================
--- src/arm/cfg-arm.cc (revision 2635)
+++ src/arm/cfg-arm.cc (working copy)
@@ -108,26 +108,31 @@
}
+void MoveInstr::Compile(MacroAssembler* masm) {
+ location()->Move(masm, value());
+}
+
+
void BinaryOpInstr::Compile(MacroAssembler* masm) {
// The right-hand value should not be on the stack---if it is a
// compiler-generated temporary it is in the accumulator.
- ASSERT(!val1_->is_on_stack());
+ ASSERT(!value1()->is_on_stack());
Comment cmnt(masm, "[ BinaryOpInstr");
// We can overwrite one of the operands if it is a temporary.
OverwriteMode mode = NO_OVERWRITE;
- if (val0_->is_temporary()) {
+ if (value0()->is_temporary()) {
mode = OVERWRITE_LEFT;
- } else if (val1_->is_temporary()) {
+ } else if (value1()->is_temporary()) {
mode = OVERWRITE_RIGHT;
}
// Move left to r1 and right to r0.
- val0_->Get(masm, r1);
- val1_->Get(masm, r0);
- GenericBinaryOpStub stub(op_, mode);
+ value0()->Get(masm, r1);
+ value1()->Get(masm, r0);
+ GenericBinaryOpStub stub(op(), mode);
__ CallStub(&stub);
- loc_->Set(masm, r0);
+ location()->Set(masm, r0);
}
@@ -167,6 +172,12 @@
}
+void Constant::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
+ __ mov(ip, Operand(handle_));
+ __ str(ip, ToMemOperand(loc));
+}
+
+
void SlotLocation::Get(MacroAssembler* masm, Register reg) {
__ ldr(reg, ToMemOperand(this));
}
@@ -183,6 +194,18 @@
}
+void SlotLocation::Move(MacroAssembler* masm, Value* value) {
+ // Double dispatch.
+ value->MoveToSlot(masm, this);
+}
+
+
+void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
+ __ ldr(ip, ToMemOperand(this));
+ __ str(ip, ToMemOperand(loc));
+}
+
+
void TempLocation::Get(MacroAssembler* masm, Register reg) {
switch (where_) {
case ACCUMULATOR:
@@ -191,9 +214,8 @@
case STACK:
__ pop(reg);
break;
- case NOWHERE:
+ case NOT_ALLOCATED:
UNREACHABLE();
- break;
}
}
@@ -206,9 +228,8 @@
case STACK:
__ push(reg);
break;
- case NOWHERE:
+ case NOT_ALLOCATED:
UNREACHABLE();
- break;
}
}
@@ -219,13 +240,38 @@
__ push(r0);
break;
case STACK:
- case NOWHERE:
+ case NOT_ALLOCATED:
UNREACHABLE();
+ }
+}
+
+
+void TempLocation::Move(MacroAssembler* masm, Value* value) {
+ switch (where_) {
+ case ACCUMULATOR:
+ value->Get(masm, r0);
+ case STACK:
+ value->Push(masm);
break;
+ case NOT_ALLOCATED:
+ UNREACHABLE();
}
}
+void TempLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
+ switch (where_) {
+ case ACCUMULATOR:
+ __ str(r0, ToMemOperand(loc));
+ case STACK:
+ __ pop(ip);
+ __ str(ip, ToMemOperand(loc));
+ break;
+ case NOT_ALLOCATED:
+ UNREACHABLE();
+ }
+}
+
#undef __
} } // namespace v8::internal
« no previous file with comments | « no previous file | src/cfg.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698