| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 const AbstractType& type = | 159 const AbstractType& type = |
| 160 AbstractType::ZoneHandle( | 160 AbstractType::ZoneHandle( |
| 161 owner()->parsed_function().function().result_type()); | 161 owner()->parsed_function().function().result_type()); |
| 162 AssertAssignableComp* assert = | 162 AssertAssignableComp* assert = |
| 163 new AssertAssignableComp(return_value, type); | 163 new AssertAssignableComp(return_value, type); |
| 164 AddInstruction(new BindInstr(temp_index(), assert)); | 164 AddInstruction(new BindInstr(temp_index(), assert)); |
| 165 return_value = new TempVal(temp_index()); | 165 return_value = new TempVal(temp_index()); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 intptr_t current_context_level = owner()->context_level(); |
| 170 ASSERT(current_context_level >= 0); |
| 171 if (owner()->parsed_function().saved_context_var() != NULL) { |
| 172 // CTX on entry was saved, but not linked as context parent. |
| 173 LoadLocalComp* load_comp = |
| 174 new LoadLocalComp(*owner()->parsed_function().saved_context_var(), 0); |
| 175 AddInstruction(new BindInstr(temp_index(), load_comp)); |
| 176 TempVal* local_value = new TempVal(temp_index()); |
| 177 StoreContextComp* store_context = new StoreContextComp(local_value); |
| 178 AddInstruction(new DoInstr(store_context)); |
| 179 } else { |
| 180 while (current_context_level-- > 0) { |
| 181 UnchainContext(); |
| 182 } |
| 183 } |
| 184 |
| 185 |
| 169 AddInstruction(new ReturnInstr(return_value, node->token_index())); | 186 AddInstruction(new ReturnInstr(return_value, node->token_index())); |
| 170 CloseFragment(); | 187 CloseFragment(); |
| 171 } | 188 } |
| 172 | 189 |
| 173 | 190 |
| 174 // <Expression> ::= Literal { literal: Instance } | 191 // <Expression> ::= Literal { literal: Instance } |
| 175 void EffectGraphVisitor::VisitLiteralNode(LiteralNode* node) { | 192 void EffectGraphVisitor::VisitLiteralNode(LiteralNode* node) { |
| 176 return; | 193 return; |
| 177 } | 194 } |
| 178 | 195 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 ReturnComputation(call); | 397 ReturnComputation(call); |
| 381 } | 398 } |
| 382 | 399 |
| 383 | 400 |
| 384 void EffectGraphVisitor::VisitIncrOpLocalNode(IncrOpLocalNode* node) { | 401 void EffectGraphVisitor::VisitIncrOpLocalNode(IncrOpLocalNode* node) { |
| 385 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); | 402 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); |
| 386 // In an effect context, treat postincrement as if it were preincrement | 403 // In an effect context, treat postincrement as if it were preincrement |
| 387 // because its value is not needed. | 404 // because its value is not needed. |
| 388 | 405 |
| 389 // 1. Load the value. | 406 // 1. Load the value. |
| 390 LoadLocalComp* load = new LoadLocalComp(node->local()); | 407 LoadLocalComp* load = new LoadLocalComp(node->local(), |
| 408 owner()->context_level()); |
| 391 AddInstruction(new BindInstr(temp_index(), load)); | 409 AddInstruction(new BindInstr(temp_index(), load)); |
| 392 // 2. Increment. | 410 // 2. Increment. |
| 393 BuildIncrOpIncrement(node->kind(), node->id(), node->token_index(), | 411 BuildIncrOpIncrement(node->kind(), node->id(), node->token_index(), |
| 394 temp_index() + 1); | 412 temp_index() + 1); |
| 395 // 3. Perform the store, resulting in the new value. | 413 // 3. Perform the store, resulting in the new value. |
| 396 StoreLocalComp* store = | 414 StoreLocalComp* store = new StoreLocalComp( |
| 397 new StoreLocalComp(node->local(), new TempVal(temp_index())); | 415 node->local(), new TempVal(temp_index()), owner()->context_level()); |
| 398 ReturnComputation(store); | 416 ReturnComputation(store); |
| 399 } | 417 } |
| 400 | 418 |
| 401 | 419 |
| 402 void ValueGraphVisitor::VisitIncrOpLocalNode(IncrOpLocalNode* node) { | 420 void ValueGraphVisitor::VisitIncrOpLocalNode(IncrOpLocalNode* node) { |
| 403 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); | 421 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); |
| 404 if (node->prefix()) { | 422 if (node->prefix()) { |
| 405 // Base class handles preincrement. | 423 // Base class handles preincrement. |
| 406 EffectGraphVisitor::VisitIncrOpLocalNode(node); | 424 EffectGraphVisitor::VisitIncrOpLocalNode(node); |
| 407 return; | 425 return; |
| 408 } | 426 } |
| 409 // For postincrement, duplicate the original value to use one copy as the | 427 // For postincrement, duplicate the original value to use one copy as the |
| 410 // result. | 428 // result. |
| 411 // | 429 // |
| 412 // 1. Load the value. | 430 // 1. Load the value. |
| 413 LoadLocalComp* load = new LoadLocalComp(node->local()); | 431 LoadLocalComp* load = new LoadLocalComp(node->local(), |
| 432 owner()->context_level()); |
| 414 AddInstruction(new BindInstr(temp_index(), load)); | 433 AddInstruction(new BindInstr(temp_index(), load)); |
| 415 // 2. Duplicate it to increment. | 434 // 2. Duplicate it to increment. |
| 416 AddInstruction(new PickTempInstr(temp_index() + 1, temp_index())); | 435 AddInstruction(new PickTempInstr(temp_index() + 1, temp_index())); |
| 417 // 3. Increment. | 436 // 3. Increment. |
| 418 BuildIncrOpIncrement(node->kind(), node->id(), node->token_index(), | 437 BuildIncrOpIncrement(node->kind(), node->id(), node->token_index(), |
| 419 temp_index() + 2); | 438 temp_index() + 2); |
| 420 // 4. Perform the store and return the original value. | 439 // 4. Perform the store and return the original value. |
| 421 StoreLocalComp* store = | 440 StoreLocalComp* store = new StoreLocalComp( |
| 422 new StoreLocalComp(node->local(), new TempVal(temp_index() + 1)); | 441 node->local(), new TempVal(temp_index() + 1), owner()->context_level()); |
| 423 AddInstruction(new DoInstr(store)); | 442 AddInstruction(new DoInstr(store)); |
| 424 ReturnValue(new TempVal(AllocateTempIndex())); | 443 ReturnValue(new TempVal(AllocateTempIndex())); |
| 425 } | 444 } |
| 426 | 445 |
| 427 | 446 |
| 428 int EffectGraphVisitor::BuildIncrOpFieldLoad(IncrOpInstanceFieldNode* node, | 447 int EffectGraphVisitor::BuildIncrOpFieldLoad(IncrOpInstanceFieldNode* node, |
| 429 intptr_t start_index) { | 448 intptr_t start_index) { |
| 430 // Evaluate the receiver and duplicate it (it has two uses). | 449 // Evaluate the receiver and duplicate it (it has two uses). |
| 431 // t_n <- ... receiver ... | 450 // t_n <- ... receiver ... |
| 432 // t_n+1 <- Pick(t_n) | 451 // t_n+1 <- Pick(t_n) |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 CreateArrayComp* create = new CreateArrayComp(node, values); | 812 CreateArrayComp* create = new CreateArrayComp(node, values); |
| 794 ReturnComputation(create); | 813 ReturnComputation(create); |
| 795 } | 814 } |
| 796 | 815 |
| 797 | 816 |
| 798 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { | 817 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { |
| 799 const Function& function = node->function(); | 818 const Function& function = node->function(); |
| 800 | 819 |
| 801 int next_index = temp_index(); | 820 int next_index = temp_index(); |
| 802 if (function.IsNonImplicitClosureFunction()) { | 821 if (function.IsNonImplicitClosureFunction()) { |
| 803 const int context_level = 0; // Only because we don't handle nesting yet. | |
| 804 const ContextScope& context_scope = ContextScope::ZoneHandle( | 822 const ContextScope& context_scope = ContextScope::ZoneHandle( |
| 805 node->scope()->PreserveOuterScope(context_level)); | 823 node->scope()->PreserveOuterScope(owner()->context_level())); |
| 806 ASSERT(!function.HasCode()); | 824 ASSERT(!function.HasCode()); |
| 807 ASSERT(function.context_scope() == ContextScope::null()); | 825 ASSERT(function.context_scope() == ContextScope::null()); |
| 808 function.set_context_scope(context_scope); | 826 function.set_context_scope(context_scope); |
| 809 } else if (function.IsImplicitInstanceClosureFunction()) { | 827 } else if (function.IsImplicitInstanceClosureFunction()) { |
| 810 ValueGraphVisitor for_receiver(owner(), temp_index()); | 828 ValueGraphVisitor for_receiver(owner(), temp_index()); |
| 811 node->receiver()->Visit(&for_receiver); | 829 node->receiver()->Visit(&for_receiver); |
| 812 Append(for_receiver); | 830 Append(for_receiver); |
| 813 if (!for_receiver.value()->IsTemp()) { | 831 if (!for_receiver.value()->IsTemp()) { |
| 814 AddInstruction(new BindInstr(temp_index(), for_receiver.value())); | 832 AddInstruction(new BindInstr(temp_index(), for_receiver.value())); |
| 815 } | 833 } |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 void EffectGraphVisitor::VisitPrimaryNode(PrimaryNode* node) { | 1167 void EffectGraphVisitor::VisitPrimaryNode(PrimaryNode* node) { |
| 1150 Bailout("EffectGraphVisitor::VisitPrimaryNode"); | 1168 Bailout("EffectGraphVisitor::VisitPrimaryNode"); |
| 1151 } | 1169 } |
| 1152 | 1170 |
| 1153 | 1171 |
| 1154 // <Expression> ::= LoadLocal { local: LocalVariable } | 1172 // <Expression> ::= LoadLocal { local: LocalVariable } |
| 1155 void EffectGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { | 1173 void EffectGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { |
| 1156 return; | 1174 return; |
| 1157 } | 1175 } |
| 1158 | 1176 |
| 1177 |
| 1159 void ValueGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { | 1178 void ValueGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { |
| 1160 LoadLocalComp* load = new LoadLocalComp(node->local()); | 1179 LoadLocalComp* load = new LoadLocalComp(node->local(), |
| 1180 owner()->context_level()); |
| 1161 ReturnComputation(load); | 1181 ReturnComputation(load); |
| 1162 } | 1182 } |
| 1163 | 1183 |
| 1184 |
| 1164 void TestGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { | 1185 void TestGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { |
| 1165 LoadLocalComp* load = new LoadLocalComp(node->local()); | 1186 LoadLocalComp* load = new LoadLocalComp(node->local(), |
| 1187 owner()->context_level()); |
| 1166 ReturnComputation(load); | 1188 ReturnComputation(load); |
| 1167 } | 1189 } |
| 1168 | 1190 |
| 1169 | 1191 |
| 1170 // <Expression> ::= StoreLocal { local: LocalVariable | 1192 // <Expression> ::= StoreLocal { local: LocalVariable |
| 1171 // value: <Expression> } | 1193 // value: <Expression> } |
| 1172 void EffectGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) { | 1194 void EffectGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) { |
| 1173 ValueGraphVisitor for_value(owner(), temp_index()); | 1195 ValueGraphVisitor for_value(owner(), temp_index()); |
| 1174 node->value()->Visit(&for_value); | 1196 node->value()->Visit(&for_value); |
| 1175 Append(for_value); | 1197 Append(for_value); |
| 1176 | 1198 |
| 1177 Value* value = for_value.value(); | 1199 Value* value = for_value.value(); |
| 1178 if (FLAG_enable_type_checks) { | 1200 if (FLAG_enable_type_checks) { |
| 1179 AssertAssignableComp* assert = | 1201 AssertAssignableComp* assert = |
| 1180 new AssertAssignableComp(value, node->local().type()); | 1202 new AssertAssignableComp(value, node->local().type()); |
| 1181 AddInstruction(new BindInstr(temp_index(), assert)); | 1203 AddInstruction(new BindInstr(temp_index(), assert)); |
| 1182 value = new TempVal(temp_index()); | 1204 value = new TempVal(temp_index()); |
| 1183 } | 1205 } |
| 1184 | 1206 |
| 1185 StoreLocalComp* store = new StoreLocalComp(node->local(), value); | 1207 StoreLocalComp* store = |
| 1208 new StoreLocalComp(node->local(), value, owner()->context_level()); |
| 1186 ReturnComputation(store); | 1209 ReturnComputation(store); |
| 1187 } | 1210 } |
| 1188 | 1211 |
| 1189 | 1212 |
| 1190 void EffectGraphVisitor::VisitLoadInstanceFieldNode( | 1213 void EffectGraphVisitor::VisitLoadInstanceFieldNode( |
| 1191 LoadInstanceFieldNode* node) { | 1214 LoadInstanceFieldNode* node) { |
| 1192 ValueGraphVisitor for_instance(owner(), temp_index()); | 1215 ValueGraphVisitor for_instance(owner(), temp_index()); |
| 1193 node->instance()->Visit(&for_instance); | 1216 node->instance()->Visit(&for_instance); |
| 1194 Append(for_instance); | 1217 Append(for_instance); |
| 1195 LoadInstanceFieldComp* load = | 1218 LoadInstanceFieldComp* load = |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 Append(for_value); | 1296 Append(for_value); |
| 1274 StoreIndexedComp* store = new StoreIndexedComp(node->id(), | 1297 StoreIndexedComp* store = new StoreIndexedComp(node->id(), |
| 1275 node->token_index(), | 1298 node->token_index(), |
| 1276 for_array.value(), | 1299 for_array.value(), |
| 1277 for_index.value(), | 1300 for_index.value(), |
| 1278 for_value.value()); | 1301 for_value.value()); |
| 1279 ReturnComputation(store); | 1302 ReturnComputation(store); |
| 1280 } | 1303 } |
| 1281 | 1304 |
| 1282 | 1305 |
| 1306 bool EffectGraphVisitor::MustSaveRestoreContext(SequenceNode* node) const { |
| 1307 return (node == owner()->parsed_function().node_sequence()) && |
| 1308 (owner()->parsed_function().saved_context_var() != NULL); |
| 1309 } |
| 1310 |
| 1311 |
| 1312 void EffectGraphVisitor::UnchainContext() { |
| 1313 AddInstruction(new BindInstr(temp_index(), new CurrentContextComp())); |
| 1314 TempVal* temp_ctx = new TempVal(temp_index()); |
| 1315 NativeLoadFieldComp* load = new NativeLoadFieldComp( |
| 1316 temp_ctx, Context::parent_offset()); |
| 1317 AddInstruction(new BindInstr(temp_index(), load)); |
| 1318 TempVal* parent_ctx = new TempVal(temp_index()); |
| 1319 AddInstruction(new DoInstr(new StoreContextComp(parent_ctx))); |
| 1320 } |
| 1321 |
| 1322 |
| 1283 // <Statement> ::= Sequence { scope: LocalScope | 1323 // <Statement> ::= Sequence { scope: LocalScope |
| 1284 // nodes: <Statement>* | 1324 // nodes: <Statement>* |
| 1285 // label: SourceLabel } | 1325 // label: SourceLabel } |
| 1286 void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) { | 1326 void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) { |
| 1287 LocalScope* scope = node->scope(); | 1327 LocalScope* scope = node->scope(); |
| 1288 const intptr_t num_context_variables = | 1328 const intptr_t num_context_variables = |
| 1289 (scope != NULL) ? scope->num_context_variables() : 0; | 1329 (scope != NULL) ? scope->num_context_variables() : 0; |
| 1290 int previous_context_level = owner()->context_level(); | 1330 int previous_context_level = owner()->context_level(); |
| 1291 if (num_context_variables > 0) { | 1331 if (num_context_variables > 0) { |
| 1292 // The loop local scope declares variables that are captured. | 1332 // The loop local scope declares variables that are captured. |
| 1293 // Allocate and chain a new context. | 1333 // Allocate and chain a new context. |
| 1294 // Allocate context computation. | 1334 // Allocate context computation (uses current CTX) |
| 1295 // Chain Context computation (maybe introduce a new variable). | 1335 AllocateContextComp* comp = new AllocateContextComp(node->token_index(), |
| 1296 Bailout("Sequence needs a context. Gotta have a context."); | 1336 num_context_variables); |
| 1337 AddInstruction(new BindInstr(temp_index(), comp)); |
| 1338 Value* allocated_context_value = new TempVal(temp_index()); |
| 1339 |
| 1340 // If this node_sequence is the body of the function being compiled, and if |
| 1341 // this function is not a closure, do not link the current context as the |
| 1342 // parent of the newly allocated context, as it is not accessible. Instead, |
| 1343 // save it in a pre-allocated variable and restore it on exit. |
| 1344 if (MustSaveRestoreContext(node)) { |
| 1345 AddInstruction(new BindInstr(temp_index() + 1, new CurrentContextComp())); |
| 1346 StoreLocalComp* store_local = new StoreLocalComp( |
| 1347 *owner()->parsed_function().saved_context_var(), |
| 1348 new TempVal(temp_index() + 1), |
| 1349 0); |
| 1350 AddInstruction(new DoInstr(store_local)); |
| 1351 StoreContextComp* store_context = |
| 1352 new StoreContextComp(new ConstantVal(Object::ZoneHandle())); |
| 1353 AddInstruction(new DoInstr(store_context)); |
| 1354 } |
| 1355 |
| 1356 ChainContextComp* chain_context = new ChainContextComp( |
| 1357 allocated_context_value); |
| 1358 AddInstruction(new DoInstr(chain_context)); |
| 1359 owner()->set_context_level(scope->context_level()); |
| 1360 |
| 1361 // If this node_sequence is the body of the function being compiled, copy |
| 1362 // the captured parameters from the frame into the context. |
| 1363 if (node == owner()->parsed_function().node_sequence()) { |
| 1364 ASSERT(scope->context_level() == 1); |
| 1365 const Immediate raw_null = |
| 1366 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1367 const Function& function = owner()->parsed_function().function(); |
| 1368 const int num_params = function.NumberOfParameters(); |
| 1369 int param_frame_index = |
| 1370 (num_params == function.num_fixed_parameters()) ? 1 + num_params : -1; |
| 1371 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { |
| 1372 const LocalVariable& parameter = *scope->VariableAt(pos); |
| 1373 ASSERT(parameter.owner() == scope); |
| 1374 if (parameter.is_captured()) { |
| 1375 // Create a temporary local describing the original position. |
| 1376 const String& temp_name = String::ZoneHandle(String::Concat( |
| 1377 parameter.name(), String::Handle(String::NewSymbol("-orig")))); |
| 1378 LocalVariable* temp_local = new LocalVariable( |
| 1379 0, // Token index. |
| 1380 temp_name, |
| 1381 Type::ZoneHandle(Type::DynamicType())); // Type. |
| 1382 temp_local->set_index(param_frame_index); |
| 1383 |
| 1384 // Copy parameter from local frame to current context. |
| 1385 LoadLocalComp* load_comp = new LoadLocalComp( |
| 1386 *temp_local, owner()->context_level()); |
| 1387 AddInstruction(new BindInstr(temp_index(), load_comp)); |
| 1388 StoreLocalComp* store_local = new StoreLocalComp( |
| 1389 parameter, |
| 1390 new TempVal(temp_index()), |
| 1391 owner()->context_level()); |
| 1392 AddInstruction(new DoInstr(store_local)); |
| 1393 // Write NULL to the source location to detect buggy accesses and |
| 1394 // allow GC of passed value if it gets overwritten by a new value in |
| 1395 // the function. |
| 1396 StoreLocalComp* clear_local = new StoreLocalComp( |
| 1397 *temp_local, |
| 1398 new ConstantVal(Object::ZoneHandle()), |
| 1399 owner()->context_level()); |
| 1400 AddInstruction(new DoInstr(clear_local)); |
| 1401 } |
| 1402 } |
| 1403 } |
| 1297 } | 1404 } |
| 1298 | 1405 |
| 1299 if (FLAG_enable_type_checks && | 1406 if (FLAG_enable_type_checks && |
| 1300 (node == owner()->parsed_function().node_sequence())) { | 1407 (node == owner()->parsed_function().node_sequence())) { |
| 1301 Bailout("VisitSequenceNode GenerateArgumentTypeChecks()"); | 1408 Bailout("VisitSequenceNode GenerateArgumentTypeChecks()"); |
| 1302 } | 1409 } |
| 1303 | 1410 |
| 1304 intptr_t i = 0; | 1411 intptr_t i = 0; |
| 1305 while (is_open() && (i < node->length())) { | 1412 while (is_open() && (i < node->length())) { |
| 1306 EffectGraphVisitor for_effect(owner(), temp_index()); | 1413 EffectGraphVisitor for_effect(owner(), temp_index()); |
| 1307 node->NodeAt(i++)->Visit(&for_effect); | 1414 node->NodeAt(i++)->Visit(&for_effect); |
| 1308 Append(for_effect); | 1415 Append(for_effect); |
| 1309 } | 1416 } |
| 1417 |
| 1418 if (is_open()) { |
| 1419 if (MustSaveRestoreContext(node)) { |
| 1420 ASSERT(num_context_variables > 0); |
| 1421 LoadLocalComp* load_comp = |
| 1422 new LoadLocalComp(*owner()->parsed_function().saved_context_var(), 0); |
| 1423 AddInstruction(new BindInstr(temp_index(), load_comp)); |
| 1424 TempVal* local_value = new TempVal(temp_index()); |
| 1425 StoreContextComp* store_context = new StoreContextComp(local_value); |
| 1426 AddInstruction(new DoInstr(store_context)); |
| 1427 } else if (num_context_variables > 0) { |
| 1428 UnchainContext(); |
| 1429 } |
| 1430 } |
| 1431 |
| 1432 // If this node sequence is labeled, a break out of the sequence will have |
| 1433 // taken care of unchaining the context. |
| 1434 if (node->label() != NULL) { |
| 1435 // TODO(srdjan): Check that the break label is bound? Is this a jump? |
| 1436 Bailout("VisitSequenceNode bind break and unchain CTX"); |
| 1437 } |
| 1310 owner()->set_context_level(previous_context_level); | 1438 owner()->set_context_level(previous_context_level); |
| 1311 } | 1439 } |
| 1312 | 1440 |
| 1313 | 1441 |
| 1314 void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { | 1442 void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { |
| 1315 Bailout("EffectGraphVisitor::VisitCatchClauseNode"); | 1443 Bailout("EffectGraphVisitor::VisitCatchClauseNode"); |
| 1316 } | 1444 } |
| 1317 | 1445 |
| 1318 | 1446 |
| 1319 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { | 1447 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 String::Handle(comp->function().name()).ToCString()); | 1595 String::Handle(comp->function().name()).ToCString()); |
| 1468 for (intptr_t i = 0; i < comp->ArgumentCount(); ++i) { | 1596 for (intptr_t i = 0; i < comp->ArgumentCount(); ++i) { |
| 1469 OS::Print(", "); | 1597 OS::Print(", "); |
| 1470 comp->ArgumentAt(i)->Accept(this); | 1598 comp->ArgumentAt(i)->Accept(this); |
| 1471 } | 1599 } |
| 1472 OS::Print(")"); | 1600 OS::Print(")"); |
| 1473 } | 1601 } |
| 1474 | 1602 |
| 1475 | 1603 |
| 1476 void FlowGraphPrinter::VisitLoadLocal(LoadLocalComp* comp) { | 1604 void FlowGraphPrinter::VisitLoadLocal(LoadLocalComp* comp) { |
| 1477 OS::Print("LoadLocal(%s)", comp->local().name().ToCString()); | 1605 OS::Print("LoadLocal(%s lvl:%d)", |
| 1606 comp->local().name().ToCString(), comp->context_level()); |
| 1478 } | 1607 } |
| 1479 | 1608 |
| 1480 | 1609 |
| 1481 void FlowGraphPrinter::VisitStoreLocal(StoreLocalComp* comp) { | 1610 void FlowGraphPrinter::VisitStoreLocal(StoreLocalComp* comp) { |
| 1482 OS::Print("StoreLocal(%s, ", comp->local().name().ToCString()); | 1611 OS::Print("StoreLocal(%s, ", comp->local().name().ToCString()); |
| 1483 comp->value()->Accept(this); | 1612 comp->value()->Accept(this); |
| 1484 OS::Print(")"); | 1613 OS::Print(", lvl: %d)", comp->context_level()); |
| 1485 } | 1614 } |
| 1486 | 1615 |
| 1487 | 1616 |
| 1488 void FlowGraphPrinter::VisitNativeCall(NativeCallComp* comp) { | 1617 void FlowGraphPrinter::VisitNativeCall(NativeCallComp* comp) { |
| 1489 OS::Print("NativeCall(%s)", comp->native_name().ToCString()); | 1618 OS::Print("NativeCall(%s)", comp->native_name().ToCString()); |
| 1490 } | 1619 } |
| 1491 | 1620 |
| 1492 | 1621 |
| 1493 void FlowGraphPrinter::VisitLoadInstanceField(LoadInstanceFieldComp* comp) { | 1622 void FlowGraphPrinter::VisitLoadInstanceField(LoadInstanceFieldComp* comp) { |
| 1494 OS::Print("LoadInstanceField(%s, ", | 1623 OS::Print("LoadInstanceField(%s, ", |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 void FlowGraphPrinter::VisitExtractConstructorInstantiator( | 1744 void FlowGraphPrinter::VisitExtractConstructorInstantiator( |
| 1616 ExtractConstructorInstantiatorComp* comp) { | 1745 ExtractConstructorInstantiatorComp* comp) { |
| 1617 OS::Print("ExtractConstructorInstantiator("); | 1746 OS::Print("ExtractConstructorInstantiator("); |
| 1618 comp->instantiator()->Accept(this); | 1747 comp->instantiator()->Accept(this); |
| 1619 OS::Print(", "); | 1748 OS::Print(", "); |
| 1620 comp->discard_value()->Accept(this); | 1749 comp->discard_value()->Accept(this); |
| 1621 OS::Print(")"); | 1750 OS::Print(")"); |
| 1622 } | 1751 } |
| 1623 | 1752 |
| 1624 | 1753 |
| 1754 void FlowGraphPrinter::VisitAllocateContext(AllocateContextComp* comp) { |
| 1755 OS::Print("AllocateContext(%d)", comp->num_context_variables()); |
| 1756 } |
| 1757 |
| 1758 |
| 1759 void FlowGraphPrinter::VisitChainContext(ChainContextComp* comp) { |
| 1760 OS::Print("ChainContext("); |
| 1761 comp->context_value()->Accept(this); |
| 1762 OS::Print(")"); |
| 1763 } |
| 1764 |
| 1765 |
| 1766 void FlowGraphPrinter::VisitStoreContext(StoreContextComp* comp) { |
| 1767 OS::Print("StoreContext("); |
| 1768 comp->value()->Accept(this); |
| 1769 OS::Print(")"); |
| 1770 } |
| 1771 |
| 1772 |
| 1625 void FlowGraphPrinter::VisitJoinEntry(JoinEntryInstr* instr) { | 1773 void FlowGraphPrinter::VisitJoinEntry(JoinEntryInstr* instr) { |
| 1626 OS::Print("%2d: [join]", reverse_index(instr->postorder_number())); | 1774 OS::Print("%2d: [join]", reverse_index(instr->postorder_number())); |
| 1627 } | 1775 } |
| 1628 | 1776 |
| 1629 | 1777 |
| 1630 void FlowGraphPrinter::VisitTargetEntry(TargetEntryInstr* instr) { | 1778 void FlowGraphPrinter::VisitTargetEntry(TargetEntryInstr* instr) { |
| 1631 OS::Print("%2d: [target]", reverse_index(instr->postorder_number())); | 1779 OS::Print("%2d: [target]", reverse_index(instr->postorder_number())); |
| 1632 } | 1780 } |
| 1633 | 1781 |
| 1634 | 1782 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1812 char* chars = reinterpret_cast<char*>( | 1960 char* chars = reinterpret_cast<char*>( |
| 1813 Isolate::Current()->current_zone()->Allocate(len)); | 1961 Isolate::Current()->current_zone()->Allocate(len)); |
| 1814 OS::SNPrint(chars, len, kFormat, function_name, reason); | 1962 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 1815 const Error& error = Error::Handle( | 1963 const Error& error = Error::Handle( |
| 1816 LanguageError::New(String::Handle(String::New(chars)))); | 1964 LanguageError::New(String::Handle(String::New(chars)))); |
| 1817 Isolate::Current()->long_jump_base()->Jump(1, error); | 1965 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 1818 } | 1966 } |
| 1819 | 1967 |
| 1820 | 1968 |
| 1821 } // namespace dart | 1969 } // namespace dart |
| OLD | NEW |