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

Unified Diff: runtime/vm/kernel_to_il.cc

Issue 2803853004: Reland: VM [KERNEL] Avoid emitting :expr_temp and capturing :iterator (Closed)
Patch Set: VM [KERNEL] Avoid emitting :expr_temp and capturing :iterator Created 3 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/kernel_to_il.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_to_il.cc
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
index 21b5ce83223ed25cef1657803ba3a8a7ff21a27c..69a12bb21c1c3b234b0ce0ed0d92df62637c4704 100644
--- a/runtime/vm/kernel_to_il.cc
+++ b/runtime/vm/kernel_to_il.cc
@@ -101,6 +101,9 @@ void ScopeBuilder::AddParameter(VariableDeclaration* declaration,
if (declaration->IsFinal()) {
variable->set_is_final();
}
+ if (variable->name().raw() == Symbols::IteratorParameter().raw()) {
+ variable->set_is_forced_stack();
+ }
scope_->InsertParameterAt(pos, variable);
result_->locals.Insert(declaration->kernel_offset(), variable);
@@ -303,7 +306,6 @@ ScopeBuildingResult* ScopeBuilder::BuildScopes() {
LocalVariable* context_var = parsed_function->current_context_var();
context_var->set_is_forced_stack();
scope_->AddVariable(context_var);
- scope_->AddVariable(parsed_function->EnsureExpressionTemp());
parsed_function->SetNodeSequence(
new SequenceNode(TokenPosition::kNoSource, scope_));
@@ -443,7 +445,9 @@ ScopeBuildingResult* ScopeBuilder::BuildScopes() {
case RawFunction::kIrregexpFunction:
UNREACHABLE();
}
-
+ if (needs_expr_temp_) {
+ scope_->AddVariable(parsed_function_->EnsureExpressionTemp());
+ }
parsed_function->AllocateVariables();
return result_;
@@ -485,6 +489,18 @@ void ScopeBuilder::VisitVariableSet(VariableSet* node) {
}
+void ScopeBuilder::VisitConditionalExpression(ConditionalExpression* node) {
+ needs_expr_temp_ = true;
+ node->VisitChildren(this);
+}
+
+
+void ScopeBuilder::VisitLogicalExpression(LogicalExpression* node) {
+ needs_expr_temp_ = true;
+ node->VisitChildren(this);
+}
+
+
void ScopeBuilder::HandleLocalFunction(TreeNode* parent,
FunctionNode* function) {
LocalScope* saved_function_scope = current_function_scope_;
« no previous file with comments | « runtime/vm/kernel_to_il.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698