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

Unified Diff: runtime/vm/ast_transformer.cc

Issue 1308163006: Reduce the number of captured variables in async code, by only capturing local (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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_transformer.cc
diff --git a/runtime/vm/ast_transformer.cc b/runtime/vm/ast_transformer.cc
index 11cb61cabb661db8f66a1726ff8b1e2bf130c74a..276c8d73dd081fb80f1d35c8abcec3ecff08400a 100644
--- a/runtime/vm/ast_transformer.cc
+++ b/runtime/vm/ast_transformer.cc
@@ -62,7 +62,7 @@ AstNode* AwaitTransformer::Transform(AstNode* expr) {
LocalVariable* AwaitTransformer::EnsureCurrentTempVar() {
- const char* await_temp_prefix = ":await_temp_var_";
+ const char* await_temp_prefix = Symbols::AwaitTempVarPrefix().ToCString();
hausner 2015/09/02 22:07:55 Does it make sense to define this string constant
regis 2015/09/03 01:28:03 Done.
srdjan 2015/09/03 01:50:47 This is problematic as it allocates a String in th
regis 2015/09/03 16:48:38 The previous version also allocates a new string,
const String& cnt_str = String::ZoneHandle(
Z, String::NewFormatted("%s%d", await_temp_prefix, temp_cnt_));
const String& symbol = String::ZoneHandle(Z, Symbols::New(cnt_str));
@@ -136,8 +136,8 @@ void AwaitTransformer::VisitAwaitNode(AwaitNode* node) {
AstNode* transformed_expr = Transform(node->expr());
LocalVariable* await_temp = AddToPreambleNewTempVar(transformed_expr);
- AwaitMarkerNode* await_marker = new (Z) AwaitMarkerNode();
- await_marker->set_scope(preamble_->scope());
+ AwaitMarkerNode* await_marker =
+ new (Z) AwaitMarkerNode(function_top_, node->scope());
preamble_->Add(await_marker);
// :result_param = _awaitHelper(

Powered by Google App Engine
This is Rietveld 408576698