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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 bit_field_(IsCallBits::encode(false)) { | 214 bit_field_(IsCallBits::encode(false)) { |
215 set_position(RelocInfo::kNoPosition); | |
216 } | 215 } |
217 | 216 |
218 virtual ~LInstruction() {} | 217 virtual ~LInstruction() {} |
219 | 218 |
220 virtual void CompileToNative(LCodeGen* generator) = 0; | 219 virtual void CompileToNative(LCodeGen* generator) = 0; |
221 virtual const char* Mnemonic() const = 0; | 220 virtual const char* Mnemonic() const = 0; |
222 virtual void PrintTo(StringStream* stream); | 221 virtual void PrintTo(StringStream* stream); |
223 virtual void PrintDataTo(StringStream* stream); | 222 virtual void PrintDataTo(StringStream* stream); |
224 virtual void PrintOutputOperandTo(StringStream* stream); | 223 virtual void PrintOutputOperandTo(StringStream* stream); |
225 | 224 |
(...skipping 20 matching lines...) Expand all Loading... |
246 virtual bool IsControl() const { return false; } | 245 virtual bool IsControl() const { return false; } |
247 | 246 |
248 void set_environment(LEnvironment* env) { environment_ = env; } | 247 void set_environment(LEnvironment* env) { environment_ = env; } |
249 LEnvironment* environment() const { return environment_; } | 248 LEnvironment* environment() const { return environment_; } |
250 bool HasEnvironment() const { return environment_ != NULL; } | 249 bool HasEnvironment() const { return environment_ != NULL; } |
251 | 250 |
252 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 251 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
253 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 252 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
254 bool HasPointerMap() const { return pointer_map_.is_set(); } | 253 bool HasPointerMap() const { return pointer_map_.is_set(); } |
255 | 254 |
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 | |
265 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 255 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
266 HValue* hydrogen_value() const { return hydrogen_value_; } | 256 HValue* hydrogen_value() const { return hydrogen_value_; } |
267 | 257 |
268 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } | 258 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
269 | 259 |
270 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } | 260 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } |
271 bool IsCall() const { return IsCallBits::decode(bit_field_); } | 261 bool IsCall() const { return IsCallBits::decode(bit_field_); } |
272 | 262 |
273 // Interface to the register allocator and iterators. | 263 // Interface to the register allocator and iterators. |
274 bool ClobbersTemps() const { return IsCall(); } | 264 bool ClobbersTemps() const { return IsCall(); } |
(...skipping 19 matching lines...) Expand all Loading... |
294 // Iterator interface. | 284 // Iterator interface. |
295 friend class InputIterator; | 285 friend class InputIterator; |
296 virtual int InputCount() = 0; | 286 virtual int InputCount() = 0; |
297 virtual LOperand* InputAt(int i) = 0; | 287 virtual LOperand* InputAt(int i) = 0; |
298 | 288 |
299 friend class TempIterator; | 289 friend class TempIterator; |
300 virtual int TempCount() = 0; | 290 virtual int TempCount() = 0; |
301 virtual LOperand* TempAt(int i) = 0; | 291 virtual LOperand* TempAt(int i) = 0; |
302 | 292 |
303 class IsCallBits: public BitField<bool, 0, 1> {}; | 293 class IsCallBits: public BitField<bool, 0, 1> {}; |
304 class PositionBits: public BitField<int, 1, 31> {}; | |
305 | 294 |
306 LEnvironment* environment_; | 295 LEnvironment* environment_; |
307 SetOncePointer<LPointerMap> pointer_map_; | 296 SetOncePointer<LPointerMap> pointer_map_; |
308 HValue* hydrogen_value_; | 297 HValue* hydrogen_value_; |
309 int bit_field_; | 298 int bit_field_; |
310 }; | 299 }; |
311 | 300 |
312 | 301 |
313 // R = number of result operands (0 or 1). | 302 // R = number of result operands (0 or 1). |
314 // I = number of input operands. | 303 // I = number of input operands. |
(...skipping 2555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 | 2859 |
2871 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2860 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2872 }; | 2861 }; |
2873 | 2862 |
2874 #undef DECLARE_HYDROGEN_ACCESSOR | 2863 #undef DECLARE_HYDROGEN_ACCESSOR |
2875 #undef DECLARE_CONCRETE_INSTRUCTION | 2864 #undef DECLARE_CONCRETE_INSTRUCTION |
2876 | 2865 |
2877 } } // namespace v8::internal | 2866 } } // namespace v8::internal |
2878 | 2867 |
2879 #endif // V8_MIPS_LITHIUM_MIPS_H_ | 2868 #endif // V8_MIPS_LITHIUM_MIPS_H_ |
OLD | NEW |