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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 H##type* hydrogen() const { \ | 197 H##type* hydrogen() const { \ |
198 return H##type::cast(hydrogen_value()); \ | 198 return H##type::cast(hydrogen_value()); \ |
199 } | 199 } |
200 | 200 |
201 | 201 |
202 class LInstruction: public ZoneObject { | 202 class LInstruction: public ZoneObject { |
203 public: | 203 public: |
204 LInstruction() | 204 LInstruction() |
205 : environment_(NULL), | 205 : environment_(NULL), |
206 hydrogen_value_(NULL), | 206 hydrogen_value_(NULL), |
207 is_call_(false), | 207 is_call_(false) { } |
208 is_save_doubles_(false) { } | |
209 virtual ~LInstruction() { } | 208 virtual ~LInstruction() { } |
210 | 209 |
211 virtual void CompileToNative(LCodeGen* generator) = 0; | 210 virtual void CompileToNative(LCodeGen* generator) = 0; |
212 virtual const char* Mnemonic() const = 0; | 211 virtual const char* Mnemonic() const = 0; |
213 virtual void PrintTo(StringStream* stream); | 212 virtual void PrintTo(StringStream* stream); |
214 virtual void PrintDataTo(StringStream* stream) = 0; | 213 virtual void PrintDataTo(StringStream* stream) = 0; |
215 virtual void PrintOutputOperandTo(StringStream* stream) = 0; | 214 virtual void PrintOutputOperandTo(StringStream* stream) = 0; |
216 | 215 |
217 enum Opcode { | 216 enum Opcode { |
218 // Declare a unique enum value for each instruction. | 217 // Declare a unique enum value for each instruction. |
(...skipping 21 matching lines...) Expand all Loading... |
240 LEnvironment* environment() const { return environment_; } | 239 LEnvironment* environment() const { return environment_; } |
241 bool HasEnvironment() const { return environment_ != NULL; } | 240 bool HasEnvironment() const { return environment_ != NULL; } |
242 | 241 |
243 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 242 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
244 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 243 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
245 bool HasPointerMap() const { return pointer_map_.is_set(); } | 244 bool HasPointerMap() const { return pointer_map_.is_set(); } |
246 | 245 |
247 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 246 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
248 HValue* hydrogen_value() const { return hydrogen_value_; } | 247 HValue* hydrogen_value() const { return hydrogen_value_; } |
249 | 248 |
250 void set_deoptimization_environment(LEnvironment* env) { | 249 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
251 deoptimization_environment_.set(env); | |
252 } | |
253 LEnvironment* deoptimization_environment() const { | |
254 return deoptimization_environment_.get(); | |
255 } | |
256 bool HasDeoptimizationEnvironment() const { | |
257 return deoptimization_environment_.is_set(); | |
258 } | |
259 | 250 |
260 void MarkAsCall() { is_call_ = true; } | 251 void MarkAsCall() { is_call_ = true; } |
261 void MarkAsSaveDoubles() { is_save_doubles_ = true; } | |
262 | 252 |
263 // Interface to the register allocator and iterators. | 253 // Interface to the register allocator and iterators. |
264 bool IsMarkedAsCall() const { return is_call_; } | 254 bool IsMarkedAsCall() const { return is_call_; } |
265 bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; } | |
266 | 255 |
267 virtual bool HasResult() const = 0; | 256 virtual bool HasResult() const = 0; |
268 virtual LOperand* result() = 0; | 257 virtual LOperand* result() = 0; |
269 | 258 |
270 virtual int InputCount() = 0; | 259 virtual int InputCount() = 0; |
271 virtual LOperand* InputAt(int i) = 0; | 260 virtual LOperand* InputAt(int i) = 0; |
272 virtual int TempCount() = 0; | 261 virtual int TempCount() = 0; |
273 virtual LOperand* TempAt(int i) = 0; | 262 virtual LOperand* TempAt(int i) = 0; |
274 | 263 |
275 LOperand* FirstInput() { return InputAt(0); } | 264 LOperand* FirstInput() { return InputAt(0); } |
276 LOperand* Output() { return HasResult() ? result() : NULL; } | 265 LOperand* Output() { return HasResult() ? result() : NULL; } |
277 | 266 |
278 #ifdef DEBUG | 267 #ifdef DEBUG |
279 void VerifyCall(); | 268 void VerifyCall(); |
280 #endif | 269 #endif |
281 | 270 |
282 private: | 271 private: |
283 LEnvironment* environment_; | 272 LEnvironment* environment_; |
284 SetOncePointer<LPointerMap> pointer_map_; | 273 SetOncePointer<LPointerMap> pointer_map_; |
285 HValue* hydrogen_value_; | 274 HValue* hydrogen_value_; |
286 SetOncePointer<LEnvironment> deoptimization_environment_; | |
287 bool is_call_; | 275 bool is_call_; |
288 bool is_save_doubles_; | |
289 }; | 276 }; |
290 | 277 |
291 | 278 |
292 // R = number of result operands (0 or 1). | 279 // R = number of result operands (0 or 1). |
293 // I = number of input operands. | 280 // I = number of input operands. |
294 // T = number of temporary operands. | 281 // T = number of temporary operands. |
295 template<int R, int I, int T> | 282 template<int R, int I, int T> |
296 class LTemplateInstruction: public LInstruction { | 283 class LTemplateInstruction: public LInstruction { |
297 public: | 284 public: |
298 // Allow 0 or 1 output operands. | 285 // Allow 0 or 1 output operands. |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) { | 814 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) { |
828 inputs_[0] = value; | 815 inputs_[0] = value; |
829 temps_[0] = temp; | 816 temps_[0] = temp; |
830 } | 817 } |
831 | 818 |
832 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, | 819 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, |
833 "instance-of-known-global") | 820 "instance-of-known-global") |
834 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) | 821 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) |
835 | 822 |
836 Handle<JSFunction> function() const { return hydrogen()->function(); } | 823 Handle<JSFunction> function() const { return hydrogen()->function(); } |
| 824 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() { |
| 825 return lazy_deopt_env_; |
| 826 } |
| 827 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { |
| 828 lazy_deopt_env_ = env; |
| 829 } |
| 830 |
| 831 private: |
| 832 LEnvironment* lazy_deopt_env_; |
837 }; | 833 }; |
838 | 834 |
839 | 835 |
840 class LBoundsCheck: public LTemplateInstruction<0, 2, 0> { | 836 class LBoundsCheck: public LTemplateInstruction<0, 2, 0> { |
841 public: | 837 public: |
842 LBoundsCheck(LOperand* index, LOperand* length) { | 838 LBoundsCheck(LOperand* index, LOperand* length) { |
843 inputs_[0] = index; | 839 inputs_[0] = index; |
844 inputs_[1] = length; | 840 inputs_[1] = length; |
845 } | 841 } |
846 | 842 |
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 | 2373 |
2378 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2374 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
2379 | 2375 |
2380 // By default we assume that instruction sequences generated for calls | 2376 // By default we assume that instruction sequences generated for calls |
2381 // cannot deoptimize eagerly and we do not attach environment to this | 2377 // cannot deoptimize eagerly and we do not attach environment to this |
2382 // instruction. | 2378 // instruction. |
2383 LInstruction* MarkAsCall( | 2379 LInstruction* MarkAsCall( |
2384 LInstruction* instr, | 2380 LInstruction* instr, |
2385 HInstruction* hinstr, | 2381 HInstruction* hinstr, |
2386 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); | 2382 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); |
2387 LInstruction* MarkAsSaveDoubles(LInstruction* instr); | |
2388 | |
2389 LInstruction* SetInstructionPendingDeoptimizationEnvironment( | |
2390 LInstruction* instr, int ast_id); | |
2391 void ClearInstructionPendingDeoptimizationEnvironment(); | |
2392 | 2383 |
2393 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env, | 2384 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env, |
2394 int* argument_index_accumulator); | 2385 int* argument_index_accumulator); |
2395 | 2386 |
2396 void VisitInstruction(HInstruction* current); | 2387 void VisitInstruction(HInstruction* current); |
2397 | 2388 |
2398 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); | 2389 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); |
2399 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); | 2390 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); |
2400 LInstruction* DoArithmeticD(Token::Value op, | 2391 LInstruction* DoArithmeticD(Token::Value op, |
2401 HArithmeticBinaryOperation* instr); | 2392 HArithmeticBinaryOperation* instr); |
(...skipping 16 matching lines...) Expand all Loading... |
2418 | 2409 |
2419 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2410 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2420 }; | 2411 }; |
2421 | 2412 |
2422 #undef DECLARE_HYDROGEN_ACCESSOR | 2413 #undef DECLARE_HYDROGEN_ACCESSOR |
2423 #undef DECLARE_CONCRETE_INSTRUCTION | 2414 #undef DECLARE_CONCRETE_INSTRUCTION |
2424 | 2415 |
2425 } } // namespace v8::internal | 2416 } } // namespace v8::internal |
2426 | 2417 |
2427 #endif // V8_ARM_LITHIUM_ARM_H_ | 2418 #endif // V8_ARM_LITHIUM_ARM_H_ |
OLD | NEW |