OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 CodeGenerator* code_generator() const { return cgen_; } | 83 CodeGenerator* code_generator() const { return cgen_; } |
84 | 84 |
85 Label* entry_label() { return &entry_label_; } | 85 Label* entry_label() { return &entry_label_; } |
86 | 86 |
87 VirtualFrame* entry_frame() const { return entry_frame_; } | 87 VirtualFrame* entry_frame() const { return entry_frame_; } |
88 void set_entry_frame(VirtualFrame* frame) { | 88 void set_entry_frame(VirtualFrame* frame) { |
89 entry_frame_ = frame; | 89 entry_frame_ = frame; |
90 } | 90 } |
91 | 91 |
92 // Predicates testing the state of the encapsulated label. | 92 // Predicates testing the state of the encapsulated label. |
93 bool is_bound() const { return is_bound_; } | 93 bool is_bound() const { return entry_label_.is_bound(); } |
94 bool is_linked() const { return is_linked_; } | 94 bool is_linked() const { |
95 bool is_unused() const { return !is_bound() && !is_linked(); } | 95 return !is_bound() && !reaching_frames_.is_empty(); |
| 96 } |
| 97 bool is_unused() const { |
| 98 // This is !is_bound() && !is_linked(). |
| 99 return !is_bound() && reaching_frames_.is_empty(); |
| 100 } |
96 | 101 |
97 // Emit a jump to the target. There must be a current frame at the | 102 // Emit a jump to the target. There must be a current frame at the |
98 // jump and there will be no current frame after the jump. | 103 // jump and there will be no current frame after the jump. |
99 virtual void Jump(); | 104 virtual void Jump(); |
100 virtual void Jump(Result* arg); | 105 virtual void Jump(Result* arg); |
101 void Jump(Result* arg0, Result* arg1); | 106 void Jump(Result* arg0, Result* arg1); |
102 void Jump(Result* arg0, Result* arg1, Result* arg2); | 107 void Jump(Result* arg0, Result* arg1, Result* arg2); |
103 | 108 |
104 // Emit a conditional branch to the target. There must be a current | 109 // Emit a conditional branch to the target. There must be a current |
105 // frame at the branch. The current frame will fall through to the | 110 // frame at the branch. The current frame will fall through to the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 protected: | 165 protected: |
161 // The code generator gives access to its current frame. | 166 // The code generator gives access to its current frame. |
162 CodeGenerator* cgen_; | 167 CodeGenerator* cgen_; |
163 | 168 |
164 // Used to emit code. | 169 // Used to emit code. |
165 MacroAssembler* masm_; | 170 MacroAssembler* masm_; |
166 | 171 |
167 // Directionality flag set at initialization time. | 172 // Directionality flag set at initialization time. |
168 Directionality direction_; | 173 Directionality direction_; |
169 | 174 |
170 // A target is bound if its Bind member function has been called. | |
171 // It is linked if it is not bound but its Jump, Branch, or Call | |
172 // member functions have been called. | |
173 bool is_bound_; | |
174 bool is_linked_; | |
175 | |
176 // A list of frames reaching this block via forward jumps. | 175 // A list of frames reaching this block via forward jumps. |
177 ZoneList<VirtualFrame*> reaching_frames_; | 176 ZoneList<VirtualFrame*> reaching_frames_; |
178 | 177 |
179 // A parallel list of labels for merge code. | 178 // A parallel list of labels for merge code. |
180 ZoneList<Label> merge_labels_; | 179 ZoneList<Label> merge_labels_; |
181 | 180 |
182 // The frame used on entry to the block and expected at backward | 181 // The frame used on entry to the block and expected at backward |
183 // jumps to the block. Set when the jump target is bound, but may | 182 // jumps to the block. Set when the jump target is bound, but may |
184 // or may not be set for forward-only blocks. | 183 // or may not be set for forward-only blocks. |
185 VirtualFrame* entry_frame_; | 184 VirtualFrame* entry_frame_; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 bool is_shadowing_; | 314 bool is_shadowing_; |
316 #endif | 315 #endif |
317 | 316 |
318 DISALLOW_COPY_AND_ASSIGN(ShadowTarget); | 317 DISALLOW_COPY_AND_ASSIGN(ShadowTarget); |
319 }; | 318 }; |
320 | 319 |
321 | 320 |
322 } } // namespace v8::internal | 321 } } // namespace v8::internal |
323 | 322 |
324 #endif // V8_JUMP_TARGET_H_ | 323 #endif // V8_JUMP_TARGET_H_ |
OLD | NEW |