| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 class HGraphBuilder: public AstVisitor { | 698 class HGraphBuilder: public AstVisitor { |
| 699 public: | 699 public: |
| 700 enum BreakType { BREAK, CONTINUE }; | 700 enum BreakType { BREAK, CONTINUE }; |
| 701 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; | 701 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; |
| 702 | 702 |
| 703 // A class encapsulating (lazily-allocated) break and continue blocks for | 703 // A class encapsulating (lazily-allocated) break and continue blocks for |
| 704 // a breakable statement. Separated from BreakAndContinueScope so that it | 704 // a breakable statement. Separated from BreakAndContinueScope so that it |
| 705 // can have a separate lifetime. | 705 // can have a separate lifetime. |
| 706 class BreakAndContinueInfo BASE_EMBEDDED { | 706 class BreakAndContinueInfo BASE_EMBEDDED { |
| 707 public: | 707 public: |
| 708 explicit BreakAndContinueInfo(BreakableStatement* target) | 708 explicit BreakAndContinueInfo(BreakableStatement* target, |
| 709 : target_(target), break_block_(NULL), continue_block_(NULL) { | 709 int drop_extra = 0) |
| 710 : target_(target), |
| 711 break_block_(NULL), |
| 712 continue_block_(NULL), |
| 713 drop_extra_(drop_extra) { |
| 710 } | 714 } |
| 711 | 715 |
| 712 BreakableStatement* target() { return target_; } | 716 BreakableStatement* target() { return target_; } |
| 713 HBasicBlock* break_block() { return break_block_; } | 717 HBasicBlock* break_block() { return break_block_; } |
| 714 void set_break_block(HBasicBlock* block) { break_block_ = block; } | 718 void set_break_block(HBasicBlock* block) { break_block_ = block; } |
| 715 HBasicBlock* continue_block() { return continue_block_; } | 719 HBasicBlock* continue_block() { return continue_block_; } |
| 716 void set_continue_block(HBasicBlock* block) { continue_block_ = block; } | 720 void set_continue_block(HBasicBlock* block) { continue_block_ = block; } |
| 721 int drop_extra() { return drop_extra_; } |
| 717 | 722 |
| 718 private: | 723 private: |
| 719 BreakableStatement* target_; | 724 BreakableStatement* target_; |
| 720 HBasicBlock* break_block_; | 725 HBasicBlock* break_block_; |
| 721 HBasicBlock* continue_block_; | 726 HBasicBlock* continue_block_; |
| 727 int drop_extra_; |
| 722 }; | 728 }; |
| 723 | 729 |
| 724 // A helper class to maintain a stack of current BreakAndContinueInfo | 730 // A helper class to maintain a stack of current BreakAndContinueInfo |
| 725 // structures mirroring BreakableStatement nesting. | 731 // structures mirroring BreakableStatement nesting. |
| 726 class BreakAndContinueScope BASE_EMBEDDED { | 732 class BreakAndContinueScope BASE_EMBEDDED { |
| 727 public: | 733 public: |
| 728 BreakAndContinueScope(BreakAndContinueInfo* info, HGraphBuilder* owner) | 734 BreakAndContinueScope(BreakAndContinueInfo* info, HGraphBuilder* owner) |
| 729 : info_(info), owner_(owner), next_(owner->break_scope()) { | 735 : info_(info), owner_(owner), next_(owner->break_scope()) { |
| 730 owner->set_break_scope(this); | 736 owner->set_break_scope(this); |
| 731 } | 737 } |
| 732 | 738 |
| 733 ~BreakAndContinueScope() { owner_->set_break_scope(next_); } | 739 ~BreakAndContinueScope() { owner_->set_break_scope(next_); } |
| 734 | 740 |
| 735 BreakAndContinueInfo* info() { return info_; } | 741 BreakAndContinueInfo* info() { return info_; } |
| 736 HGraphBuilder* owner() { return owner_; } | 742 HGraphBuilder* owner() { return owner_; } |
| 737 BreakAndContinueScope* next() { return next_; } | 743 BreakAndContinueScope* next() { return next_; } |
| 738 | 744 |
| 739 // Search the break stack for a break or continue target. | 745 // Search the break stack for a break or continue target. |
| 740 HBasicBlock* Get(BreakableStatement* stmt, BreakType type); | 746 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra); |
| 741 | 747 |
| 742 private: | 748 private: |
| 743 BreakAndContinueInfo* info_; | 749 BreakAndContinueInfo* info_; |
| 744 HGraphBuilder* owner_; | 750 HGraphBuilder* owner_; |
| 745 BreakAndContinueScope* next_; | 751 BreakAndContinueScope* next_; |
| 746 }; | 752 }; |
| 747 | 753 |
| 748 HGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle); | 754 HGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle); |
| 749 | 755 |
| 750 HGraph* CreateGraph(); | 756 HGraph* CreateGraph(); |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 const char* filename_; | 1309 const char* filename_; |
| 1304 HeapStringAllocator string_allocator_; | 1310 HeapStringAllocator string_allocator_; |
| 1305 StringStream trace_; | 1311 StringStream trace_; |
| 1306 int indent_; | 1312 int indent_; |
| 1307 }; | 1313 }; |
| 1308 | 1314 |
| 1309 | 1315 |
| 1310 } } // namespace v8::internal | 1316 } } // namespace v8::internal |
| 1311 | 1317 |
| 1312 #endif // V8_HYDROGEN_H_ | 1318 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |