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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 return H##type::cast(hydrogen_value()); \ | 207 return H##type::cast(hydrogen_value()); \ |
208 } | 208 } |
209 | 209 |
210 | 210 |
211 class LInstruction : public ZoneObject { | 211 class LInstruction : public ZoneObject { |
212 public: | 212 public: |
213 LInstruction() | 213 LInstruction() |
214 : environment_(NULL), | 214 : environment_(NULL), |
215 hydrogen_value_(NULL), | 215 hydrogen_value_(NULL), |
216 bit_field_(IsCallBits::encode(false)) { | 216 bit_field_(IsCallBits::encode(false)) { |
217 set_position(RelocInfo::kNoPosition); | |
218 } | 217 } |
219 | 218 |
220 virtual ~LInstruction() {} | 219 virtual ~LInstruction() {} |
221 | 220 |
222 virtual void CompileToNative(LCodeGen* generator) = 0; | 221 virtual void CompileToNative(LCodeGen* generator) = 0; |
223 virtual const char* Mnemonic() const = 0; | 222 virtual const char* Mnemonic() const = 0; |
224 virtual void PrintTo(StringStream* stream); | 223 virtual void PrintTo(StringStream* stream); |
225 virtual void PrintDataTo(StringStream* stream); | 224 virtual void PrintDataTo(StringStream* stream); |
226 virtual void PrintOutputOperandTo(StringStream* stream); | 225 virtual void PrintOutputOperandTo(StringStream* stream); |
227 | 226 |
(...skipping 20 matching lines...) Expand all Loading... |
248 virtual bool IsControl() const { return false; } | 247 virtual bool IsControl() const { return false; } |
249 | 248 |
250 void set_environment(LEnvironment* env) { environment_ = env; } | 249 void set_environment(LEnvironment* env) { environment_ = env; } |
251 LEnvironment* environment() const { return environment_; } | 250 LEnvironment* environment() const { return environment_; } |
252 bool HasEnvironment() const { return environment_ != NULL; } | 251 bool HasEnvironment() const { return environment_ != NULL; } |
253 | 252 |
254 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 253 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
255 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 254 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
256 bool HasPointerMap() const { return pointer_map_.is_set(); } | 255 bool HasPointerMap() const { return pointer_map_.is_set(); } |
257 | 256 |
258 // The 31 bits PositionBits is used to store the int position value. And the | |
259 // position value may be RelocInfo::kNoPosition (-1). The accessor always | |
260 // +1/-1 so that the encoded value of position in bit_field_ is always >= 0 | |
261 // and can fit into the 31 bits PositionBits. | |
262 void set_position(int pos) { | |
263 bit_field_ = PositionBits::update(bit_field_, pos + 1); | |
264 } | |
265 int position() { return PositionBits::decode(bit_field_) - 1; } | |
266 | |
267 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 257 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
268 HValue* hydrogen_value() const { return hydrogen_value_; } | 258 HValue* hydrogen_value() const { return hydrogen_value_; } |
269 | 259 |
270 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } | 260 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
271 | 261 |
272 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } | 262 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } |
273 bool IsCall() const { return IsCallBits::decode(bit_field_); } | 263 bool IsCall() const { return IsCallBits::decode(bit_field_); } |
274 | 264 |
275 // Interface to the register allocator and iterators. | 265 // Interface to the register allocator and iterators. |
276 bool ClobbersTemps() const { return IsCall(); } | 266 bool ClobbersTemps() const { return IsCall(); } |
(...skipping 25 matching lines...) Expand all Loading... |
302 // Iterator support. | 292 // Iterator support. |
303 friend class InputIterator; | 293 friend class InputIterator; |
304 virtual int InputCount() = 0; | 294 virtual int InputCount() = 0; |
305 virtual LOperand* InputAt(int i) = 0; | 295 virtual LOperand* InputAt(int i) = 0; |
306 | 296 |
307 friend class TempIterator; | 297 friend class TempIterator; |
308 virtual int TempCount() = 0; | 298 virtual int TempCount() = 0; |
309 virtual LOperand* TempAt(int i) = 0; | 299 virtual LOperand* TempAt(int i) = 0; |
310 | 300 |
311 class IsCallBits: public BitField<bool, 0, 1> {}; | 301 class IsCallBits: public BitField<bool, 0, 1> {}; |
312 class PositionBits: public BitField<int, 1, 31> {}; | |
313 | 302 |
314 LEnvironment* environment_; | 303 LEnvironment* environment_; |
315 SetOncePointer<LPointerMap> pointer_map_; | 304 SetOncePointer<LPointerMap> pointer_map_; |
316 HValue* hydrogen_value_; | 305 HValue* hydrogen_value_; |
317 int bit_field_; | 306 int bit_field_; |
318 }; | 307 }; |
319 | 308 |
320 | 309 |
321 // R = number of result operands (0 or 1). | 310 // R = number of result operands (0 or 1). |
322 // I = number of input operands. | 311 // I = number of input operands. |
(...skipping 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2743 : chunk_(NULL), | 2732 : chunk_(NULL), |
2744 info_(info), | 2733 info_(info), |
2745 graph_(graph), | 2734 graph_(graph), |
2746 zone_(graph->zone()), | 2735 zone_(graph->zone()), |
2747 status_(UNUSED), | 2736 status_(UNUSED), |
2748 current_instruction_(NULL), | 2737 current_instruction_(NULL), |
2749 current_block_(NULL), | 2738 current_block_(NULL), |
2750 next_block_(NULL), | 2739 next_block_(NULL), |
2751 argument_count_(0), | 2740 argument_count_(0), |
2752 allocator_(allocator), | 2741 allocator_(allocator), |
2753 position_(RelocInfo::kNoPosition), | |
2754 instruction_pending_deoptimization_environment_(NULL), | 2742 instruction_pending_deoptimization_environment_(NULL), |
2755 pending_deoptimization_ast_id_(BailoutId::None()) { } | 2743 pending_deoptimization_ast_id_(BailoutId::None()) { } |
2756 | 2744 |
2757 // Build the sequence for the graph. | 2745 // Build the sequence for the graph. |
2758 LPlatformChunk* Build(); | 2746 LPlatformChunk* Build(); |
2759 | 2747 |
2760 LInstruction* CheckElideControlInstruction(HControlInstruction* instr); | 2748 LInstruction* CheckElideControlInstruction(HControlInstruction* instr); |
2761 | 2749 |
2762 // Declare methods that deal with the individual node types. | 2750 // Declare methods that deal with the individual node types. |
2763 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | 2751 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2901 LPlatformChunk* chunk_; | 2889 LPlatformChunk* chunk_; |
2902 CompilationInfo* info_; | 2890 CompilationInfo* info_; |
2903 HGraph* const graph_; | 2891 HGraph* const graph_; |
2904 Zone* zone_; | 2892 Zone* zone_; |
2905 Status status_; | 2893 Status status_; |
2906 HInstruction* current_instruction_; | 2894 HInstruction* current_instruction_; |
2907 HBasicBlock* current_block_; | 2895 HBasicBlock* current_block_; |
2908 HBasicBlock* next_block_; | 2896 HBasicBlock* next_block_; |
2909 int argument_count_; | 2897 int argument_count_; |
2910 LAllocator* allocator_; | 2898 LAllocator* allocator_; |
2911 int position_; | |
2912 LInstruction* instruction_pending_deoptimization_environment_; | 2899 LInstruction* instruction_pending_deoptimization_environment_; |
2913 BailoutId pending_deoptimization_ast_id_; | 2900 BailoutId pending_deoptimization_ast_id_; |
2914 | 2901 |
2915 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2902 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2916 }; | 2903 }; |
2917 | 2904 |
2918 #undef DECLARE_HYDROGEN_ACCESSOR | 2905 #undef DECLARE_HYDROGEN_ACCESSOR |
2919 #undef DECLARE_CONCRETE_INSTRUCTION | 2906 #undef DECLARE_CONCRETE_INSTRUCTION |
2920 | 2907 |
2921 } } // namespace v8::internal | 2908 } } // namespace v8::internal |
2922 | 2909 |
2923 #endif // V8_IA32_LITHIUM_IA32_H_ | 2910 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |