| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 H##type* hydrogen() const { \ | 192 H##type* hydrogen() const { \ |
| 193 return H##type::cast(hydrogen_value()); \ | 193 return H##type::cast(hydrogen_value()); \ |
| 194 } | 194 } |
| 195 | 195 |
| 196 | 196 |
| 197 class LInstruction: public ZoneObject { | 197 class LInstruction: public ZoneObject { |
| 198 public: | 198 public: |
| 199 LInstruction() | 199 LInstruction() |
| 200 : environment_(NULL), | 200 : environment_(NULL), |
| 201 hydrogen_value_(NULL), | 201 hydrogen_value_(NULL), |
| 202 is_call_(false), | 202 is_call_(false) { } |
| 203 is_save_doubles_(false) { } | |
| 204 virtual ~LInstruction() { } | 203 virtual ~LInstruction() { } |
| 205 | 204 |
| 206 virtual void CompileToNative(LCodeGen* generator) = 0; | 205 virtual void CompileToNative(LCodeGen* generator) = 0; |
| 207 virtual const char* Mnemonic() const = 0; | 206 virtual const char* Mnemonic() const = 0; |
| 208 virtual void PrintTo(StringStream* stream); | 207 virtual void PrintTo(StringStream* stream); |
| 209 virtual void PrintDataTo(StringStream* stream); | 208 virtual void PrintDataTo(StringStream* stream); |
| 210 virtual void PrintOutputOperandTo(StringStream* stream); | 209 virtual void PrintOutputOperandTo(StringStream* stream); |
| 211 | 210 |
| 212 enum Opcode { | 211 enum Opcode { |
| 213 // Declare a unique enum value for each instruction. | 212 // Declare a unique enum value for each instruction. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 236 bool HasEnvironment() const { return environment_ != NULL; } | 235 bool HasEnvironment() const { return environment_ != NULL; } |
| 237 | 236 |
| 238 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 237 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
| 239 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 238 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
| 240 bool HasPointerMap() const { return pointer_map_.is_set(); } | 239 bool HasPointerMap() const { return pointer_map_.is_set(); } |
| 241 | 240 |
| 242 | 241 |
| 243 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 242 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
| 244 HValue* hydrogen_value() const { return hydrogen_value_; } | 243 HValue* hydrogen_value() const { return hydrogen_value_; } |
| 245 | 244 |
| 246 void set_deoptimization_environment(LEnvironment* env) { | 245 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
| 247 deoptimization_environment_.set(env); | |
| 248 } | |
| 249 LEnvironment* deoptimization_environment() const { | |
| 250 return deoptimization_environment_.get(); | |
| 251 } | |
| 252 bool HasDeoptimizationEnvironment() const { | |
| 253 return deoptimization_environment_.is_set(); | |
| 254 } | |
| 255 | 246 |
| 256 void MarkAsCall() { is_call_ = true; } | 247 void MarkAsCall() { is_call_ = true; } |
| 257 void MarkAsSaveDoubles() { is_save_doubles_ = true; } | |
| 258 | 248 |
| 259 // Interface to the register allocator and iterators. | 249 // Interface to the register allocator and iterators. |
| 260 bool IsMarkedAsCall() const { return is_call_; } | 250 bool IsMarkedAsCall() const { return is_call_; } |
| 261 bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; } | |
| 262 | 251 |
| 263 virtual bool HasResult() const = 0; | 252 virtual bool HasResult() const = 0; |
| 264 virtual LOperand* result() = 0; | 253 virtual LOperand* result() = 0; |
| 265 | 254 |
| 266 virtual int InputCount() = 0; | 255 virtual int InputCount() = 0; |
| 267 virtual LOperand* InputAt(int i) = 0; | 256 virtual LOperand* InputAt(int i) = 0; |
| 268 virtual int TempCount() = 0; | 257 virtual int TempCount() = 0; |
| 269 virtual LOperand* TempAt(int i) = 0; | 258 virtual LOperand* TempAt(int i) = 0; |
| 270 | 259 |
| 271 LOperand* FirstInput() { return InputAt(0); } | 260 LOperand* FirstInput() { return InputAt(0); } |
| 272 LOperand* Output() { return HasResult() ? result() : NULL; } | 261 LOperand* Output() { return HasResult() ? result() : NULL; } |
| 273 | 262 |
| 274 #ifdef DEBUG | 263 #ifdef DEBUG |
| 275 void VerifyCall(); | 264 void VerifyCall(); |
| 276 #endif | 265 #endif |
| 277 | 266 |
| 278 private: | 267 private: |
| 279 LEnvironment* environment_; | 268 LEnvironment* environment_; |
| 280 SetOncePointer<LPointerMap> pointer_map_; | 269 SetOncePointer<LPointerMap> pointer_map_; |
| 281 HValue* hydrogen_value_; | 270 HValue* hydrogen_value_; |
| 282 SetOncePointer<LEnvironment> deoptimization_environment_; | |
| 283 bool is_call_; | 271 bool is_call_; |
| 284 bool is_save_doubles_; | |
| 285 }; | 272 }; |
| 286 | 273 |
| 287 | 274 |
| 288 // R = number of result operands (0 or 1). | 275 // R = number of result operands (0 or 1). |
| 289 // I = number of input operands. | 276 // I = number of input operands. |
| 290 // T = number of temporary operands. | 277 // T = number of temporary operands. |
| 291 template<int R, int I, int T> | 278 template<int R, int I, int T> |
| 292 class LTemplateInstruction: public LInstruction { | 279 class LTemplateInstruction: public LInstruction { |
| 293 public: | 280 public: |
| 294 // Allow 0 or 1 output operands. | 281 // Allow 0 or 1 output operands. |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 inputs_[0] = context; | 824 inputs_[0] = context; |
| 838 inputs_[1] = value; | 825 inputs_[1] = value; |
| 839 temps_[0] = temp; | 826 temps_[0] = temp; |
| 840 } | 827 } |
| 841 | 828 |
| 842 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, | 829 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, |
| 843 "instance-of-known-global") | 830 "instance-of-known-global") |
| 844 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) | 831 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) |
| 845 | 832 |
| 846 Handle<JSFunction> function() const { return hydrogen()->function(); } | 833 Handle<JSFunction> function() const { return hydrogen()->function(); } |
| 834 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() { |
| 835 return lazy_deopt_env_; |
| 836 } |
| 837 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { |
| 838 lazy_deopt_env_ = env; |
| 839 } |
| 840 |
| 841 private: |
| 842 LEnvironment* lazy_deopt_env_; |
| 847 }; | 843 }; |
| 848 | 844 |
| 849 | 845 |
| 850 class LBoundsCheck: public LTemplateInstruction<0, 2, 0> { | 846 class LBoundsCheck: public LTemplateInstruction<0, 2, 0> { |
| 851 public: | 847 public: |
| 852 LBoundsCheck(LOperand* index, LOperand* length) { | 848 LBoundsCheck(LOperand* index, LOperand* length) { |
| 853 inputs_[0] = index; | 849 inputs_[0] = index; |
| 854 inputs_[1] = length; | 850 inputs_[1] = length; |
| 855 } | 851 } |
| 856 | 852 |
| (...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 | 2475 |
| 2480 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2476 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2481 | 2477 |
| 2482 // Marks a call for the register allocator. Assigns a pointer map to | 2478 // Marks a call for the register allocator. Assigns a pointer map to |
| 2483 // support GC and lazy deoptimization. Assigns an environment to support | 2479 // support GC and lazy deoptimization. Assigns an environment to support |
| 2484 // eager deoptimization if CAN_DEOPTIMIZE_EAGERLY. | 2480 // eager deoptimization if CAN_DEOPTIMIZE_EAGERLY. |
| 2485 LInstruction* MarkAsCall( | 2481 LInstruction* MarkAsCall( |
| 2486 LInstruction* instr, | 2482 LInstruction* instr, |
| 2487 HInstruction* hinstr, | 2483 HInstruction* hinstr, |
| 2488 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); | 2484 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); |
| 2489 LInstruction* MarkAsSaveDoubles(LInstruction* instr); | |
| 2490 | |
| 2491 LInstruction* SetInstructionPendingDeoptimizationEnvironment( | |
| 2492 LInstruction* instr, int ast_id); | |
| 2493 void ClearInstructionPendingDeoptimizationEnvironment(); | |
| 2494 | 2485 |
| 2495 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env, | 2486 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env, |
| 2496 int* argument_index_accumulator); | 2487 int* argument_index_accumulator); |
| 2497 | 2488 |
| 2498 void VisitInstruction(HInstruction* current); | 2489 void VisitInstruction(HInstruction* current); |
| 2499 | 2490 |
| 2500 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); | 2491 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); |
| 2501 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); | 2492 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); |
| 2502 LInstruction* DoArithmeticD(Token::Value op, | 2493 LInstruction* DoArithmeticD(Token::Value op, |
| 2503 HArithmeticBinaryOperation* instr); | 2494 HArithmeticBinaryOperation* instr); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2520 | 2511 |
| 2521 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2512 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2522 }; | 2513 }; |
| 2523 | 2514 |
| 2524 #undef DECLARE_HYDROGEN_ACCESSOR | 2515 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2525 #undef DECLARE_CONCRETE_INSTRUCTION | 2516 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2526 | 2517 |
| 2527 } } // namespace v8::internal | 2518 } } // namespace v8::internal |
| 2528 | 2519 |
| 2529 #endif // V8_IA32_LITHIUM_IA32_H_ | 2520 #endif // V8_IA32_LITHIUM_IA32_H_ |
| OLD | NEW |