Index: src/fast-codegen.cc |
=================================================================== |
--- src/fast-codegen.cc (revision 3140) |
+++ src/fast-codegen.cc (working copy) |
@@ -53,6 +53,7 @@ |
int FastCodeGenerator::SlotOffset(Slot* slot) { |
+ ASSERT(slot != NULL); |
// Offset is negative because higher indexes are at lower addresses. |
int offset = -slot->index() * kPointerSize; |
// Adjust by a (parameter or local) base offset. |
@@ -70,6 +71,48 @@ |
} |
+void FastCodeGenerator::Move(Location destination, Location source) { |
+ switch (destination.type()) { |
+ case Location::NOWHERE: |
+ break; |
+ |
+ case Location::TEMP: |
+ switch (source.type()) { |
+ case Location::NOWHERE: |
+ UNREACHABLE(); |
+ case Location::TEMP: |
+ break; |
+ } |
+ break; |
+ } |
+} |
+ |
+ |
+// All platform macro assemblers in {ia32,x64,arm} have a push(Register) |
+// function. |
+void FastCodeGenerator::Move(Location destination, Register source) { |
+ switch (destination.type()) { |
+ case Location::NOWHERE: |
+ break; |
+ case Location::TEMP: |
+ masm_->push(source); |
+ break; |
+ } |
+} |
+ |
+ |
+// All platform macro assemblers in {ia32,x64,arm} have a pop(Register) |
+// function. |
+void FastCodeGenerator::Move(Register destination, Location source) { |
+ switch (source.type()) { |
+ case Location::NOWHERE: |
+ UNREACHABLE(); |
+ case Location::TEMP: |
+ masm_->pop(destination); |
+ } |
+} |
+ |
+ |
void FastCodeGenerator::VisitDeclarations( |
ZoneList<Declaration*>* declarations) { |
int length = declarations->length(); |
@@ -191,6 +234,20 @@ |
} |
+void FastCodeGenerator::VisitBlock(Block* stmt) { |
+ Comment cmnt(masm_, "[ Block"); |
+ SetStatementPosition(stmt); |
+ VisitStatements(stmt->statements()); |
+} |
+ |
+ |
+void FastCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) { |
+ Comment cmnt(masm_, "[ ExpressionStatement"); |
+ SetStatementPosition(stmt); |
+ Visit(stmt->expression()); |
+} |
+ |
+ |
void FastCodeGenerator::VisitEmptyStatement(EmptyStatement* stmt) { |
Comment cmnt(masm_, "[ EmptyStatement"); |
SetStatementPosition(stmt); |
@@ -279,6 +336,11 @@ |
} |
+void FastCodeGenerator::VisitLiteral(Literal* expr) { |
+ Move(expr->location(), expr); |
+} |
+ |
+ |
void FastCodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* expr) { |
UNREACHABLE(); |
} |