OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_IA32_LITHIUM_IA32_H_ | 5 #ifndef V8_IA32_LITHIUM_IA32_H_ |
6 #define V8_IA32_LITHIUM_IA32_H_ | 6 #define V8_IA32_LITHIUM_IA32_H_ |
7 | 7 |
8 #include "hydrogen.h" | 8 #include "hydrogen.h" |
9 #include "lithium-allocator.h" | 9 #include "lithium-allocator.h" |
10 #include "lithium.h" | 10 #include "lithium.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 V(CallStub) \ | 38 V(CallStub) \ |
39 V(CheckInstanceType) \ | 39 V(CheckInstanceType) \ |
40 V(CheckMaps) \ | 40 V(CheckMaps) \ |
41 V(CheckMapValue) \ | 41 V(CheckMapValue) \ |
42 V(CheckNonSmi) \ | 42 V(CheckNonSmi) \ |
43 V(CheckSmi) \ | 43 V(CheckSmi) \ |
44 V(CheckValue) \ | 44 V(CheckValue) \ |
45 V(ClampDToUint8) \ | 45 V(ClampDToUint8) \ |
46 V(ClampIToUint8) \ | 46 V(ClampIToUint8) \ |
47 V(ClampTToUint8) \ | 47 V(ClampTToUint8) \ |
48 V(ClampTToUint8NoSSE2) \ | |
49 V(ClassOfTestAndBranch) \ | 48 V(ClassOfTestAndBranch) \ |
50 V(ClobberDoubles) \ | |
51 V(CompareMinusZeroAndBranch) \ | 49 V(CompareMinusZeroAndBranch) \ |
52 V(CompareNumericAndBranch) \ | 50 V(CompareNumericAndBranch) \ |
53 V(CmpObjectEqAndBranch) \ | 51 V(CmpObjectEqAndBranch) \ |
54 V(CmpHoleAndBranch) \ | 52 V(CmpHoleAndBranch) \ |
55 V(CmpMapAndBranch) \ | 53 V(CmpMapAndBranch) \ |
56 V(CmpT) \ | 54 V(CmpT) \ |
57 V(ConstantD) \ | 55 V(ConstantD) \ |
58 V(ConstantE) \ | 56 V(ConstantE) \ |
59 V(ConstantI) \ | 57 V(ConstantI) \ |
60 V(ConstantS) \ | 58 V(ConstantS) \ |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 230 |
233 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } | 231 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
234 | 232 |
235 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } | 233 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } |
236 bool IsCall() const { return IsCallBits::decode(bit_field_); } | 234 bool IsCall() const { return IsCallBits::decode(bit_field_); } |
237 | 235 |
238 // Interface to the register allocator and iterators. | 236 // Interface to the register allocator and iterators. |
239 bool ClobbersTemps() const { return IsCall(); } | 237 bool ClobbersTemps() const { return IsCall(); } |
240 bool ClobbersRegisters() const { return IsCall(); } | 238 bool ClobbersRegisters() const { return IsCall(); } |
241 virtual bool ClobbersDoubleRegisters(Isolate* isolate) const { | 239 virtual bool ClobbersDoubleRegisters(Isolate* isolate) const { |
242 return IsCall() || | 240 return IsCall(); |
243 // We only have rudimentary X87Stack tracking, thus in general | |
244 // cannot handle phi-nodes. | |
245 (!CpuFeatures::IsSafeForSnapshot(isolate, SSE2) && IsControl()); | |
246 } | 241 } |
247 | 242 |
248 virtual bool HasResult() const = 0; | 243 virtual bool HasResult() const = 0; |
249 virtual LOperand* result() const = 0; | 244 virtual LOperand* result() const = 0; |
250 | 245 |
251 bool HasDoubleRegisterResult(); | 246 bool HasDoubleRegisterResult(); |
252 bool HasDoubleRegisterInput(); | 247 bool HasDoubleRegisterInput(); |
253 bool IsDoubleInput(X87Register reg, LCodeGen* cgen); | |
254 | 248 |
255 LOperand* FirstInput() { return InputAt(0); } | 249 LOperand* FirstInput() { return InputAt(0); } |
256 LOperand* Output() { return HasResult() ? result() : NULL; } | 250 LOperand* Output() { return HasResult() ? result() : NULL; } |
257 | 251 |
258 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 252 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
259 | 253 |
260 #ifdef DEBUG | 254 #ifdef DEBUG |
261 void VerifyCall(); | 255 void VerifyCall(); |
262 #endif | 256 #endif |
263 | 257 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { } | 362 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { } |
369 | 363 |
370 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE { | 364 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE { |
371 return !IsRedundant(); | 365 return !IsRedundant(); |
372 } | 366 } |
373 | 367 |
374 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap") | 368 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap") |
375 }; | 369 }; |
376 | 370 |
377 | 371 |
378 class LClobberDoubles V8_FINAL : public LTemplateInstruction<0, 0, 0> { | |
379 public: | |
380 explicit LClobberDoubles(Isolate* isolate) { | |
381 ASSERT(!CpuFeatures::IsSafeForSnapshot(isolate, SSE2)); | |
382 } | |
383 | |
384 virtual bool ClobbersDoubleRegisters(Isolate* isolate) const V8_OVERRIDE { | |
385 return true; | |
386 } | |
387 | |
388 DECLARE_CONCRETE_INSTRUCTION(ClobberDoubles, "clobber-d") | |
389 }; | |
390 | |
391 | |
392 class LGoto V8_FINAL : public LTemplateInstruction<0, 0, 0> { | 372 class LGoto V8_FINAL : public LTemplateInstruction<0, 0, 0> { |
393 public: | 373 public: |
394 explicit LGoto(HBasicBlock* block) : block_(block) { } | 374 explicit LGoto(HBasicBlock* block) : block_(block) { } |
395 | 375 |
396 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE; | 376 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE; |
397 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") | 377 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") |
398 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 378 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
399 virtual bool IsControl() const V8_OVERRIDE { return true; } | 379 virtual bool IsControl() const V8_OVERRIDE { return true; } |
400 | 380 |
401 int block_id() const { return block_->block_id(); } | 381 int block_id() const { return block_->block_id(); } |
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2453 temps_[0] = temp_xmm; | 2433 temps_[0] = temp_xmm; |
2454 } | 2434 } |
2455 | 2435 |
2456 LOperand* unclamped() { return inputs_[0]; } | 2436 LOperand* unclamped() { return inputs_[0]; } |
2457 LOperand* temp_xmm() { return temps_[0]; } | 2437 LOperand* temp_xmm() { return temps_[0]; } |
2458 | 2438 |
2459 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8") | 2439 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8") |
2460 }; | 2440 }; |
2461 | 2441 |
2462 | 2442 |
2463 // Truncating conversion from a tagged value to an int32. | |
2464 class LClampTToUint8NoSSE2 V8_FINAL : public LTemplateInstruction<1, 1, 3> { | |
2465 public: | |
2466 LClampTToUint8NoSSE2(LOperand* unclamped, | |
2467 LOperand* temp1, | |
2468 LOperand* temp2, | |
2469 LOperand* temp3) { | |
2470 inputs_[0] = unclamped; | |
2471 temps_[0] = temp1; | |
2472 temps_[1] = temp2; | |
2473 temps_[2] = temp3; | |
2474 } | |
2475 | |
2476 LOperand* unclamped() { return inputs_[0]; } | |
2477 LOperand* scratch() { return temps_[0]; } | |
2478 LOperand* scratch2() { return temps_[1]; } | |
2479 LOperand* scratch3() { return temps_[2]; } | |
2480 | |
2481 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8NoSSE2, | |
2482 "clamp-t-to-uint8-nosse2") | |
2483 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) | |
2484 }; | |
2485 | |
2486 | |
2487 class LCheckNonSmi V8_FINAL : public LTemplateInstruction<0, 1, 0> { | 2443 class LCheckNonSmi V8_FINAL : public LTemplateInstruction<0, 1, 0> { |
2488 public: | 2444 public: |
2489 explicit LCheckNonSmi(LOperand* value) { | 2445 explicit LCheckNonSmi(LOperand* value) { |
2490 inputs_[0] = value; | 2446 inputs_[0] = value; |
2491 } | 2447 } |
2492 | 2448 |
2493 LOperand* value() { return inputs_[0]; } | 2449 LOperand* value() { return inputs_[0]; } |
2494 | 2450 |
2495 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") | 2451 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") |
2496 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject) | 2452 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject) |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2771 bool is_unused() const { return status_ == UNUSED; } | 2727 bool is_unused() const { return status_ == UNUSED; } |
2772 bool is_building() const { return status_ == BUILDING; } | 2728 bool is_building() const { return status_ == BUILDING; } |
2773 bool is_done() const { return status_ == DONE; } | 2729 bool is_done() const { return status_ == DONE; } |
2774 bool is_aborted() const { return status_ == ABORTED; } | 2730 bool is_aborted() const { return status_ == ABORTED; } |
2775 | 2731 |
2776 void Abort(BailoutReason reason); | 2732 void Abort(BailoutReason reason); |
2777 | 2733 |
2778 // Methods for getting operands for Use / Define / Temp. | 2734 // Methods for getting operands for Use / Define / Temp. |
2779 LUnallocated* ToUnallocated(Register reg); | 2735 LUnallocated* ToUnallocated(Register reg); |
2780 LUnallocated* ToUnallocated(XMMRegister reg); | 2736 LUnallocated* ToUnallocated(XMMRegister reg); |
2781 LUnallocated* ToUnallocated(X87Register reg); | |
2782 | 2737 |
2783 // Methods for setting up define-use relationships. | 2738 // Methods for setting up define-use relationships. |
2784 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); | 2739 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); |
2785 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); | 2740 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); |
2786 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, | 2741 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, |
2787 XMMRegister fixed_register); | 2742 XMMRegister fixed_register); |
2788 | 2743 |
2789 // A value that is guaranteed to be allocated to a register. | 2744 // A value that is guaranteed to be allocated to a register. |
2790 // Operand created by UseRegister is guaranteed to be live until the end of | 2745 // Operand created by UseRegister is guaranteed to be live until the end of |
2791 // instruction. This means that register allocator will not reuse it's | 2746 // instruction. This means that register allocator will not reuse it's |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2833 LInstruction* Define(LTemplateResultInstruction<1>* instr, | 2788 LInstruction* Define(LTemplateResultInstruction<1>* instr, |
2834 LUnallocated* result); | 2789 LUnallocated* result); |
2835 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr); | 2790 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr); |
2836 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr, | 2791 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr, |
2837 int index); | 2792 int index); |
2838 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr); | 2793 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr); |
2839 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr, | 2794 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr, |
2840 Register reg); | 2795 Register reg); |
2841 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr, | 2796 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr, |
2842 XMMRegister reg); | 2797 XMMRegister reg); |
2843 LInstruction* DefineX87TOS(LTemplateResultInstruction<1>* instr); | |
2844 // Assigns an environment to an instruction. An instruction which can | 2798 // Assigns an environment to an instruction. An instruction which can |
2845 // deoptimize must have an environment. | 2799 // deoptimize must have an environment. |
2846 LInstruction* AssignEnvironment(LInstruction* instr); | 2800 LInstruction* AssignEnvironment(LInstruction* instr); |
2847 // Assigns a pointer map to an instruction. An instruction which can | 2801 // Assigns a pointer map to an instruction. An instruction which can |
2848 // trigger a GC or a lazy deoptimization must have a pointer map. | 2802 // trigger a GC or a lazy deoptimization must have a pointer map. |
2849 LInstruction* AssignPointerMap(LInstruction* instr); | 2803 LInstruction* AssignPointerMap(LInstruction* instr); |
2850 | 2804 |
2851 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | 2805 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
2852 | 2806 |
2853 LOperand* GetSeqStringSetCharOperand(HSeqStringSetChar* instr); | 2807 LOperand* GetSeqStringSetCharOperand(HSeqStringSetChar* instr); |
(...skipping 28 matching lines...) Expand all Loading... |
2882 | 2836 |
2883 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2837 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2884 }; | 2838 }; |
2885 | 2839 |
2886 #undef DECLARE_HYDROGEN_ACCESSOR | 2840 #undef DECLARE_HYDROGEN_ACCESSOR |
2887 #undef DECLARE_CONCRETE_INSTRUCTION | 2841 #undef DECLARE_CONCRETE_INSTRUCTION |
2888 | 2842 |
2889 } } // namespace v8::internal | 2843 } } // namespace v8::internal |
2890 | 2844 |
2891 #endif // V8_IA32_LITHIUM_IA32_H_ | 2845 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |