OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 | 659 |
660 Instruction* next() const { return next_; } | 660 Instruction* next() const { return next_; } |
661 void set_next(Instruction* instr) { | 661 void set_next(Instruction* instr) { |
662 ASSERT(!IsGraphEntry()); | 662 ASSERT(!IsGraphEntry()); |
663 ASSERT(!IsReturn()); | 663 ASSERT(!IsReturn()); |
664 ASSERT(!IsBranch() || (instr == NULL)); | 664 ASSERT(!IsBranch() || (instr == NULL)); |
665 ASSERT(!IsPhi()); | 665 ASSERT(!IsPhi()); |
666 ASSERT(instr == NULL || !instr->IsBlockEntry()); | 666 ASSERT(instr == NULL || !instr->IsBlockEntry()); |
667 // TODO(fschneider): Also add Throw and ReThrow to the list of instructions | 667 // TODO(fschneider): Also add Throw and ReThrow to the list of instructions |
668 // that do not have a successor. Currently, the graph builder will continue | 668 // that do not have a successor. Currently, the graph builder will continue |
669 // to append instruction in case of a Throw inside an expression. This | 669 // to append instructions in case of a Throw inside an expression. This |
670 // condition should be handled in the graph builder | 670 // condition should be handled in the graph builder. |
671 next_ = instr; | 671 next_ = instr; |
672 } | 672 } |
673 | 673 |
674 // Link together two instruction. | 674 // Link together two instruction. |
675 void LinkTo(Instruction* next) { | 675 void LinkTo(Instruction* next) { |
676 ASSERT(this != next); | 676 ASSERT(this != next); |
677 this->set_next(next); | 677 this->set_next(next); |
678 next->set_previous(this); | 678 next->set_previous(this); |
679 } | 679 } |
680 | 680 |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 TargetEntryInstr* normal_entry() const { return normal_entry_; } | 1358 TargetEntryInstr* normal_entry() const { return normal_entry_; } |
1359 | 1359 |
1360 const ParsedFunction& parsed_function() const { | 1360 const ParsedFunction& parsed_function() const { |
1361 return *parsed_function_; | 1361 return *parsed_function_; |
1362 } | 1362 } |
1363 | 1363 |
1364 const GrowableArray<CatchBlockEntryInstr*>& catch_entries() const { | 1364 const GrowableArray<CatchBlockEntryInstr*>& catch_entries() const { |
1365 return catch_entries_; | 1365 return catch_entries_; |
1366 } | 1366 } |
1367 | 1367 |
| 1368 intptr_t next_await_counter() { return jump_cnt_++; } |
| 1369 ZoneGrowableArray<intptr_t>& await_levels() { return await_levels_; } |
| 1370 ZoneGrowableArray<JoinEntryInstr*>& await_joins() { |
| 1371 return await_joins_; |
| 1372 } |
| 1373 |
1368 virtual void PrintTo(BufferFormatter* f) const; | 1374 virtual void PrintTo(BufferFormatter* f) const; |
1369 | 1375 |
1370 private: | 1376 private: |
1371 virtual void ClearPredecessors() {} | 1377 virtual void ClearPredecessors() {} |
1372 virtual void AddPredecessor(BlockEntryInstr* predecessor) { UNREACHABLE(); } | 1378 virtual void AddPredecessor(BlockEntryInstr* predecessor) { UNREACHABLE(); } |
1373 | 1379 |
1374 const ParsedFunction* parsed_function_; | 1380 const ParsedFunction* parsed_function_; |
1375 TargetEntryInstr* normal_entry_; | 1381 TargetEntryInstr* normal_entry_; |
1376 GrowableArray<CatchBlockEntryInstr*> catch_entries_; | 1382 GrowableArray<CatchBlockEntryInstr*> catch_entries_; |
1377 GrowableArray<Definition*> initial_definitions_; | 1383 GrowableArray<Definition*> initial_definitions_; |
1378 const intptr_t osr_id_; | 1384 const intptr_t osr_id_; |
1379 intptr_t entry_count_; | 1385 intptr_t entry_count_; |
1380 intptr_t spill_slot_count_; | 1386 intptr_t spill_slot_count_; |
1381 intptr_t fixed_slot_count_; // For try-catch in optimized code. | 1387 intptr_t fixed_slot_count_; // For try-catch in optimized code. |
1382 | 1388 |
| 1389 intptr_t jump_cnt_; |
| 1390 ZoneGrowableArray<JoinEntryInstr*> await_joins_; |
| 1391 ZoneGrowableArray<intptr_t> await_levels_; |
| 1392 |
1383 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); | 1393 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); |
1384 }; | 1394 }; |
1385 | 1395 |
1386 | 1396 |
1387 class JoinEntryInstr : public BlockEntryInstr { | 1397 class JoinEntryInstr : public BlockEntryInstr { |
1388 public: | 1398 public: |
1389 JoinEntryInstr(intptr_t block_id, intptr_t try_index) | 1399 JoinEntryInstr(intptr_t block_id, intptr_t try_index) |
1390 : BlockEntryInstr(block_id, try_index), | 1400 : BlockEntryInstr(block_id, try_index), |
1391 predecessors_(2), // Two is the assumed to be the common case. | 1401 predecessors_(2), // Two is the assumed to be the common case. |
1392 phis_(NULL) { } | 1402 phis_(NULL) { } |
(...skipping 7018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8411 Isolate* isolate, bool opt) const { \ | 8421 Isolate* isolate, bool opt) const { \ |
8412 UNIMPLEMENTED(); \ | 8422 UNIMPLEMENTED(); \ |
8413 return NULL; \ | 8423 return NULL; \ |
8414 } \ | 8424 } \ |
8415 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8425 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8416 | 8426 |
8417 | 8427 |
8418 } // namespace dart | 8428 } // namespace dart |
8419 | 8429 |
8420 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8430 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |