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