| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 StackFrame::Type type_; | 130 StackFrame::Type type_; |
| 131 bool old_has_frame_; | 131 bool old_has_frame_; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 class FrameAndConstantPoolScope { | 134 class FrameAndConstantPoolScope { |
| 135 public: | 135 public: |
| 136 FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type) | 136 FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type) |
| 137 : masm_(masm), | 137 : masm_(masm), |
| 138 type_(type), | 138 type_(type), |
| 139 old_has_frame_(masm->has_frame()), | 139 old_has_frame_(masm->has_frame()), |
| 140 old_constant_pool_available_(FLAG_enable_ool_constant_pool && | 140 old_constant_pool_available_((FLAG_enable_ool_constant_pool || |
| 141 masm->is_ool_constant_pool_available()) { | 141 FLAG_enable_embedded_constant_pool) && |
| 142 masm->is_constant_pool_available()) { |
| 142 masm->set_has_frame(true); | 143 masm->set_has_frame(true); |
| 143 if (FLAG_enable_ool_constant_pool) { | 144 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
| 144 masm->set_ool_constant_pool_available(true); | 145 masm->set_constant_pool_available(true); |
| 145 } | 146 } |
| 146 if (type_ != StackFrame::MANUAL && type_ != StackFrame::NONE) { | 147 if (type_ != StackFrame::MANUAL && type_ != StackFrame::NONE) { |
| 147 masm->EnterFrame(type, !old_constant_pool_available_); | 148 masm->EnterFrame(type, !old_constant_pool_available_); |
| 148 } | 149 } |
| 149 } | 150 } |
| 150 | 151 |
| 151 ~FrameAndConstantPoolScope() { | 152 ~FrameAndConstantPoolScope() { |
| 152 masm_->LeaveFrame(type_); | 153 masm_->LeaveFrame(type_); |
| 153 masm_->set_has_frame(old_has_frame_); | 154 masm_->set_has_frame(old_has_frame_); |
| 154 if (FLAG_enable_ool_constant_pool) { | 155 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
| 155 masm_->set_ool_constant_pool_available(old_constant_pool_available_); | 156 masm_->set_constant_pool_available(old_constant_pool_available_); |
| 156 } | 157 } |
| 157 } | 158 } |
| 158 | 159 |
| 159 // Normally we generate the leave-frame code when this object goes | 160 // Normally we generate the leave-frame code when this object goes |
| 160 // out of scope. Sometimes we may need to generate the code somewhere else | 161 // out of scope. Sometimes we may need to generate the code somewhere else |
| 161 // in addition. Calling this will achieve that, but the object stays in | 162 // in addition. Calling this will achieve that, but the object stays in |
| 162 // scope, the MacroAssembler is still marked as being in a frame scope, and | 163 // scope, the MacroAssembler is still marked as being in a frame scope, and |
| 163 // the code will be generated again when it goes out of scope. | 164 // the code will be generated again when it goes out of scope. |
| 164 void GenerateLeaveFrame() { | 165 void GenerateLeaveFrame() { |
| 165 DCHECK(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE); | 166 DCHECK(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE); |
| 166 masm_->LeaveFrame(type_); | 167 masm_->LeaveFrame(type_); |
| 167 } | 168 } |
| 168 | 169 |
| 169 private: | 170 private: |
| 170 MacroAssembler* masm_; | 171 MacroAssembler* masm_; |
| 171 StackFrame::Type type_; | 172 StackFrame::Type type_; |
| 172 bool old_has_frame_; | 173 bool old_has_frame_; |
| 173 bool old_constant_pool_available_; | 174 bool old_constant_pool_available_; |
| 174 | 175 |
| 175 DISALLOW_IMPLICIT_CONSTRUCTORS(FrameAndConstantPoolScope); | 176 DISALLOW_IMPLICIT_CONSTRUCTORS(FrameAndConstantPoolScope); |
| 176 }; | 177 }; |
| 177 | 178 |
| 178 // Class for scoping the the unavailability of constant pool access. | 179 // Class for scoping the the unavailability of constant pool access. |
| 179 class ConstantPoolUnavailableScope { | 180 class ConstantPoolUnavailableScope { |
| 180 public: | 181 public: |
| 181 explicit ConstantPoolUnavailableScope(MacroAssembler* masm) | 182 explicit ConstantPoolUnavailableScope(MacroAssembler* masm) |
| 182 : masm_(masm), | 183 : masm_(masm), |
| 183 old_constant_pool_available_(FLAG_enable_ool_constant_pool && | 184 old_constant_pool_available_((FLAG_enable_ool_constant_pool || |
| 184 masm->is_ool_constant_pool_available()) { | 185 FLAG_enable_embedded_constant_pool) && |
| 185 if (FLAG_enable_ool_constant_pool) { | 186 masm->is_constant_pool_available()) { |
| 186 masm_->set_ool_constant_pool_available(false); | 187 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
| 188 masm_->set_constant_pool_available(false); |
| 187 } | 189 } |
| 188 } | 190 } |
| 189 ~ConstantPoolUnavailableScope() { | 191 ~ConstantPoolUnavailableScope() { |
| 190 if (FLAG_enable_ool_constant_pool) { | 192 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
| 191 masm_->set_ool_constant_pool_available(old_constant_pool_available_); | 193 masm_->set_constant_pool_available(old_constant_pool_available_); |
| 192 } | 194 } |
| 193 } | 195 } |
| 194 | 196 |
| 195 private: | 197 private: |
| 196 MacroAssembler* masm_; | 198 MacroAssembler* masm_; |
| 197 int old_constant_pool_available_; | 199 int old_constant_pool_available_; |
| 198 | 200 |
| 199 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolUnavailableScope); | 201 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolUnavailableScope); |
| 200 }; | 202 }; |
| 201 | 203 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 isolate); | 273 isolate); |
| 272 } | 274 } |
| 273 return ExternalReference::new_space_allocation_limit_address(isolate); | 275 return ExternalReference::new_space_allocation_limit_address(isolate); |
| 274 } | 276 } |
| 275 }; | 277 }; |
| 276 | 278 |
| 277 | 279 |
| 278 } } // namespace v8::internal | 280 } } // namespace v8::internal |
| 279 | 281 |
| 280 #endif // V8_MACRO_ASSEMBLER_H_ | 282 #endif // V8_MACRO_ASSEMBLER_H_ |
| OLD | NEW |