| 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 | 203 |
| 204 #define DECLARE_HYDROGEN_ACCESSOR(type) \ | 204 #define DECLARE_HYDROGEN_ACCESSOR(type) \ |
| 205 H##type* hydrogen() const { \ | 205 H##type* hydrogen() const { \ |
| 206 return H##type::cast(hydrogen_value()); \ | 206 return H##type::cast(hydrogen_value()); \ |
| 207 } | 207 } |
| 208 | 208 |
| 209 | 209 |
| 210 class LInstruction: public ZoneObject { | 210 class LInstruction: public ZoneObject { |
| 211 public: | 211 public: |
| 212 LInstruction() | 212 LInstruction() |
| 213 : environment_(NULL), | 213 : environment_(NULL), |
| 214 hydrogen_value_(NULL), | 214 hydrogen_value_(NULL), |
| 215 is_call_(false) { } | 215 bit_field_(IsCallBits::encode(false)) { |
| 216 set_position(RelocInfo::kNoPosition); |
| 217 } |
| 218 |
| 216 virtual ~LInstruction() { } | 219 virtual ~LInstruction() { } |
| 217 | 220 |
| 218 virtual void CompileToNative(LCodeGen* generator) = 0; | 221 virtual void CompileToNative(LCodeGen* generator) = 0; |
| 219 virtual const char* Mnemonic() const = 0; | 222 virtual const char* Mnemonic() const = 0; |
| 220 virtual void PrintTo(StringStream* stream); | 223 virtual void PrintTo(StringStream* stream); |
| 221 virtual void PrintDataTo(StringStream* stream); | 224 virtual void PrintDataTo(StringStream* stream); |
| 222 virtual void PrintOutputOperandTo(StringStream* stream); | 225 virtual void PrintOutputOperandTo(StringStream* stream); |
| 223 | 226 |
| 224 enum Opcode { | 227 enum Opcode { |
| 225 // Declare a unique enum value for each instruction. | 228 // Declare a unique enum value for each instruction. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 244 virtual bool IsControl() const { return false; } | 247 virtual bool IsControl() const { return false; } |
| 245 | 248 |
| 246 void set_environment(LEnvironment* env) { environment_ = env; } | 249 void set_environment(LEnvironment* env) { environment_ = env; } |
| 247 LEnvironment* environment() const { return environment_; } | 250 LEnvironment* environment() const { return environment_; } |
| 248 bool HasEnvironment() const { return environment_ != NULL; } | 251 bool HasEnvironment() const { return environment_ != NULL; } |
| 249 | 252 |
| 250 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 253 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
| 251 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 254 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
| 252 bool HasPointerMap() const { return pointer_map_.is_set(); } | 255 bool HasPointerMap() const { return pointer_map_.is_set(); } |
| 253 | 256 |
| 257 // The 31 bits PositionBits is used to store the int position value. And the |
| 258 // position value may be RelocInfo::kNoPosition (-1). The accessor always |
| 259 // +1/-1 so that the encoded value of position in bit_field_ is always >= 0 |
| 260 // and can fit into the 31 bits PositionBits. |
| 261 void set_position(int pos) { |
| 262 bit_field_ = PositionBits::update(bit_field_, pos + 1); |
| 263 } |
| 264 int position() { return PositionBits::decode(bit_field_) - 1; } |
| 265 |
| 254 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 266 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
| 255 HValue* hydrogen_value() const { return hydrogen_value_; } | 267 HValue* hydrogen_value() const { return hydrogen_value_; } |
| 256 | 268 |
| 257 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } | 269 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
| 258 | 270 |
| 259 void MarkAsCall() { is_call_ = true; } | 271 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } |
| 272 bool IsCall() const { return IsCallBits::decode(bit_field_); } |
| 260 | 273 |
| 261 // Interface to the register allocator and iterators. | 274 // Interface to the register allocator and iterators. |
| 262 bool ClobbersTemps() const { return is_call_; } | 275 bool ClobbersTemps() const { return IsCall(); } |
| 263 bool ClobbersRegisters() const { return is_call_; } | 276 bool ClobbersRegisters() const { return IsCall(); } |
| 264 bool ClobbersDoubleRegisters() const { return is_call_; } | 277 bool ClobbersDoubleRegisters() const { return IsCall(); } |
| 265 | 278 |
| 266 // Interface to the register allocator and iterators. | 279 // Interface to the register allocator and iterators. |
| 267 bool IsMarkedAsCall() const { return is_call_; } | 280 bool IsMarkedAsCall() const { return IsCall(); } |
| 268 | 281 |
| 269 virtual bool HasResult() const = 0; | 282 virtual bool HasResult() const = 0; |
| 270 virtual LOperand* result() const = 0; | 283 virtual LOperand* result() const = 0; |
| 271 | 284 |
| 272 LOperand* FirstInput() { return InputAt(0); } | 285 LOperand* FirstInput() { return InputAt(0); } |
| 273 LOperand* Output() { return HasResult() ? result() : NULL; } | 286 LOperand* Output() { return HasResult() ? result() : NULL; } |
| 274 | 287 |
| 275 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 288 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
| 276 | 289 |
| 277 #ifdef DEBUG | 290 #ifdef DEBUG |
| 278 void VerifyCall(); | 291 void VerifyCall(); |
| 279 #endif | 292 #endif |
| 280 | 293 |
| 281 private: | 294 private: |
| 282 // Iterator support. | 295 // Iterator support. |
| 283 friend class InputIterator; | 296 friend class InputIterator; |
| 284 virtual int InputCount() = 0; | 297 virtual int InputCount() = 0; |
| 285 virtual LOperand* InputAt(int i) = 0; | 298 virtual LOperand* InputAt(int i) = 0; |
| 286 | 299 |
| 287 friend class TempIterator; | 300 friend class TempIterator; |
| 288 virtual int TempCount() = 0; | 301 virtual int TempCount() = 0; |
| 289 virtual LOperand* TempAt(int i) = 0; | 302 virtual LOperand* TempAt(int i) = 0; |
| 290 | 303 |
| 304 class IsCallBits: public BitField<bool, 0, 1> {}; |
| 305 class PositionBits: public BitField<int, 1, 31> {}; |
| 306 |
| 291 LEnvironment* environment_; | 307 LEnvironment* environment_; |
| 292 SetOncePointer<LPointerMap> pointer_map_; | 308 SetOncePointer<LPointerMap> pointer_map_; |
| 293 HValue* hydrogen_value_; | 309 HValue* hydrogen_value_; |
| 294 bool is_call_; | 310 int bit_field_; |
| 295 }; | 311 }; |
| 296 | 312 |
| 297 | 313 |
| 298 // R = number of result operands (0 or 1). | 314 // R = number of result operands (0 or 1). |
| 299 // I = number of input operands. | 315 // I = number of input operands. |
| 300 // T = number of temporary operands. | 316 // T = number of temporary operands. |
| 301 template<int R, int I, int T> | 317 template<int R, int I, int T> |
| 302 class LTemplateInstruction: public LInstruction { | 318 class LTemplateInstruction: public LInstruction { |
| 303 public: | 319 public: |
| 304 // Allow 0 or 1 output operands. | 320 // Allow 0 or 1 output operands. |
| (...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2779 | 2795 |
| 2780 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2796 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2781 }; | 2797 }; |
| 2782 | 2798 |
| 2783 #undef DECLARE_HYDROGEN_ACCESSOR | 2799 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2784 #undef DECLARE_CONCRETE_INSTRUCTION | 2800 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2785 | 2801 |
| 2786 } } // namespace v8::internal | 2802 } } // namespace v8::internal |
| 2787 | 2803 |
| 2788 #endif // V8_ARM_LITHIUM_ARM_H_ | 2804 #endif // V8_ARM_LITHIUM_ARM_H_ |
| OLD | NEW |