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

Side by Side Diff: runtime/vm/flow_graph_builder.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: address comments 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/ast_transformer.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 void EffectGraphVisitor::VisitAwaitNode(AwaitNode* node) { 2324 void EffectGraphVisitor::VisitAwaitNode(AwaitNode* node) {
2325 // Await nodes are temporary during parsing. 2325 // Await nodes are temporary during parsing.
2326 UNREACHABLE(); 2326 UNREACHABLE();
2327 } 2327 }
2328 2328
2329 2329
2330 void EffectGraphVisitor::VisitAwaitMarkerNode(AwaitMarkerNode* node) { 2330 void EffectGraphVisitor::VisitAwaitMarkerNode(AwaitMarkerNode* node) {
2331 // We need to create a new await state which involves: 2331 // We need to create a new await state which involves:
2332 // * Increase the jump counter. Sanity check against the list of targets. 2332 // * Increase the jump counter. Sanity check against the list of targets.
2333 // * Save the current context for resuming. 2333 // * Save the current context for resuming.
2334 ASSERT(node->scope() != NULL); 2334 ASSERT(node->async_scope() != NULL);
2335 LocalVariable* jump_var = node->scope()->LookupVariable( 2335 ASSERT(node->await_scope() != NULL);
2336 LocalVariable* jump_var = node->async_scope()->LookupVariable(
2336 Symbols::AwaitJumpVar(), false); 2337 Symbols::AwaitJumpVar(), false);
2337 LocalVariable* ctx_var = node->scope()->LookupVariable( 2338 LocalVariable* ctx_var = node->async_scope()->LookupVariable(
2338 Symbols::AwaitContextVar(), false); 2339 Symbols::AwaitContextVar(), false);
2339 ASSERT((jump_var != NULL) && jump_var->is_captured()); 2340 ASSERT((jump_var != NULL) && jump_var->is_captured());
2340 ASSERT((ctx_var != NULL) && ctx_var->is_captured()); 2341 ASSERT((ctx_var != NULL) && ctx_var->is_captured());
2341 const intptr_t jump_count = owner()->next_await_counter(); 2342 const intptr_t jump_count = owner()->next_await_counter();
2342 ASSERT(jump_count >= 0); 2343 ASSERT(jump_count >= 0);
2343 // Sanity check that we always add a JoinEntryInstr before adding a new 2344 // Sanity check that we always add a JoinEntryInstr before adding a new
2344 // state. 2345 // state.
2345 ASSERT(jump_count == owner()->await_joins()->length()); 2346 ASSERT(jump_count == owner()->await_joins()->length());
2346 // Store the counter in :await_jump_var. 2347 // Store the counter in :await_jump_var.
2347 Value* jump_val = Bind(new(Z) ConstantInstr( 2348 Value* jump_val = Bind(new(Z) ConstantInstr(
(...skipping 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after
4675 Report::MessageF(Report::kBailout, 4676 Report::MessageF(Report::kBailout,
4676 Script::Handle(function.script()), 4677 Script::Handle(function.script()),
4677 function.token_pos(), 4678 function.token_pos(),
4678 "FlowGraphBuilder Bailout: %s %s", 4679 "FlowGraphBuilder Bailout: %s %s",
4679 String::Handle(function.name()).ToCString(), 4680 String::Handle(function.name()).ToCString(),
4680 reason); 4681 reason);
4681 UNREACHABLE(); 4682 UNREACHABLE();
4682 } 4683 }
4683 4684
4684 } // namespace dart 4685 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/ast_transformer.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698