| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 H##type* hydrogen() const { \ | 196 H##type* hydrogen() const { \ |
| 197 return H##type::cast(hydrogen_value()); \ | 197 return H##type::cast(hydrogen_value()); \ |
| 198 } | 198 } |
| 199 | 199 |
| 200 | 200 |
| 201 class LInstruction: public ZoneObject { | 201 class LInstruction: public ZoneObject { |
| 202 public: | 202 public: |
| 203 LInstruction() | 203 LInstruction() |
| 204 : environment_(NULL), | 204 : environment_(NULL), |
| 205 hydrogen_value_(NULL), | 205 hydrogen_value_(NULL), |
| 206 is_call_(false), | 206 is_call_(false) { } |
| 207 is_save_doubles_(false) { } | |
| 208 virtual ~LInstruction() { } | 207 virtual ~LInstruction() { } |
| 209 | 208 |
| 210 virtual void CompileToNative(LCodeGen* generator) = 0; | 209 virtual void CompileToNative(LCodeGen* generator) = 0; |
| 211 virtual const char* Mnemonic() const = 0; | 210 virtual const char* Mnemonic() const = 0; |
| 212 virtual void PrintTo(StringStream* stream); | 211 virtual void PrintTo(StringStream* stream); |
| 213 virtual void PrintDataTo(StringStream* stream) = 0; | 212 virtual void PrintDataTo(StringStream* stream) = 0; |
| 214 virtual void PrintOutputOperandTo(StringStream* stream) = 0; | 213 virtual void PrintOutputOperandTo(StringStream* stream) = 0; |
| 215 | 214 |
| 216 enum Opcode { | 215 enum Opcode { |
| 217 // Declare a unique enum value for each instruction. | 216 // Declare a unique enum value for each instruction. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 239 LEnvironment* environment() const { return environment_; } | 238 LEnvironment* environment() const { return environment_; } |
| 240 bool HasEnvironment() const { return environment_ != NULL; } | 239 bool HasEnvironment() const { return environment_ != NULL; } |
| 241 | 240 |
| 242 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | 241 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
| 243 LPointerMap* pointer_map() const { return pointer_map_.get(); } | 242 LPointerMap* pointer_map() const { return pointer_map_.get(); } |
| 244 bool HasPointerMap() const { return pointer_map_.is_set(); } | 243 bool HasPointerMap() const { return pointer_map_.is_set(); } |
| 245 | 244 |
| 246 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | 245 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
| 247 HValue* hydrogen_value() const { return hydrogen_value_; } | 246 HValue* hydrogen_value() const { return hydrogen_value_; } |
| 248 | 247 |
| 249 void set_deoptimization_environment(LEnvironment* env) { | 248 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
| 250 deoptimization_environment_.set(env); | |
| 251 } | |
| 252 LEnvironment* deoptimization_environment() const { | |
| 253 return deoptimization_environment_.get(); | |
| 254 } | |
| 255 bool HasDeoptimizationEnvironment() const { | |
| 256 return deoptimization_environment_.is_set(); | |
| 257 } | |
| 258 | 249 |
| 259 void MarkAsCall() { is_call_ = true; } | 250 void MarkAsCall() { is_call_ = true; } |
| 260 void MarkAsSaveDoubles() { is_save_doubles_ = true; } | |
| 261 | 251 |
| 262 // Interface to the register allocator and iterators. | 252 // Interface to the register allocator and iterators. |
| 263 bool IsMarkedAsCall() const { return is_call_; } | 253 bool IsMarkedAsCall() const { return is_call_; } |
| 264 bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; } | |
| 265 | 254 |
| 266 virtual bool HasResult() const = 0; | 255 virtual bool HasResult() const = 0; |
| 267 virtual LOperand* result() = 0; | 256 virtual LOperand* result() = 0; |
| 268 | 257 |
| 269 virtual int InputCount() = 0; | 258 virtual int InputCount() = 0; |
| 270 virtual LOperand* InputAt(int i) = 0; | 259 virtual LOperand* InputAt(int i) = 0; |
| 271 virtual int TempCount() = 0; | 260 virtual int TempCount() = 0; |
| 272 virtual LOperand* TempAt(int i) = 0; | 261 virtual LOperand* TempAt(int i) = 0; |
| 273 | 262 |
| 274 LOperand* FirstInput() { return InputAt(0); } | 263 LOperand* FirstInput() { return InputAt(0); } |
| 275 LOperand* Output() { return HasResult() ? result() : NULL; } | 264 LOperand* Output() { return HasResult() ? result() : NULL; } |
| 276 | 265 |
| 277 #ifdef DEBUG | 266 #ifdef DEBUG |
| 278 void VerifyCall(); | 267 void VerifyCall(); |
| 279 #endif | 268 #endif |
| 280 | 269 |
| 281 private: | 270 private: |
| 282 LEnvironment* environment_; | 271 LEnvironment* environment_; |
| 283 SetOncePointer<LPointerMap> pointer_map_; | 272 SetOncePointer<LPointerMap> pointer_map_; |
| 284 HValue* hydrogen_value_; | 273 HValue* hydrogen_value_; |
| 285 SetOncePointer<LEnvironment> deoptimization_environment_; | |
| 286 bool is_call_; | 274 bool is_call_; |
| 287 bool is_save_doubles_; | 275 bool is_save_doubles_; |
| 288 }; | 276 }; |
| 289 | 277 |
| 290 | 278 |
| 291 // R = number of result operands (0 or 1). | 279 // R = number of result operands (0 or 1). |
| 292 // I = number of input operands. | 280 // I = number of input operands. |
| 293 // T = number of temporary operands. | 281 // T = number of temporary operands. |
| 294 template<int R, int I, int T> | 282 template<int R, int I, int T> |
| 295 class LTemplateInstruction: public LInstruction { | 283 class LTemplateInstruction: public LInstruction { |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) { | 814 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) { |
| 827 inputs_[0] = value; | 815 inputs_[0] = value; |
| 828 temps_[0] = temp; | 816 temps_[0] = temp; |
| 829 } | 817 } |
| 830 | 818 |
| 831 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, | 819 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, |
| 832 "instance-of-known-global") | 820 "instance-of-known-global") |
| 833 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) | 821 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) |
| 834 | 822 |
| 835 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_; |
| 836 }; | 833 }; |
| 837 | 834 |
| 838 | 835 |
| 839 class LBoundsCheck: public LTemplateInstruction<0, 2, 0> { | 836 class LBoundsCheck: public LTemplateInstruction<0, 2, 0> { |
| 840 public: | 837 public: |
| 841 LBoundsCheck(LOperand* index, LOperand* length) { | 838 LBoundsCheck(LOperand* index, LOperand* length) { |
| 842 inputs_[0] = index; | 839 inputs_[0] = index; |
| 843 inputs_[1] = length; | 840 inputs_[1] = length; |
| 844 } | 841 } |
| 845 | 842 |
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2355 | 2352 |
| 2356 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2353 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2357 | 2354 |
| 2358 // By default we assume that instruction sequences generated for calls | 2355 // By default we assume that instruction sequences generated for calls |
| 2359 // cannot deoptimize eagerly and we do not attach environment to this | 2356 // cannot deoptimize eagerly and we do not attach environment to this |
| 2360 // instruction. | 2357 // instruction. |
| 2361 LInstruction* MarkAsCall( | 2358 LInstruction* MarkAsCall( |
| 2362 LInstruction* instr, | 2359 LInstruction* instr, |
| 2363 HInstruction* hinstr, | 2360 HInstruction* hinstr, |
| 2364 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); | 2361 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); |
| 2365 LInstruction* MarkAsSaveDoubles(LInstruction* instr); | |
| 2366 | |
| 2367 LInstruction* SetInstructionPendingDeoptimizationEnvironment( | |
| 2368 LInstruction* instr, int ast_id); | |
| 2369 void ClearInstructionPendingDeoptimizationEnvironment(); | |
| 2370 | 2362 |
| 2371 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env, | 2363 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env, |
| 2372 int* argument_index_accumulator); | 2364 int* argument_index_accumulator); |
| 2373 | 2365 |
| 2374 void VisitInstruction(HInstruction* current); | 2366 void VisitInstruction(HInstruction* current); |
| 2375 | 2367 |
| 2376 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); | 2368 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); |
| 2377 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); | 2369 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); |
| 2378 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); | 2370 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); |
| 2379 LInstruction* DoArithmeticD(Token::Value op, | 2371 LInstruction* DoArithmeticD(Token::Value op, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2397 | 2389 |
| 2398 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2390 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2399 }; | 2391 }; |
| 2400 | 2392 |
| 2401 #undef DECLARE_HYDROGEN_ACCESSOR | 2393 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2402 #undef DECLARE_CONCRETE_INSTRUCTION | 2394 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2403 | 2395 |
| 2404 } } // namespace v8::internal | 2396 } } // namespace v8::internal |
| 2405 | 2397 |
| 2406 #endif // V8_MIPS_LITHIUM_MIPS_H_ | 2398 #endif // V8_MIPS_LITHIUM_MIPS_H_ |
| OLD | NEW |