| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 CodeGenerator* code_generator() const { return cgen_; } | 76 CodeGenerator* code_generator() const { return cgen_; } |
| 77 | 77 |
| 78 Label* entry_label() { return &entry_label_; } | 78 Label* entry_label() { return &entry_label_; } |
| 79 | 79 |
| 80 VirtualFrame* expected_frame() const { return expected_frame_; } | 80 VirtualFrame* expected_frame() const { return expected_frame_; } |
| 81 void set_expected_frame(VirtualFrame* frame) { | 81 void set_expected_frame(VirtualFrame* frame) { |
| 82 expected_frame_ = frame; | 82 expected_frame_ = frame; |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Predicates testing the state of the encapsulated label. | 85 // Predicates testing the state of the encapsulated label. |
| 86 bool is_bound() const { return expected_frame_ != NULL; } | 86 bool is_bound() const { return is_bound_; } |
| 87 bool is_linked() const { return reaching_frames_.length() > 0; } | 87 bool is_linked() const { return is_linked_; } |
| 88 bool is_unused() const { return !is_bound() && !is_linked(); } | 88 bool is_unused() const { return !is_bound() && !is_linked(); } |
| 89 | 89 |
| 90 // Treat the jump target as a fresh one. The expected frame if any | 90 // Treat the jump target as a fresh one. The expected frame if any |
| 91 // will be deallocated and there should be no dangling jumps to the | 91 // will be deallocated and there should be no dangling jumps to the |
| 92 // target (thus no reaching frames). | 92 // target (thus no reaching frames). |
| 93 void Unuse() { | 93 void Unuse(); |
| 94 ASSERT(!is_linked()); | |
| 95 entry_label_.Unuse(); | |
| 96 delete expected_frame_; | |
| 97 expected_frame_ = NULL; | |
| 98 } | |
| 99 | 94 |
| 100 // Reset the internal state of this jump target. Pointed-to virtual | 95 // Reset the internal state of this jump target. Pointed-to virtual |
| 101 // frames are not deallocated and dangling jumps to the target are | 96 // frames are not deallocated and dangling jumps to the target are |
| 102 // left dangling. | 97 // left dangling. |
| 103 void Reset() { | 98 void Reset(); |
| 104 reaching_frames_.Clear(); | |
| 105 merge_labels_.Clear(); | |
| 106 expected_frame_ = NULL; | |
| 107 entry_label_.Unuse(); | |
| 108 } | |
| 109 | 99 |
| 110 // Copy the state of this jump target to the destination. The lists | 100 // Copy the state of this jump target to the destination. The lists |
| 111 // of forward-reaching frames and merge-point labels are copied. | 101 // of forward-reaching frames and merge-point labels are copied. |
| 112 // All virtual frame pointers are copied, not the pointed-to frames. | 102 // All virtual frame pointers are copied, not the pointed-to frames. |
| 113 // The previous state of the destination is overwritten, without | 103 // The previous state of the destination is overwritten, without |
| 114 // deallocating pointed-to virtual frames. | 104 // deallocating pointed-to virtual frames. |
| 115 void CopyTo(JumpTarget* destination); | 105 void CopyTo(JumpTarget* destination); |
| 116 | 106 |
| 117 // Emit a jump to the target. There must be a current frame at the | 107 // Emit a jump to the target. There must be a current frame at the |
| 118 // jump and there will be no current frame after the jump. | 108 // jump and there will be no current frame after the jump. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 161 |
| 172 // A parallel list of labels for merge code. | 162 // A parallel list of labels for merge code. |
| 173 List<Label> merge_labels_; | 163 List<Label> merge_labels_; |
| 174 | 164 |
| 175 // The (mergable) frame expected at backward jumps to the block. | 165 // The (mergable) frame expected at backward jumps to the block. |
| 176 VirtualFrame* expected_frame_; | 166 VirtualFrame* expected_frame_; |
| 177 | 167 |
| 178 // The actual entry label of the block. | 168 // The actual entry label of the block. |
| 179 Label entry_label_; | 169 Label entry_label_; |
| 180 | 170 |
| 171 // A target is bound if its Bind member function has been called. |
| 172 // It is linked if it is not bound but its Jump, Branch, or Call |
| 173 // member functions have been called. |
| 174 bool is_bound_; |
| 175 bool is_linked_; |
| 176 |
| 181 // Add a virtual frame reaching this labeled block via a forward | 177 // Add a virtual frame reaching this labeled block via a forward |
| 182 // jump, and a fresh label for its merge code. | 178 // jump, and a fresh label for its merge code. |
| 183 void AddReachingFrame(VirtualFrame* frame); | 179 void AddReachingFrame(VirtualFrame* frame); |
| 184 | 180 |
| 185 DISALLOW_COPY_AND_ASSIGN(JumpTarget); | 181 DISALLOW_COPY_AND_ASSIGN(JumpTarget); |
| 186 }; | 182 }; |
| 187 | 183 |
| 188 | 184 |
| 189 // ------------------------------------------------------------------------- | 185 // ------------------------------------------------------------------------- |
| 190 // Shadow jump targets | 186 // Shadow jump targets |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 bool is_shadowing_; | 222 bool is_shadowing_; |
| 227 #endif | 223 #endif |
| 228 | 224 |
| 229 DISALLOW_COPY_AND_ASSIGN(ShadowTarget); | 225 DISALLOW_COPY_AND_ASSIGN(ShadowTarget); |
| 230 }; | 226 }; |
| 231 | 227 |
| 232 | 228 |
| 233 } } // namespace v8::internal | 229 } } // namespace v8::internal |
| 234 | 230 |
| 235 #endif // V8_JUMP_TARGET_H_ | 231 #endif // V8_JUMP_TARGET_H_ |
| OLD | NEW |