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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Emit a call to a jump target. There must be a current frame at | 113 // Emit a call to a jump target. There must be a current frame at |
114 // the call. The frame at the target is the same as the current | 114 // the call. The frame at the target is the same as the current |
115 // frame except for an extra return address on top of it. The frame | 115 // frame except for an extra return address on top of it. The frame |
116 // after the call is the same as the frame before the call. | 116 // after the call is the same as the frame before the call. |
117 void Call(); | 117 void Call(); |
118 | 118 |
119 protected: | 119 protected: |
120 // Has an entry frame been found? | 120 // Has an entry frame been found? |
121 bool entry_frame_set_; | 121 bool entry_frame_set_; |
122 | 122 |
| 123 // Can we branch backwards to this label? |
| 124 Directionality direction_; |
| 125 |
123 // The frame used on entry to the block and expected at backward | 126 // The frame used on entry to the block and expected at backward |
124 // jumps to the block. Set the first time something branches to this | 127 // jumps to the block. Set the first time something branches to this |
125 // jump target. | 128 // jump target. |
126 VirtualFrame entry_frame_; | 129 VirtualFrame entry_frame_; |
127 | 130 |
128 // The actual entry label of the block. | 131 // The actual entry label of the block. |
129 Label entry_label_; | 132 Label entry_label_; |
130 | 133 |
131 // Implementations of Jump, Branch, and Bind with all arguments and | 134 // Implementations of Jump, Branch, and Bind with all arguments and |
132 // return values using the virtual frame. | 135 // return values using the virtual frame. |
(...skipping 10 matching lines...) Expand all Loading... |
143 // statement that keeps extra state on the stack (eg, for/in or | 146 // statement that keeps extra state on the stack (eg, for/in or |
144 // try/finally). They know the expected stack height at the target | 147 // try/finally). They know the expected stack height at the target |
145 // and will drop state from nested statements as part of merging. | 148 // and will drop state from nested statements as part of merging. |
146 // | 149 // |
147 // Break targets are used for return, break, and continue targets. | 150 // Break targets are used for return, break, and continue targets. |
148 | 151 |
149 class BreakTarget : public JumpTarget { | 152 class BreakTarget : public JumpTarget { |
150 public: | 153 public: |
151 // Construct a break target. | 154 // Construct a break target. |
152 inline BreakTarget(); | 155 inline BreakTarget(); |
| 156 inline BreakTarget(JumpTarget::Directionality direction); |
153 | 157 |
154 virtual ~BreakTarget() {} | 158 virtual ~BreakTarget() {} |
155 | 159 |
156 // Copy the state of this jump target to the destination. | 160 // Copy the state of this jump target to the destination. |
157 inline void CopyTo(BreakTarget* destination) { | 161 inline void CopyTo(BreakTarget* destination) { |
158 *destination = *this; | 162 *destination = *this; |
159 } | 163 } |
160 | 164 |
161 // Emit a jump to the target. There must be a current frame at the | 165 // Emit a jump to the target. There must be a current frame at the |
162 // jump and there will be no current frame after the jump. | 166 // jump and there will be no current frame after the jump. |
(...skipping 17 matching lines...) Expand all Loading... |
180 | 184 |
181 private: | 185 private: |
182 // The expected height of the expression stack where the target will | 186 // The expected height of the expression stack where the target will |
183 // be bound, statically known at initialization time. | 187 // be bound, statically known at initialization time. |
184 int expected_height_; | 188 int expected_height_; |
185 }; | 189 }; |
186 | 190 |
187 } } // namespace v8::internal | 191 } } // namespace v8::internal |
188 | 192 |
189 #endif // V8_JUMP_TARGET_LIGHT_H_ | 193 #endif // V8_JUMP_TARGET_LIGHT_H_ |
OLD | NEW |