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

Unified Diff: src/fast-codegen.cc

Issue 338043: Make it more pleasant to work with expression locations in the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 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 | « src/fast-codegen.h ('k') | src/ia32/fast-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « src/fast-codegen.h ('k') | src/ia32/fast-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698