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