| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 #define DECLARE_HYDROGEN_ACCESSOR(type) \ | 203 #define DECLARE_HYDROGEN_ACCESSOR(type) \ |
| 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; } |
| 264 |
| 253 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 265 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
| 254 HValue* hydrogen_value() const { return hydrogen_value_; } | 266 HValue* hydrogen_value() const { return hydrogen_value_; } |
| 255 | 267 |
| 256 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } | 268 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
| 257 | 269 |
| 258 void MarkAsCall() { is_call_ = true; } | 270 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } |
| 271 bool IsCall() const { return IsCallBits::decode(bit_field_); } |
| 259 | 272 |
| 260 // Interface to the register allocator and iterators. | 273 // Interface to the register allocator and iterators. |
| 261 bool ClobbersTemps() const { return is_call_; } | 274 bool ClobbersTemps() const { return IsCall(); } |
| 262 bool ClobbersRegisters() const { return is_call_; } | 275 bool ClobbersRegisters() const { return IsCall(); } |
| 263 bool ClobbersDoubleRegisters() const { return is_call_; } | 276 bool ClobbersDoubleRegisters() const { return IsCall(); } |
| 264 | 277 |
| 265 // Interface to the register allocator and iterators. | 278 // Interface to the register allocator and iterators. |
| 266 bool IsMarkedAsCall() const { return is_call_; } | 279 bool IsMarkedAsCall() const { return IsCall(); } |
| 267 | 280 |
| 268 virtual bool HasResult() const = 0; | 281 virtual bool HasResult() const = 0; |
| 269 virtual LOperand* result() const = 0; | 282 virtual LOperand* result() const = 0; |
| 270 | 283 |
| 271 LOperand* FirstInput() { return InputAt(0); } | 284 LOperand* FirstInput() { return InputAt(0); } |
| 272 LOperand* Output() { return HasResult() ? result() : NULL; } | 285 LOperand* Output() { return HasResult() ? result() : NULL; } |
| 273 | 286 |
| 274 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 287 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
| 275 | 288 |
| 276 #ifdef DEBUG | 289 #ifdef DEBUG |
| 277 void VerifyCall(); | 290 void VerifyCall(); |
| 278 #endif | 291 #endif |
| 279 | 292 |
| 280 private: | 293 private: |
| 281 // Iterator support. | 294 // Iterator support. |
| 282 friend class InputIterator; | 295 friend class InputIterator; |
| 283 virtual int InputCount() = 0; | 296 virtual int InputCount() = 0; |
| 284 virtual LOperand* InputAt(int i) = 0; | 297 virtual LOperand* InputAt(int i) = 0; |
| 285 | 298 |
| 286 friend class TempIterator; | 299 friend class TempIterator; |
| 287 virtual int TempCount() = 0; | 300 virtual int TempCount() = 0; |
| 288 virtual LOperand* TempAt(int i) = 0; | 301 virtual LOperand* TempAt(int i) = 0; |
| 289 | 302 |
| 303 class IsCallBits: public BitField<bool, 0, 1> {}; |
| 304 class PositionBits: public BitField<int, 1, 31> {}; |
| 305 |
| 290 LEnvironment* environment_; | 306 LEnvironment* environment_; |
| 291 SetOncePointer<LPointerMap> pointer_map_; | 307 SetOncePointer<LPointerMap> pointer_map_; |
| 292 HValue* hydrogen_value_; | 308 HValue* hydrogen_value_; |
| 293 bool is_call_; | 309 int bit_field_; |
| 294 }; | 310 }; |
| 295 | 311 |
| 296 | 312 |
| 297 // R = number of result operands (0 or 1). | 313 // R = number of result operands (0 or 1). |
| 298 // I = number of input operands. | 314 // I = number of input operands. |
| 299 // T = number of temporary operands. | 315 // T = number of temporary operands. |
| 300 template<int R, int I, int T> | 316 template<int R, int I, int T> |
| 301 class LTemplateInstruction: public LInstruction { | 317 class LTemplateInstruction: public LInstruction { |
| 302 public: | 318 public: |
| 303 // Allow 0 or 1 output operands. | 319 // Allow 0 or 1 output operands. |
| (...skipping 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2758 | 2774 |
| 2759 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2775 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2760 }; | 2776 }; |
| 2761 | 2777 |
| 2762 #undef DECLARE_HYDROGEN_ACCESSOR | 2778 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2763 #undef DECLARE_CONCRETE_INSTRUCTION | 2779 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2764 | 2780 |
| 2765 } } // namespace v8::internal | 2781 } } // namespace v8::internal |
| 2766 | 2782 |
| 2767 #endif // V8_ARM_LITHIUM_ARM_H_ | 2783 #endif // V8_ARM_LITHIUM_ARM_H_ |
| OLD | NEW |