| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 Hint hint = no_hint); | 124 Hint hint = no_hint); |
| 125 void Branch(Condition cc, | 125 void Branch(Condition cc, |
| 126 Result* arg0, | 126 Result* arg0, |
| 127 Result* arg1, | 127 Result* arg1, |
| 128 Result* arg2, | 128 Result* arg2, |
| 129 Result* arg3, | 129 Result* arg3, |
| 130 Hint hint = no_hint); | 130 Hint hint = no_hint); |
| 131 | 131 |
| 132 // Bind a jump target. If there is no current frame at the binding | 132 // Bind a jump target. If there is no current frame at the binding |
| 133 // site, there must be at least one frame reaching via a forward | 133 // site, there must be at least one frame reaching via a forward |
| 134 // jump. This frame will be used to establish an expected frame for | 134 // jump. |
| 135 // the block, which will be the current frame after the bind. | 135 // |
| 136 void Bind(); | 136 // The number of mergable elements is a number of frame elements |
| 137 void Bind(Result* arg); | 137 // counting from the top down which must be "mergable" (not |
| 138 void Bind(Result* arg0, Result* arg1); | 138 // constants or copies) in the entry frame at the jump target. |
| 139 void Bind(Result* arg0, Result* arg1, Result* arg2); | 139 // Backward jumps to the target must contain the same constants and |
| 140 void Bind(Result* arg0, Result* arg1, Result* arg2, Result* arg3); | 140 // sharing as the entry frame, except for the mergable elements. |
| 141 // |
| 142 // A mergable elements argument of kAllElements indicates that all |
| 143 // frame elements must be mergable. Mergable elements are ignored |
| 144 // completely for forward-only jump targets. |
| 145 void Bind(int mergable_elements = kAllElements); |
| 146 void Bind(Result* arg, int mergable_elements = kAllElements); |
| 147 void Bind(Result* arg0, Result* arg1, int mergable_elements = kAllElements); |
| 148 void Bind(Result* arg0, |
| 149 Result* arg1, |
| 150 Result* arg2, |
| 151 int mergable_elements = kAllElements); |
| 152 void Bind(Result* arg0, |
| 153 Result* arg1, |
| 154 Result* arg2, |
| 155 Result* arg3, |
| 156 int mergable_elements = kAllElements); |
| 141 | 157 |
| 142 // Emit a call to a jump target. There must be a current frame at | 158 // Emit a call to a jump target. There must be a current frame at |
| 143 // the call. The frame at the target is the same as the current | 159 // the call. The frame at the target is the same as the current |
| 144 // frame except for an extra return address on top of it. The frame | 160 // frame except for an extra return address on top of it. The frame |
| 145 // after the call is the same as the frame before the call. | 161 // after the call is the same as the frame before the call. |
| 146 void Call(); | 162 void Call(); |
| 147 | 163 |
| 164 static const int kAllElements = -1; // Not a valid number of elements. |
| 165 |
| 148 protected: | 166 protected: |
| 149 // The code generator gives access to its current frame. | 167 // The code generator gives access to its current frame. |
| 150 CodeGenerator* cgen_; | 168 CodeGenerator* cgen_; |
| 151 | 169 |
| 152 // Used to emit code. | 170 // Used to emit code. |
| 153 MacroAssembler* masm_; | 171 MacroAssembler* masm_; |
| 154 | 172 |
| 155 private: | 173 private: |
| 156 // Directionality flag set at initialization time. | 174 // Directionality flag set at initialization time. |
| 157 Directionality direction_; | 175 Directionality direction_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 177 bool is_linked_; | 195 bool is_linked_; |
| 178 | 196 |
| 179 // Add a virtual frame reaching this labeled block via a forward | 197 // Add a virtual frame reaching this labeled block via a forward |
| 180 // jump, and a fresh label for its merge code. | 198 // jump, and a fresh label for its merge code. |
| 181 void AddReachingFrame(VirtualFrame* frame); | 199 void AddReachingFrame(VirtualFrame* frame); |
| 182 | 200 |
| 183 // Choose an element from a pair of frame elements to be in the | 201 // Choose an element from a pair of frame elements to be in the |
| 184 // expected frame. Return null if they are incompatible. | 202 // expected frame. Return null if they are incompatible. |
| 185 FrameElement* Combine(FrameElement* left, FrameElement* right); | 203 FrameElement* Combine(FrameElement* left, FrameElement* right); |
| 186 | 204 |
| 187 // Compute a frame to use for entry to this block. | 205 // Compute a frame to use for entry to this block. Mergable |
| 188 void ComputeEntryFrame(); | 206 // elements is as described for the Bind function. |
| 207 void ComputeEntryFrame(int mergable_elements); |
| 189 | 208 |
| 190 DISALLOW_COPY_AND_ASSIGN(JumpTarget); | 209 DISALLOW_COPY_AND_ASSIGN(JumpTarget); |
| 191 }; | 210 }; |
| 192 | 211 |
| 193 | 212 |
| 194 // ------------------------------------------------------------------------- | 213 // ------------------------------------------------------------------------- |
| 195 // Shadow jump targets | 214 // Shadow jump targets |
| 196 // | 215 // |
| 197 // Shadow jump targets represent a jump target that is temporarily shadowed | 216 // Shadow jump targets represent a jump target that is temporarily shadowed |
| 198 // by another one (represented by the original during shadowing). They are | 217 // by another one (represented by the original during shadowing). They are |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 bool is_shadowing_; | 250 bool is_shadowing_; |
| 232 #endif | 251 #endif |
| 233 | 252 |
| 234 DISALLOW_COPY_AND_ASSIGN(ShadowTarget); | 253 DISALLOW_COPY_AND_ASSIGN(ShadowTarget); |
| 235 }; | 254 }; |
| 236 | 255 |
| 237 | 256 |
| 238 } } // namespace v8::internal | 257 } } // namespace v8::internal |
| 239 | 258 |
| 240 #endif // V8_JUMP_TARGET_H_ | 259 #endif // V8_JUMP_TARGET_H_ |
| OLD | NEW |