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

Unified Diff: runtime/vm/ast.cc

Issue 14942010: Eliminate temporary locals for some expressions (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: cleaned up Created 7 years, 7 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
Index: runtime/vm/ast.cc
===================================================================
--- runtime/vm/ast.cc (revision 23243)
+++ runtime/vm/ast.cc (working copy)
@@ -73,6 +73,31 @@
}
+LetNode::LetNode(intptr_t token_pos, intptr_t num_temps)
+ : AstNode(token_pos),
+ vars_(num_temps),
+ temp_expressions_(num_temps),
+ body_(NULL) {
+ for (intptr_t i = 0; i < num_temps; ++i) {
+ char name[64];
+ OS::SNPrint(name, 64, ":lt%"Pd"_%"Pd, token_pos, i);
hausner 2013/05/28 17:00:47 64 -> sizeof name For our own debugging purposes,
Florian Schneider 2013/05/30 09:29:31 Done.
+ vars_.Add(
+ new LocalVariable(token_pos,
+ String::ZoneHandle(Symbols::New(name)),
+ Type::ZoneHandle(Type::DynamicType())));
+ temp_expressions_.Add(NULL);
+ }
+}
+
+
+void LetNode::VisitChildren(AstNodeVisitor* visitor) const {
+ for (intptr_t i = 0; i < num_temps(); ++i) {
+ temp_expressions_[i]->Visit(visitor);
+ }
+ body_->Visit(visitor);
+}
+
+
void ArrayNode::VisitChildren(AstNodeVisitor* visitor) const {
for (intptr_t i = 0; i < this->length(); i++) {
ElementAt(i)->Visit(visitor);

Powered by Google App Engine
This is Rietveld 408576698