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

Unified Diff: runtime/vm/ast.cc

Issue 10350003: Step toward eliminating increment nodes, starting with increment local. Fix a bug in evaluating sid… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | « runtime/vm/ast.h ('k') | runtime/vm/ast_printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast.cc
===================================================================
--- runtime/vm/ast.cc (revision 7298)
+++ runtime/vm/ast.cc (working copy)
@@ -298,19 +298,6 @@
}
-const char* IncrOpLocalNode::Name() const {
- switch (kind_) {
- case Token::kINCR:
- return prefix_ ? "local_pre_++" : "local_post_++";
- case Token::kDECR:
- return prefix_ ? "local_pre_--" : "local_post_--";
- default:
- UNREACHABLE();
- return NULL;
- }
-}
-
-
const char* IncrOpInstanceFieldNode::Name() const {
switch (kind_) {
case Token::kINCR:
@@ -346,6 +333,9 @@
if (local().is_final()) {
return NULL;
}
+ if (HasPseudo()) {
+ return NULL;
+ }
return new StoreLocalNode(token_index(), local(), rhs);
}
@@ -356,7 +346,17 @@
if (local().is_final()) {
return NULL;
}
- return new IncrOpLocalNode(token_index, kind, is_prefix, local());
+ if (is_prefix) {
+ const Instance& literal = Instance::ZoneHandle(Smi::New(1));
+ AstNode* lhs = this;
+ LiteralNode* rhs = new LiteralNode(token_index, literal);
+ Token::Kind binop_kind = (kind == Token::kINCR) ? Token::kADD : Token::kSUB;
+ BinaryOpNode* result = new BinaryOpNode(token_index, binop_kind, lhs, rhs);
+ StoreLocalNode* store = new StoreLocalNode(token_index, local(), result);
+ return store;
+ }
+ UNIMPLEMENTED();
+ return NULL;
}
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/ast_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698