Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1254 for_index.value(), | 1254 for_index.value(), |
| 1255 for_value.value()); | 1255 for_value.value()); |
| 1256 ReturnComputation(store); | 1256 ReturnComputation(store); |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 | 1259 |
| 1260 // <Statement> ::= Sequence { scope: LocalScope | 1260 // <Statement> ::= Sequence { scope: LocalScope |
| 1261 // nodes: <Statement>* | 1261 // nodes: <Statement>* |
| 1262 // label: SourceLabel } | 1262 // label: SourceLabel } |
| 1263 void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) { | 1263 void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) { |
| 1264 LocalScope* scope = node->scope(); | |
| 1265 const intptr_t num_context_variables = | |
| 1266 (scope != NULL) ? scope->num_context_variables() : 0; | |
| 1267 int previous_context_level = owner()->context_level(); | |
| 1268 if (num_context_variables > 0) { | |
| 1269 // The loop local scope declares variables that are captured. | |
| 1270 // Allocate and chain a new context. | |
| 1271 // Allocate context computation | |
|
regis
2012/03/15 23:39:07
period
srdjan
2012/03/15 23:45:41
Done.
| |
| 1272 // Chain Context computation (maybe introduce a new variable). | |
| 1273 Bailout("Sequence needs a context. Gotta have a context."); | |
| 1274 } | |
| 1275 | |
| 1264 if (FLAG_enable_type_checks && | 1276 if (FLAG_enable_type_checks && |
| 1265 (node == owner()->parsed_function().node_sequence())) { | 1277 (node == owner()->parsed_function().node_sequence())) { |
| 1266 Bailout("VisitSequenceNode GenerateArgumentTypeChecks()"); | 1278 Bailout("VisitSequenceNode GenerateArgumentTypeChecks()"); |
| 1267 } | 1279 } |
| 1268 if ((node->scope() != NULL) && | 1280 |
| 1269 (node->scope()->num_context_variables() != 0)) { | |
| 1270 Bailout("Sequence needs a context. Gotta have a context."); | |
| 1271 } | |
| 1272 intptr_t i = 0; | 1281 intptr_t i = 0; |
| 1273 while (is_open() && (i < node->length())) { | 1282 while (is_open() && (i < node->length())) { |
| 1274 EffectGraphVisitor for_effect(owner(), temp_index()); | 1283 EffectGraphVisitor for_effect(owner(), temp_index()); |
| 1275 node->NodeAt(i++)->Visit(&for_effect); | 1284 node->NodeAt(i++)->Visit(&for_effect); |
| 1276 Append(for_effect); | 1285 Append(for_effect); |
| 1277 } | 1286 } |
| 1287 owner()->set_context_level(previous_context_level); | |
| 1278 } | 1288 } |
| 1279 | 1289 |
| 1280 | 1290 |
| 1281 void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { | 1291 void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { |
| 1282 Bailout("EffectGraphVisitor::VisitCatchClauseNode"); | 1292 Bailout("EffectGraphVisitor::VisitCatchClauseNode"); |
| 1283 } | 1293 } |
| 1284 | 1294 |
| 1285 | 1295 |
| 1286 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { | 1296 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { |
| 1287 Bailout("EffectGraphVisitor::VisitTryCatchNode"); | 1297 Bailout("EffectGraphVisitor::VisitTryCatchNode"); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1674 char* chars = reinterpret_cast<char*>( | 1684 char* chars = reinterpret_cast<char*>( |
| 1675 Isolate::Current()->current_zone()->Allocate(len)); | 1685 Isolate::Current()->current_zone()->Allocate(len)); |
| 1676 OS::SNPrint(chars, len, kFormat, function_name, reason); | 1686 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 1677 const Error& error = Error::Handle( | 1687 const Error& error = Error::Handle( |
| 1678 LanguageError::New(String::Handle(String::New(chars)))); | 1688 LanguageError::New(String::Handle(String::New(chars)))); |
| 1679 Isolate::Current()->long_jump_base()->Jump(1, error); | 1689 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 1680 } | 1690 } |
| 1681 | 1691 |
| 1682 | 1692 |
| 1683 } // namespace dart | 1693 } // namespace dart |
| OLD | NEW |