| 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 Value* PhiInstr::InputAt(intptr_t i) const { | 279 Value* PhiInstr::InputAt(intptr_t i) const { |
| 280 return inputs_[i]; | 280 return inputs_[i]; |
| 281 } | 281 } |
| 282 | 282 |
| 283 | 283 |
| 284 void PhiInstr::SetInputAt(intptr_t i, Value* value) { | 284 void PhiInstr::SetInputAt(intptr_t i, Value* value) { |
| 285 inputs_[i] = value; | 285 inputs_[i] = value; |
| 286 } | 286 } |
| 287 | 287 |
| 288 | 288 |
| 289 intptr_t ParameterInstr::InputCount() const { |
| 290 return 0; |
| 291 } |
| 292 |
| 293 |
| 294 Value* ParameterInstr::InputAt(intptr_t i) const { |
| 295 UNREACHABLE(); |
| 296 return NULL; |
| 297 } |
| 298 |
| 299 |
| 300 void ParameterInstr::SetInputAt(intptr_t i, Value* value) { |
| 301 UNREACHABLE(); |
| 302 } |
| 303 |
| 304 |
| 289 intptr_t DoInstr::InputCount() const { | 305 intptr_t DoInstr::InputCount() const { |
| 290 return computation()->InputCount(); | 306 return computation()->InputCount(); |
| 291 } | 307 } |
| 292 | 308 |
| 293 | 309 |
| 294 Value* DoInstr::InputAt(intptr_t i) const { | 310 Value* DoInstr::InputAt(intptr_t i) const { |
| 295 return computation()->InputAt(i); | 311 return computation()->InputAt(i); |
| 296 } | 312 } |
| 297 | 313 |
| 298 | 314 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 | 450 |
| 435 // 1. Record control-flow-graph basic-block predecessors. | 451 // 1. Record control-flow-graph basic-block predecessors. |
| 436 AddPredecessor(current_block); | 452 AddPredecessor(current_block); |
| 437 | 453 |
| 438 // 2. If the block has already been reached by the traversal, we are | 454 // 2. If the block has already been reached by the traversal, we are |
| 439 // done. Blocks with a single predecessor cannot have been reached | 455 // done. Blocks with a single predecessor cannot have been reached |
| 440 // before. | 456 // before. |
| 441 ASSERT(!IsTargetEntry() || (preorder_number() == -1)); | 457 ASSERT(!IsTargetEntry() || (preorder_number() == -1)); |
| 442 if (preorder_number() >= 0) return; | 458 if (preorder_number() >= 0) return; |
| 443 | 459 |
| 444 // 3. The last entry in the preorder array is the spanning-tree parent. | 460 // 3. The current block is the spanning-tree parent. |
| 445 intptr_t parent_number = preorder->length() - 1; | 461 parent->Add(current_block->preorder_number()); |
| 446 parent->Add(parent_number); | |
| 447 | 462 |
| 448 // 4. Assign preorder number and add the block entry to the list. | 463 // 4. Assign preorder number and add the block entry to the list. |
| 449 // Allocate an empty set of assigned variables for the block. | 464 // Allocate an empty set of assigned variables for the block. |
| 450 set_preorder_number(parent_number + 1); | 465 set_preorder_number(preorder->length()); |
| 451 preorder->Add(this); | 466 preorder->Add(this); |
| 452 BitVector* vars = | 467 BitVector* vars = |
| 453 (variable_count == 0) ? NULL : new BitVector(variable_count); | 468 (variable_count == 0) ? NULL : new BitVector(variable_count); |
| 454 assigned_vars->Add(vars); | 469 assigned_vars->Add(vars); |
| 455 // The preorder, parent, and assigned_vars arrays are all indexed by | 470 // The preorder, parent, and assigned_vars arrays are all indexed by |
| 456 // preorder block number, so they should stay in lockstep. | 471 // preorder block number, so they should stay in lockstep. |
| 457 ASSERT(preorder->length() == parent->length()); | 472 ASSERT(preorder->length() == parent->length()); |
| 458 ASSERT(preorder->length() == assigned_vars->length()); | 473 ASSERT(preorder->length() == assigned_vars->length()); |
| 459 | 474 |
| 460 // 5. Iterate straight-line successors until a branch instruction or | 475 // 5. Iterate straight-line successors until a branch instruction or |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 1352 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
| 1338 compiler->GenerateCall(token_pos(), try_index(), &label, | 1353 compiler->GenerateCall(token_pos(), try_index(), &label, |
| 1339 PcDescriptors::kOther); | 1354 PcDescriptors::kOther); |
| 1340 __ Drop(2); // Discard type arguments and receiver. | 1355 __ Drop(2); // Discard type arguments and receiver. |
| 1341 } | 1356 } |
| 1342 | 1357 |
| 1343 | 1358 |
| 1344 #undef __ | 1359 #undef __ |
| 1345 | 1360 |
| 1346 } // namespace dart | 1361 } // namespace dart |
| OLD | NEW |