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

Side by Side Diff: runtime/vm/flow_graph_builder.cc

Issue 634603002: Await always waits (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/intermediate_language.h » ('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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 1086
1087 intptr_t current_context_level = owner()->context_level(); 1087 intptr_t current_context_level = owner()->context_level();
1088 ASSERT(current_context_level >= 0); 1088 ASSERT(current_context_level >= 0);
1089 if (owner()->parsed_function()->saved_entry_context_var() != NULL) { 1089 if (owner()->parsed_function()->saved_entry_context_var() != NULL) {
1090 // CTX on entry was saved, but not linked as context parent. 1090 // CTX on entry was saved, but not linked as context parent.
1091 BuildRestoreContext(*owner()->parsed_function()->saved_entry_context_var()); 1091 BuildRestoreContext(*owner()->parsed_function()->saved_entry_context_var());
1092 } else { 1092 } else {
1093 UnchainContexts(current_context_level); 1093 UnchainContexts(current_context_level);
1094 } 1094 }
1095 1095
1096 1096 if (function.is_async_closure() &&
1097 AddReturnExit(node->token_pos(), return_value); 1097 (node->return_type() == ReturnNode::kContinuation)) {
1098 // This return instruction may be followed by instructions
1099 // that get called when the async closure is resumed, so
1100 // do not add an exit and close the fragment.
1101 ReturnInstr* return_instr =
1102 new(I) ReturnInstr(node->token_pos(), return_value);
1103 AddInstruction(return_instr);
1104 } else {
1105 AddReturnExit(node->token_pos(), return_value);
1106 }
Florian Schneider 2014/10/06 17:32:54 I'd imagine this looking like this: AddReturnExit
1098 } 1107 }
1099 1108
1100 1109
1101 // <Expression> ::= Literal { literal: Instance } 1110 // <Expression> ::= Literal { literal: Instance }
1102 void EffectGraphVisitor::VisitLiteralNode(LiteralNode* node) { 1111 void EffectGraphVisitor::VisitLiteralNode(LiteralNode* node) {
1103 ReturnDefinition(new(I) ConstantInstr(node->literal())); 1112 ReturnDefinition(new(I) ConstantInstr(node->literal()));
1104 } 1113 }
1105 1114
1106 1115
1107 // Type nodes are used when a type is referenced as a literal. Type nodes 1116 // Type nodes are used when a type is referenced as a literal. Type nodes
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 ASSERT(jump_cnt == owner()->await_joins()->length()); 2241 ASSERT(jump_cnt == owner()->await_joins()->length());
2233 // Store the counter in :await_jump_var. 2242 // Store the counter in :await_jump_var.
2234 Value* jump_val = Bind(new (I) ConstantInstr( 2243 Value* jump_val = Bind(new (I) ConstantInstr(
2235 Smi::ZoneHandle(I, Smi::New(jump_cnt)))); 2244 Smi::ZoneHandle(I, Smi::New(jump_cnt))));
2236 Do(BuildStoreLocal(*jump_var, jump_val)); 2245 Do(BuildStoreLocal(*jump_var, jump_val));
2237 // Save the current context for resuming. 2246 // Save the current context for resuming.
2238 BuildSaveContext(*ctx_var); 2247 BuildSaveContext(*ctx_var);
2239 owner()->await_levels()->Add(owner()->context_level()); 2248 owner()->await_levels()->Add(owner()->context_level());
2240 return; 2249 return;
2241 } 2250 }
2242 if (node->marker_type() == AwaitMarkerNode::kTargetForContinuation) { 2251 if (node->marker_type() == AwaitMarkerNode::kTargetForContinuation) {
Florian Schneider 2014/10/06 17:32:55 This always follows immediatly after a continuatio
2243 // We need to create a new await target which involves: 2252 // We need to create a new await target which involves:
2244 // * Append a join that is also added to the list that will later result in 2253 // * Append a join that is also added to the list that will later result in
2245 // a preamble. 2254 // a preamble.
2246 JoinEntryInstr* const join = new(I) JoinEntryInstr( 2255 JoinEntryInstr* const join = new(I) JoinEntryInstr(
2247 owner()->AllocateBlockId(), owner()->try_index()); 2256 owner()->AllocateBlockId(), owner()->try_index());
2248 owner()->await_joins()->Add(join); 2257 owner()->await_joins()->Add(join);
Florian Schneider 2014/10/06 17:32:55 These targets should be added to the successors of
2249 Goto(join); 2258 Goto(join);
Florian Schneider 2014/10/06 17:32:54 Remove this Goto. It is dead code and should not b
2250 exit_ = join; 2259 exit_ = join;
2251 return; 2260 return;
2252 } 2261 }
2253 UNREACHABLE(); 2262 UNREACHABLE();
2254 } 2263 }
2255 2264
2256 2265
2257 intptr_t EffectGraphVisitor::GetCurrentTempLocalIndex() const { 2266 intptr_t EffectGraphVisitor::GetCurrentTempLocalIndex() const {
2258 return kFirstLocalSlotFromFp 2267 return kFirstLocalSlotFromFp
2259 - owner()->num_stack_locals() 2268 - owner()->num_stack_locals()
(...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after
4285 Report::MessageF(Report::kBailout, 4294 Report::MessageF(Report::kBailout,
4286 Script::Handle(function.script()), 4295 Script::Handle(function.script()),
4287 function.token_pos(), 4296 function.token_pos(),
4288 "FlowGraphBuilder Bailout: %s %s", 4297 "FlowGraphBuilder Bailout: %s %s",
4289 String::Handle(function.name()).ToCString(), 4298 String::Handle(function.name()).ToCString(),
4290 reason); 4299 reason);
4291 UNREACHABLE(); 4300 UNREACHABLE();
4292 } 4301 }
4293 4302
4294 } // namespace dart 4303 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698