Factor out some platform-independent code into the shared cfg.cc.

Review URL: http://codereview.chromium.org/165127

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2647 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 28511859
...@@ -100,19 +100,6 @@ void ExitNode::Compile(MacroAssembler* masm) { ...@@ -100,19 +100,6 @@ void ExitNode::Compile(MacroAssembler* masm) {
} }
void PositionInstr::Compile(MacroAssembler* masm) {
if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
__ RecordStatementPosition(pos_);
__ RecordPosition(pos_);
}
}
void MoveInstr::Compile(MacroAssembler* masm) {
location()->Move(masm, value());
}
void BinaryOpInstr::Compile(MacroAssembler* masm) { void BinaryOpInstr::Compile(MacroAssembler* masm) {
// The right-hand value should not be on the stack---if it is a // The right-hand value should not be on the stack---if it is a
// compiler-generated temporary it is in the accumulator. // compiler-generated temporary it is in the accumulator.
......
...@@ -230,6 +230,19 @@ void ReturnInstr::FastAllocate(TempLocation* temp) { ...@@ -230,6 +230,19 @@ void ReturnInstr::FastAllocate(TempLocation* temp) {
} }
void PositionInstr::Compile(MacroAssembler* masm) {
if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
masm->RecordStatementPosition(pos_);
masm->RecordPosition(pos_);
}
}
void MoveInstr::Compile(MacroAssembler* masm) {
location()->Move(masm, value());
}
// The expression builder should not be used for declarations or statements. // The expression builder should not be used for declarations or statements.
void ExpressionCfgBuilder::VisitDeclaration(Declaration* decl) { void ExpressionCfgBuilder::VisitDeclaration(Declaration* decl) {
UNREACHABLE(); UNREACHABLE();
......
...@@ -113,19 +113,6 @@ void ExitNode::Compile(MacroAssembler* masm) { ...@@ -113,19 +113,6 @@ void ExitNode::Compile(MacroAssembler* masm) {
} }
void PositionInstr::Compile(MacroAssembler* masm) {
if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
__ RecordStatementPosition(pos_);
__ RecordPosition(pos_);
}
}
void MoveInstr::Compile(MacroAssembler* masm) {
location()->Move(masm, value());
}
void BinaryOpInstr::Compile(MacroAssembler* masm) { void BinaryOpInstr::Compile(MacroAssembler* masm) {
// The right-hand value should not be on the stack---if it is a // The right-hand value should not be on the stack---if it is a
// compiler-generated temporary it is in the accumulator. // compiler-generated temporary it is in the accumulator.
...@@ -212,6 +199,7 @@ void SlotLocation::Move(MacroAssembler* masm, Value* value) { ...@@ -212,6 +199,7 @@ void SlotLocation::Move(MacroAssembler* masm, Value* value) {
value->MoveToSlot(masm, this); value->MoveToSlot(masm, this);
} }
void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) { void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
// The accumulator is not live across a MoveInstr. // The accumulator is not live across a MoveInstr.
__ mov(eax, ToOperand(this)); __ mov(eax, ToOperand(this));
......
...@@ -103,7 +103,6 @@ void EntryNode::Compile(MacroAssembler* masm) { ...@@ -103,7 +103,6 @@ void EntryNode::Compile(MacroAssembler* masm) {
void ExitNode::Compile(MacroAssembler* masm) { void ExitNode::Compile(MacroAssembler* masm) {
ASSERT(!is_marked()); ASSERT(!is_marked());
is_marked_ = true; is_marked_ = true;
Comment cmnt(masm, "[ ExitNode"); Comment cmnt(masm, "[ ExitNode");
if (FLAG_trace) { if (FLAG_trace) {
__ push(rax); __ push(rax);
...@@ -123,19 +122,6 @@ void ExitNode::Compile(MacroAssembler* masm) { ...@@ -123,19 +122,6 @@ void ExitNode::Compile(MacroAssembler* masm) {
} }
void PositionInstr::Compile(MacroAssembler* masm) {
if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
__ RecordStatementPosition(pos_);
__ RecordPosition(pos_);
}
}
void MoveInstr::Compile(MacroAssembler* masm) {
location()->Move(masm, value());
}
void BinaryOpInstr::Compile(MacroAssembler* masm) { void BinaryOpInstr::Compile(MacroAssembler* masm) {
// The right-hand value should not be on the stack---if it is a // The right-hand value should not be on the stack---if it is a
// compiler-generated temporary it is in the accumulator. // compiler-generated temporary it is in the accumulator.
...@@ -211,6 +197,11 @@ void SlotLocation::Set(MacroAssembler* masm, Register reg) { ...@@ -211,6 +197,11 @@ void SlotLocation::Set(MacroAssembler* masm, Register reg) {
} }
void SlotLocation::Push(MacroAssembler* masm) {
__ push(ToOperand(this));
}
void SlotLocation::Move(MacroAssembler* masm, Value* value) { void SlotLocation::Move(MacroAssembler* masm, Value* value) {
// We dispatch to the value because in some cases (temp or constant) we // We dispatch to the value because in some cases (temp or constant) we
// can use special instruction sequences. // can use special instruction sequences.
...@@ -224,11 +215,6 @@ void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) { ...@@ -224,11 +215,6 @@ void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
} }
void SlotLocation::Push(MacroAssembler* masm) {
__ push(ToOperand(this));
}
void TempLocation::Get(MacroAssembler* masm, Register reg) { void TempLocation::Get(MacroAssembler* masm, Register reg) {
switch (where_) { switch (where_) {
case ACCUMULATOR: case ACCUMULATOR:
......
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