| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 JumpTarget(); | 60 JumpTarget(); |
| 61 | 61 |
| 62 virtual ~JumpTarget() { delete expected_frame_; } | 62 virtual ~JumpTarget() { delete expected_frame_; } |
| 63 | 63 |
| 64 // Supply a code generator. This function expects to be given a non-null | 64 // Supply a code generator. This function expects to be given a non-null |
| 65 // code generator, and to be called only when the code generator is not | 65 // code generator, and to be called only when the code generator is not |
| 66 // yet set. | 66 // yet set. |
| 67 void set_code_generator(CodeGenerator* cgen); | 67 void set_code_generator(CodeGenerator* cgen); |
| 68 | 68 |
| 69 // Accessors. | 69 // Accessors. |
| 70 CodeGenerator* code_generator() const { return code_generator_; } | 70 CodeGenerator* code_generator() const { return cgen_; } |
| 71 | 71 |
| 72 Label* label() { return &label_; } | 72 Label* label() { return &label_; } |
| 73 | 73 |
| 74 VirtualFrame* expected_frame() const { return expected_frame_; } | 74 VirtualFrame* expected_frame() const { return expected_frame_; } |
| 75 void set_expected_frame(VirtualFrame* frame) { | 75 void set_expected_frame(VirtualFrame* frame) { |
| 76 expected_frame_ = frame; | 76 expected_frame_ = frame; |
| 77 } | 77 } |
| 78 | 78 |
| 79 // Predicates testing the state of the encapsulated label. | 79 // Predicates testing the state of the encapsulated label. |
| 80 bool is_bound() const { return label_.is_bound(); } | 80 bool is_bound() const { return label_.is_bound(); } |
| 81 bool is_linked() const { return label_.is_linked(); } | 81 bool is_linked() const { return label_.is_linked(); } |
| 82 bool is_unused() const { return label_.is_unused(); } | 82 bool is_unused() const { return label_.is_unused(); } |
| 83 | 83 |
| 84 // Treat the jump target as a fresh one---the label is unused and the | 84 // Treat the jump target as a fresh one---the label is unused and the |
| 85 // expected frame if any is reset. | 85 // expected frame if any is reset. |
| 86 void Unuse() { | 86 void Unuse() { |
| 87 label_.Unuse(); | 87 label_.Unuse(); |
| 88 delete expected_frame_; | 88 delete expected_frame_; |
| 89 expected_frame_ = NULL; | 89 expected_frame_ = NULL; |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Emit a jump to the target. There must be a current frame before the | 92 // Emit a jump to the target. There must be a current frame before the |
| 93 // jump and there will be no current frame after the jump. | 93 // jump and there will be no current frame after the jump. |
| 94 void Jump(); | 94 void Jump(); |
| 95 | 95 |
| 96 // Emit a conditional branch to the target. If there is no current frame, | 96 // Emit a conditional branch to the target. If there is no current frame, |
| 97 // there must be one expected at the target. | 97 // there must be one expected at the target. |
| 98 void Branch(Condition cc, Hint hint = no_hint); | 98 void Branch(Condition cc, Hint hint = no_hint); |
| 99 void Branch(Condition cc, Result* arg, Hint hint = no_hint); |
| 99 | 100 |
| 100 // Bind a jump target. There must be a current frame and no expected | 101 // Bind a jump target. There must be a current frame and no expected |
| 101 // frame at the target (targets are only bound once). | 102 // frame at the target (targets are only bound once). |
| 102 void Bind(); | 103 void Bind(); |
| 104 void Bind(Result* arg); |
| 103 | 105 |
| 104 // Emit a call to a jump target. There must be a current frame. The | 106 // Emit a call to a jump target. There must be a current frame. The |
| 105 // frame at the target is the same as the current frame except for an | 107 // frame at the target is the same as the current frame except for an |
| 106 // extra return address on top of it. | 108 // extra return address on top of it. |
| 107 void Call(); | 109 void Call(); |
| 108 | 110 |
| 109 protected: | 111 protected: |
| 110 // The encapsulated assembler label. | 112 // The encapsulated assembler label. |
| 111 Label label_; | 113 Label label_; |
| 112 | 114 |
| 113 // The expected frame where the label is bound, or NULL. | 115 // The expected frame where the label is bound, or NULL. |
| 114 VirtualFrame* expected_frame_; | 116 VirtualFrame* expected_frame_; |
| 115 | 117 |
| 116 private: | 118 private: |
| 117 // The code generator gives access to the current frame. | 119 // The code generator gives access to the current frame. |
| 118 CodeGenerator* code_generator_; | 120 CodeGenerator* cgen_; |
| 119 | 121 |
| 120 // Used to emit code. | 122 // Used to emit code. |
| 121 MacroAssembler* masm_; | 123 MacroAssembler* masm_; |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 | 126 |
| 125 // ------------------------------------------------------------------------- | 127 // ------------------------------------------------------------------------- |
| 126 // Shadow jump targets | 128 // Shadow jump targets |
| 127 // | 129 // |
| 128 // Shadow jump targets represent a jump target that is temporarily shadowed | 130 // Shadow jump targets represent a jump target that is temporarily shadowed |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 168 |
| 167 #ifdef DEBUG | 169 #ifdef DEBUG |
| 168 bool is_shadowing_; | 170 bool is_shadowing_; |
| 169 #endif | 171 #endif |
| 170 }; | 172 }; |
| 171 | 173 |
| 172 | 174 |
| 173 } } // namespace v8::internal | 175 } } // namespace v8::internal |
| 174 | 176 |
| 175 #endif // V8_JUMP_TARGET_H_ | 177 #endif // V8_JUMP_TARGET_H_ |
| OLD | NEW |