OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 H##type* hydrogen() const { \ | 204 H##type* hydrogen() const { \ |
205 return H##type::cast(hydrogen_value()); \ | 205 return H##type::cast(hydrogen_value()); \ |
206 } | 206 } |
207 | 207 |
208 | 208 |
209 class LInstruction: public ZoneObject { | 209 class LInstruction: public ZoneObject { |
210 public: | 210 public: |
211 LInstruction() | 211 LInstruction() |
212 : environment_(NULL), | 212 : environment_(NULL), |
213 hydrogen_value_(NULL), | 213 hydrogen_value_(NULL), |
214 is_call_(false) { } | 214 bit_field_(IsCallBits::encode(false)) { |
215 set_position(RelocInfo::kNoPosition); | |
216 } | |
217 | |
215 virtual ~LInstruction() { } | 218 virtual ~LInstruction() { } |
216 | 219 |
217 virtual void CompileToNative(LCodeGen* generator) = 0; | 220 virtual void CompileToNative(LCodeGen* generator) = 0; |
218 virtual const char* Mnemonic() const = 0; | 221 virtual const char* Mnemonic() const = 0; |
219 virtual void PrintTo(StringStream* stream); | 222 virtual void PrintTo(StringStream* stream); |
220 virtual void PrintDataTo(StringStream* stream); | 223 virtual void PrintDataTo(StringStream* stream); |
221 virtual void PrintOutputOperandTo(StringStream* stream); | 224 virtual void PrintOutputOperandTo(StringStream* stream); |
222 | 225 |
223 enum Opcode { | 226 enum Opcode { |
224 // Declare a unique enum value for each instruction. | 227 // Declare a unique enum value for each instruction. |
(...skipping 18 matching lines...) Expand all Loading... | |
243 virtual bool IsControl() const { return false; } | 246 virtual bool IsControl() const { return false; } |
244 | 247 |
245 void set_environment(LEnvironment* env) { environment_ = env; } | 248 void set_environment(LEnvironment* env) { environment_ = env; } |
246 LEnvironment* environment() const { return environment_; } | 249 LEnvironment* environment() const { return environment_; } |
247 bool HasEnvironment() const { return environment_ != NULL; } | 250 bool HasEnvironment() const { return environment_ != NULL; } |
248 | 251 |
249 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 252 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
250 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 253 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
251 bool HasPointerMap() const { return pointer_map_.is_set(); } | 254 bool HasPointerMap() const { return pointer_map_.is_set(); } |
252 | 255 |
256 // The 31 bits PositionBits is used to store the int position value. And the | |
257 // position value may be RelocInfo::kNoPosition (-1). The accessor always | |
258 // +1/-1 so that the encoded value of position in bit_field_ is always >= 0 | |
259 // and can fit into the 31 bits PositionBits. | |
260 void set_position(int pos) { | |
261 bit_field_ = PositionBits::update(bit_field_, pos + 1); | |
262 } | |
263 int position() { return PositionBits::decode(bit_field_) - 1; } | |
253 | 264 |
254 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 265 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
255 HValue* hydrogen_value() const { return hydrogen_value_; } | 266 HValue* hydrogen_value() const { return hydrogen_value_; } |
256 | 267 |
257 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } | 268 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
258 | 269 |
259 void MarkAsCall() { is_call_ = true; } | 270 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } |
260 | 271 |
danno
2013/08/05 16:59:17
Remove the line between MarkAsCall and IsCall
| |
272 bool IsCall() const { return IsCallBits::decode(bit_field_); } | |
danno
2013/08/05 16:59:17
Add a new line after IsCall
| |
261 // Interface to the register allocator and iterators. | 273 // Interface to the register allocator and iterators. |
262 bool ClobbersTemps() const { return is_call_; } | 274 bool ClobbersTemps() const { return IsCall(); } |
263 bool ClobbersRegisters() const { return is_call_; } | 275 bool ClobbersRegisters() const { return IsCall(); } |
264 virtual bool ClobbersDoubleRegisters() const { | 276 virtual bool ClobbersDoubleRegisters() const { |
265 return is_call_ || | 277 return IsCall() || |
266 (!CpuFeatures::IsSupported(SSE2) && | 278 (!CpuFeatures::IsSupported(SSE2) && |
267 // We only have rudimentary X87Stack tracking, thus in general | 279 // We only have rudimentary X87Stack tracking, thus in general |
268 // cannot handle deoptimization nor phi-nodes. | 280 // cannot handle deoptimization nor phi-nodes. |
269 (HasEnvironment() || IsControl())); | 281 (HasEnvironment() || IsControl())); |
270 } | 282 } |
271 | 283 |
272 virtual bool HasResult() const = 0; | 284 virtual bool HasResult() const = 0; |
273 virtual LOperand* result() const = 0; | 285 virtual LOperand* result() const = 0; |
274 | 286 |
275 bool HasDoubleRegisterResult(); | 287 bool HasDoubleRegisterResult(); |
(...skipping 12 matching lines...) Expand all Loading... | |
288 private: | 300 private: |
289 // Iterator support. | 301 // Iterator support. |
290 friend class InputIterator; | 302 friend class InputIterator; |
291 virtual int InputCount() = 0; | 303 virtual int InputCount() = 0; |
292 virtual LOperand* InputAt(int i) = 0; | 304 virtual LOperand* InputAt(int i) = 0; |
293 | 305 |
294 friend class TempIterator; | 306 friend class TempIterator; |
295 virtual int TempCount() = 0; | 307 virtual int TempCount() = 0; |
296 virtual LOperand* TempAt(int i) = 0; | 308 virtual LOperand* TempAt(int i) = 0; |
297 | 309 |
310 class IsCallBits: public BitField<bool, 0, 1> {}; | |
311 class PositionBits: public BitField<int, 1, 31> {}; | |
312 | |
298 LEnvironment* environment_; | 313 LEnvironment* environment_; |
299 SetOncePointer<LPointerMap> pointer_map_; | 314 SetOncePointer<LPointerMap> pointer_map_; |
300 HValue* hydrogen_value_; | 315 HValue* hydrogen_value_; |
301 bool is_call_; | 316 int bit_field_; |
302 }; | 317 }; |
303 | 318 |
304 | 319 |
305 // R = number of result operands (0 or 1). | 320 // R = number of result operands (0 or 1). |
306 // I = number of input operands. | 321 // I = number of input operands. |
307 // T = number of temporary operands. | 322 // T = number of temporary operands. |
308 template<int R, int I, int T> | 323 template<int R, int I, int T> |
309 class LTemplateInstruction: public LInstruction { | 324 class LTemplateInstruction: public LInstruction { |
310 public: | 325 public: |
311 // Allow 0 or 1 output operands. | 326 // Allow 0 or 1 output operands. |
(...skipping 2606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2918 | 2933 |
2919 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2934 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2920 }; | 2935 }; |
2921 | 2936 |
2922 #undef DECLARE_HYDROGEN_ACCESSOR | 2937 #undef DECLARE_HYDROGEN_ACCESSOR |
2923 #undef DECLARE_CONCRETE_INSTRUCTION | 2938 #undef DECLARE_CONCRETE_INSTRUCTION |
2924 | 2939 |
2925 } } // namespace v8::internal | 2940 } } // namespace v8::internal |
2926 | 2941 |
2927 #endif // V8_IA32_LITHIUM_IA32_H_ | 2942 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |