| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_MACRO_ASSEMBLER_H_ | 5 #ifndef V8_MACRO_ASSEMBLER_H_ |
| 6 #define V8_MACRO_ASSEMBLER_H_ | 6 #define V8_MACRO_ASSEMBLER_H_ |
| 7 | 7 |
| 8 | 8 |
| 9 // Helper types to make boolean flag easier to read at call-site. | 9 // Helper types to make boolean flag easier to read at call-site. |
| 10 enum InvokeFlag { | 10 enum InvokeFlag { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 DCHECK(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE); | 117 DCHECK(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE); |
| 118 masm_->LeaveFrame(type_); | 118 masm_->LeaveFrame(type_); |
| 119 } | 119 } |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 MacroAssembler* masm_; | 122 MacroAssembler* masm_; |
| 123 StackFrame::Type type_; | 123 StackFrame::Type type_; |
| 124 bool old_has_frame_; | 124 bool old_has_frame_; |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 class FrameAndConstantPoolScope { |
| 128 public: |
| 129 FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type) |
| 130 : masm_(masm), |
| 131 type_(type), |
| 132 old_has_frame_(masm->has_frame()), |
| 133 old_constant_pool_available_(masm->is_ool_constant_pool_available()) { |
| 134 masm->set_has_frame(true); |
| 135 masm->set_ool_constant_pool_available(true); |
| 136 if (type_ != StackFrame::MANUAL && type_ != StackFrame::NONE) { |
| 137 masm->EnterFrame(type, !old_constant_pool_available_); |
| 138 } |
| 139 } |
| 140 |
| 141 ~FrameAndConstantPoolScope() { |
| 142 masm_->LeaveFrame(type_); |
| 143 masm_->set_has_frame(old_has_frame_); |
| 144 masm_->set_ool_constant_pool_available(old_constant_pool_available_); |
| 145 } |
| 146 |
| 147 // Normally we generate the leave-frame code when this object goes |
| 148 // out of scope. Sometimes we may need to generate the code somewhere else |
| 149 // in addition. Calling this will achieve that, but the object stays in |
| 150 // scope, the MacroAssembler is still marked as being in a frame scope, and |
| 151 // the code will be generated again when it goes out of scope. |
| 152 void GenerateLeaveFrame() { |
| 153 DCHECK(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE); |
| 154 masm_->LeaveFrame(type_); |
| 155 } |
| 156 |
| 157 private: |
| 158 MacroAssembler* masm_; |
| 159 StackFrame::Type type_; |
| 160 bool old_has_frame_; |
| 161 bool old_constant_pool_available_; |
| 162 |
| 163 DISALLOW_IMPLICIT_CONSTRUCTORS(FrameAndConstantPoolScope); |
| 164 }; |
| 165 |
| 166 // Class for scoping the the unavailability of constant pool access. |
| 167 class ConstantPoolUnavailableScope { |
| 168 public: |
| 169 explicit ConstantPoolUnavailableScope(MacroAssembler* masm) |
| 170 : masm_(masm), |
| 171 old_constant_pool_available_(masm->is_ool_constant_pool_available()) { |
| 172 if (FLAG_enable_ool_constant_pool) { |
| 173 masm_->set_ool_constant_pool_available(false); |
| 174 } |
| 175 } |
| 176 ~ConstantPoolUnavailableScope() { |
| 177 if (FLAG_enable_ool_constant_pool) { |
| 178 masm_->set_ool_constant_pool_available(old_constant_pool_available_); |
| 179 } |
| 180 } |
| 181 |
| 182 private: |
| 183 MacroAssembler* masm_; |
| 184 int old_constant_pool_available_; |
| 185 |
| 186 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolUnavailableScope); |
| 187 }; |
| 188 |
| 127 | 189 |
| 128 class AllowExternalCallThatCantCauseGC: public FrameScope { | 190 class AllowExternalCallThatCantCauseGC: public FrameScope { |
| 129 public: | 191 public: |
| 130 explicit AllowExternalCallThatCantCauseGC(MacroAssembler* masm) | 192 explicit AllowExternalCallThatCantCauseGC(MacroAssembler* masm) |
| 131 : FrameScope(masm, StackFrame::NONE) { } | 193 : FrameScope(masm, StackFrame::NONE) { } |
| 132 }; | 194 }; |
| 133 | 195 |
| 134 | 196 |
| 135 class NoCurrentFrameScope { | 197 class NoCurrentFrameScope { |
| 136 public: | 198 public: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 isolate); | 258 isolate); |
| 197 } | 259 } |
| 198 return ExternalReference::new_space_allocation_limit_address(isolate); | 260 return ExternalReference::new_space_allocation_limit_address(isolate); |
| 199 } | 261 } |
| 200 }; | 262 }; |
| 201 | 263 |
| 202 | 264 |
| 203 } } // namespace v8::internal | 265 } } // namespace v8::internal |
| 204 | 266 |
| 205 #endif // V8_MACRO_ASSEMBLER_H_ | 267 #endif // V8_MACRO_ASSEMBLER_H_ |
| OLD | NEW |