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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 | 42 |
43 static SaveFPRegsMode GetSaveFPRegsMode() { | 43 static SaveFPRegsMode GetSaveFPRegsMode() { |
44 // We don't need to save floating point regs when generating the snapshot | 44 // We don't need to save floating point regs when generating the snapshot |
45 return CpuFeatures::IsSafeForSnapshot(SSE2) ? kSaveFPRegs : kDontSaveFPRegs; | 45 return CpuFeatures::IsSafeForSnapshot(SSE2) ? kSaveFPRegs : kDontSaveFPRegs; |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 // When invoking builtins, we need to record the safepoint in the middle of | 49 // When invoking builtins, we need to record the safepoint in the middle of |
50 // the invoke instruction sequence generated by the macro assembler. | 50 // the invoke instruction sequence generated by the macro assembler. |
51 class SafepointGenerator : public CallWrapper { | 51 class SafepointGenerator V8_FINAL : public CallWrapper { |
52 public: | 52 public: |
53 SafepointGenerator(LCodeGen* codegen, | 53 SafepointGenerator(LCodeGen* codegen, |
54 LPointerMap* pointers, | 54 LPointerMap* pointers, |
55 Safepoint::DeoptMode mode) | 55 Safepoint::DeoptMode mode) |
56 : codegen_(codegen), | 56 : codegen_(codegen), |
57 pointers_(pointers), | 57 pointers_(pointers), |
58 deopt_mode_(mode) {} | 58 deopt_mode_(mode) {} |
59 virtual ~SafepointGenerator() { } | 59 virtual ~SafepointGenerator() {} |
60 | 60 |
61 virtual void BeforeCall(int call_size) const {} | 61 virtual void BeforeCall(int call_size) const V8_OVERRIDE {} |
62 | 62 |
63 virtual void AfterCall() const { | 63 virtual void AfterCall() const V8_OVERRIDE { |
64 codegen_->RecordSafepoint(pointers_, deopt_mode_); | 64 codegen_->RecordSafepoint(pointers_, deopt_mode_); |
65 } | 65 } |
66 | 66 |
67 private: | 67 private: |
68 LCodeGen* codegen_; | 68 LCodeGen* codegen_; |
69 LPointerMap* pointers_; | 69 LPointerMap* pointers_; |
70 Safepoint::DeoptMode deopt_mode_; | 70 Safepoint::DeoptMode deopt_mode_; |
71 }; | 71 }; |
72 | 72 |
73 | 73 |
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2809 __ j(zero, &true_value, Label::kNear); | 2809 __ j(zero, &true_value, Label::kNear); |
2810 __ mov(ToRegister(instr->result()), factory()->false_value()); | 2810 __ mov(ToRegister(instr->result()), factory()->false_value()); |
2811 __ jmp(&done, Label::kNear); | 2811 __ jmp(&done, Label::kNear); |
2812 __ bind(&true_value); | 2812 __ bind(&true_value); |
2813 __ mov(ToRegister(instr->result()), factory()->true_value()); | 2813 __ mov(ToRegister(instr->result()), factory()->true_value()); |
2814 __ bind(&done); | 2814 __ bind(&done); |
2815 } | 2815 } |
2816 | 2816 |
2817 | 2817 |
2818 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2818 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
2819 class DeferredInstanceOfKnownGlobal: public LDeferredCode { | 2819 class DeferredInstanceOfKnownGlobal V8_FINAL : public LDeferredCode { |
2820 public: | 2820 public: |
2821 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2821 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
2822 LInstanceOfKnownGlobal* instr) | 2822 LInstanceOfKnownGlobal* instr) |
2823 : LDeferredCode(codegen), instr_(instr) { } | 2823 : LDeferredCode(codegen), instr_(instr) { } |
2824 virtual void Generate() { | 2824 virtual void Generate() V8_OVERRIDE { |
2825 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2825 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
2826 } | 2826 } |
2827 virtual LInstruction* instr() { return instr_; } | 2827 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
2828 Label* map_check() { return &map_check_; } | 2828 Label* map_check() { return &map_check_; } |
2829 private: | 2829 private: |
2830 LInstanceOfKnownGlobal* instr_; | 2830 LInstanceOfKnownGlobal* instr_; |
2831 Label map_check_; | 2831 Label map_check_; |
2832 }; | 2832 }; |
2833 | 2833 |
2834 DeferredInstanceOfKnownGlobal* deferred; | 2834 DeferredInstanceOfKnownGlobal* deferred; |
2835 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); | 2835 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); |
2836 | 2836 |
2837 Label done, false_result; | 2837 Label done, false_result; |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3777 Label is_positive; | 3777 Label is_positive; |
3778 __ j(not_sign, &is_positive, Label::kNear); | 3778 __ j(not_sign, &is_positive, Label::kNear); |
3779 __ neg(input_reg); // Sets flags. | 3779 __ neg(input_reg); // Sets flags. |
3780 DeoptimizeIf(negative, instr->environment()); | 3780 DeoptimizeIf(negative, instr->environment()); |
3781 __ bind(&is_positive); | 3781 __ bind(&is_positive); |
3782 } | 3782 } |
3783 | 3783 |
3784 | 3784 |
3785 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3785 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
3786 // Class for deferred case. | 3786 // Class for deferred case. |
3787 class DeferredMathAbsTaggedHeapNumber: public LDeferredCode { | 3787 class DeferredMathAbsTaggedHeapNumber V8_FINAL : public LDeferredCode { |
3788 public: | 3788 public: |
3789 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) | 3789 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) |
3790 : LDeferredCode(codegen), instr_(instr) { } | 3790 : LDeferredCode(codegen), instr_(instr) { } |
3791 virtual void Generate() { | 3791 virtual void Generate() V8_OVERRIDE { |
3792 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3792 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
3793 } | 3793 } |
3794 virtual LInstruction* instr() { return instr_; } | 3794 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
3795 private: | 3795 private: |
3796 LMathAbs* instr_; | 3796 LMathAbs* instr_; |
3797 }; | 3797 }; |
3798 | 3798 |
3799 ASSERT(instr->value()->Equals(instr->result())); | 3799 ASSERT(instr->value()->Equals(instr->result())); |
3800 Representation r = instr->hydrogen()->value()->representation(); | 3800 Representation r = instr->hydrogen()->value()->representation(); |
3801 | 3801 |
3802 CpuFeatureScope scope(masm(), SSE2); | 3802 CpuFeatureScope scope(masm(), SSE2); |
3803 if (r.IsDouble()) { | 3803 if (r.IsDouble()) { |
3804 XMMRegister scratch = xmm0; | 3804 XMMRegister scratch = xmm0; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4017 __ CallStub(&stub); | 4017 __ CallStub(&stub); |
4018 } else { | 4018 } else { |
4019 ASSERT(exponent_type.IsDouble()); | 4019 ASSERT(exponent_type.IsDouble()); |
4020 MathPowStub stub(MathPowStub::DOUBLE); | 4020 MathPowStub stub(MathPowStub::DOUBLE); |
4021 __ CallStub(&stub); | 4021 __ CallStub(&stub); |
4022 } | 4022 } |
4023 } | 4023 } |
4024 | 4024 |
4025 | 4025 |
4026 void LCodeGen::DoRandom(LRandom* instr) { | 4026 void LCodeGen::DoRandom(LRandom* instr) { |
4027 class DeferredDoRandom: public LDeferredCode { | 4027 class DeferredDoRandom V8_FINAL : public LDeferredCode { |
4028 public: | 4028 public: |
4029 DeferredDoRandom(LCodeGen* codegen, LRandom* instr) | 4029 DeferredDoRandom(LCodeGen* codegen, LRandom* instr) |
4030 : LDeferredCode(codegen), instr_(instr) { } | 4030 : LDeferredCode(codegen), instr_(instr) { } |
4031 virtual void Generate() { codegen()->DoDeferredRandom(instr_); } | 4031 virtual void Generate() V8_OVERRIDE { codegen()->DoDeferredRandom(instr_); } |
4032 virtual LInstruction* instr() { return instr_; } | 4032 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4033 private: | 4033 private: |
4034 LRandom* instr_; | 4034 LRandom* instr_; |
4035 }; | 4035 }; |
4036 | 4036 |
4037 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); | 4037 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); |
4038 | 4038 |
4039 CpuFeatureScope scope(masm(), SSE2); | 4039 CpuFeatureScope scope(masm(), SSE2); |
4040 // Having marked this instruction as a call we can use any | 4040 // Having marked this instruction as a call we can use any |
4041 // registers. | 4041 // registers. |
4042 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 4042 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4752 TransitionElementsKindStub stub(from_kind, to_kind); | 4752 TransitionElementsKindStub stub(from_kind, to_kind); |
4753 __ CallStub(&stub); | 4753 __ CallStub(&stub); |
4754 RecordSafepointWithRegisters( | 4754 RecordSafepointWithRegisters( |
4755 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4755 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
4756 } | 4756 } |
4757 __ bind(¬_applicable); | 4757 __ bind(¬_applicable); |
4758 } | 4758 } |
4759 | 4759 |
4760 | 4760 |
4761 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 4761 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
4762 class DeferredStringCharCodeAt: public LDeferredCode { | 4762 class DeferredStringCharCodeAt V8_FINAL : public LDeferredCode { |
4763 public: | 4763 public: |
4764 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) | 4764 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) |
4765 : LDeferredCode(codegen), instr_(instr) { } | 4765 : LDeferredCode(codegen), instr_(instr) { } |
4766 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } | 4766 virtual void Generate() V8_OVERRIDE { |
4767 virtual LInstruction* instr() { return instr_; } | 4767 codegen()->DoDeferredStringCharCodeAt(instr_); |
| 4768 } |
| 4769 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4768 private: | 4770 private: |
4769 LStringCharCodeAt* instr_; | 4771 LStringCharCodeAt* instr_; |
4770 }; | 4772 }; |
4771 | 4773 |
4772 DeferredStringCharCodeAt* deferred = | 4774 DeferredStringCharCodeAt* deferred = |
4773 new(zone()) DeferredStringCharCodeAt(this, instr); | 4775 new(zone()) DeferredStringCharCodeAt(this, instr); |
4774 | 4776 |
4775 StringCharLoadGenerator::Generate(masm(), | 4777 StringCharLoadGenerator::Generate(masm(), |
4776 factory(), | 4778 factory(), |
4777 ToRegister(instr->string()), | 4779 ToRegister(instr->string()), |
(...skipping 29 matching lines...) Expand all Loading... |
4807 } | 4809 } |
4808 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, | 4810 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, |
4809 instr, instr->context()); | 4811 instr, instr->context()); |
4810 __ AssertSmi(eax); | 4812 __ AssertSmi(eax); |
4811 __ SmiUntag(eax); | 4813 __ SmiUntag(eax); |
4812 __ StoreToSafepointRegisterSlot(result, eax); | 4814 __ StoreToSafepointRegisterSlot(result, eax); |
4813 } | 4815 } |
4814 | 4816 |
4815 | 4817 |
4816 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4818 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
4817 class DeferredStringCharFromCode: public LDeferredCode { | 4819 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { |
4818 public: | 4820 public: |
4819 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4821 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
4820 : LDeferredCode(codegen), instr_(instr) { } | 4822 : LDeferredCode(codegen), instr_(instr) { } |
4821 virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); } | 4823 virtual void Generate() V8_OVERRIDE { |
4822 virtual LInstruction* instr() { return instr_; } | 4824 codegen()->DoDeferredStringCharFromCode(instr_); |
| 4825 } |
| 4826 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4823 private: | 4827 private: |
4824 LStringCharFromCode* instr_; | 4828 LStringCharFromCode* instr_; |
4825 }; | 4829 }; |
4826 | 4830 |
4827 DeferredStringCharFromCode* deferred = | 4831 DeferredStringCharFromCode* deferred = |
4828 new(zone()) DeferredStringCharFromCode(this, instr); | 4832 new(zone()) DeferredStringCharFromCode(this, instr); |
4829 | 4833 |
4830 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4834 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
4831 Register char_code = ToRegister(instr->char_code()); | 4835 Register char_code = ToRegister(instr->char_code()); |
4832 Register result = ToRegister(instr->result()); | 4836 Register result = ToRegister(instr->result()); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4899 LOperand* output = instr->result(); | 4903 LOperand* output = instr->result(); |
4900 LOperand* temp = instr->temp(); | 4904 LOperand* temp = instr->temp(); |
4901 | 4905 |
4902 __ LoadUint32(ToDoubleRegister(output), | 4906 __ LoadUint32(ToDoubleRegister(output), |
4903 ToRegister(input), | 4907 ToRegister(input), |
4904 ToDoubleRegister(temp)); | 4908 ToDoubleRegister(temp)); |
4905 } | 4909 } |
4906 | 4910 |
4907 | 4911 |
4908 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4912 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4909 class DeferredNumberTagI: public LDeferredCode { | 4913 class DeferredNumberTagI V8_FINAL : public LDeferredCode { |
4910 public: | 4914 public: |
4911 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4915 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4912 : LDeferredCode(codegen), instr_(instr) { } | 4916 : LDeferredCode(codegen), instr_(instr) { } |
4913 virtual void Generate() { | 4917 virtual void Generate() V8_OVERRIDE { |
4914 codegen()->DoDeferredNumberTagI(instr_, instr_->value(), SIGNED_INT32); | 4918 codegen()->DoDeferredNumberTagI(instr_, instr_->value(), SIGNED_INT32); |
4915 } | 4919 } |
4916 virtual LInstruction* instr() { return instr_; } | 4920 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4917 private: | 4921 private: |
4918 LNumberTagI* instr_; | 4922 LNumberTagI* instr_; |
4919 }; | 4923 }; |
4920 | 4924 |
4921 LOperand* input = instr->value(); | 4925 LOperand* input = instr->value(); |
4922 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4926 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4923 Register reg = ToRegister(input); | 4927 Register reg = ToRegister(input); |
4924 | 4928 |
4925 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); | 4929 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); |
4926 __ SmiTag(reg); | 4930 __ SmiTag(reg); |
4927 __ j(overflow, deferred->entry()); | 4931 __ j(overflow, deferred->entry()); |
4928 __ bind(deferred->exit()); | 4932 __ bind(deferred->exit()); |
4929 } | 4933 } |
4930 | 4934 |
4931 | 4935 |
4932 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4936 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4933 class DeferredNumberTagU: public LDeferredCode { | 4937 class DeferredNumberTagU V8_FINAL : public LDeferredCode { |
4934 public: | 4938 public: |
4935 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4939 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4936 : LDeferredCode(codegen), instr_(instr) { } | 4940 : LDeferredCode(codegen), instr_(instr) { } |
4937 virtual void Generate() { | 4941 virtual void Generate() V8_OVERRIDE { |
4938 codegen()->DoDeferredNumberTagI(instr_, instr_->value(), UNSIGNED_INT32); | 4942 codegen()->DoDeferredNumberTagI(instr_, instr_->value(), UNSIGNED_INT32); |
4939 } | 4943 } |
4940 virtual LInstruction* instr() { return instr_; } | 4944 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4941 private: | 4945 private: |
4942 LNumberTagU* instr_; | 4946 LNumberTagU* instr_; |
4943 }; | 4947 }; |
4944 | 4948 |
4945 LOperand* input = instr->value(); | 4949 LOperand* input = instr->value(); |
4946 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4950 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4947 Register reg = ToRegister(input); | 4951 Register reg = ToRegister(input); |
4948 | 4952 |
4949 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4953 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
4950 __ cmp(reg, Immediate(Smi::kMaxValue)); | 4954 __ cmp(reg, Immediate(Smi::kMaxValue)); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5026 CpuFeatureScope feature_scope(masm(), SSE2); | 5030 CpuFeatureScope feature_scope(masm(), SSE2); |
5027 __ movdbl(FieldOperand(reg, HeapNumber::kValueOffset), xmm0); | 5031 __ movdbl(FieldOperand(reg, HeapNumber::kValueOffset), xmm0); |
5028 } else { | 5032 } else { |
5029 __ fstp_d(FieldOperand(reg, HeapNumber::kValueOffset)); | 5033 __ fstp_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
5030 } | 5034 } |
5031 __ StoreToSafepointRegisterSlot(reg, reg); | 5035 __ StoreToSafepointRegisterSlot(reg, reg); |
5032 } | 5036 } |
5033 | 5037 |
5034 | 5038 |
5035 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 5039 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
5036 class DeferredNumberTagD: public LDeferredCode { | 5040 class DeferredNumberTagD V8_FINAL : public LDeferredCode { |
5037 public: | 5041 public: |
5038 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 5042 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
5039 : LDeferredCode(codegen), instr_(instr) { } | 5043 : LDeferredCode(codegen), instr_(instr) { } |
5040 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } | 5044 virtual void Generate() V8_OVERRIDE { |
5041 virtual LInstruction* instr() { return instr_; } | 5045 codegen()->DoDeferredNumberTagD(instr_); |
| 5046 } |
| 5047 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5042 private: | 5048 private: |
5043 LNumberTagD* instr_; | 5049 LNumberTagD* instr_; |
5044 }; | 5050 }; |
5045 | 5051 |
5046 Register reg = ToRegister(instr->result()); | 5052 Register reg = ToRegister(instr->result()); |
5047 | 5053 |
5048 bool use_sse2 = CpuFeatures::IsSupported(SSE2); | 5054 bool use_sse2 = CpuFeatures::IsSupported(SSE2); |
5049 if (!use_sse2) { | 5055 if (!use_sse2) { |
5050 // Put the value to the top of stack | 5056 // Put the value to the top of stack |
5051 X87Register src = ToX87Register(instr->value()); | 5057 X87Register src = ToX87Register(instr->value()); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5325 DeoptimizeIf(not_zero, instr->environment()); | 5331 DeoptimizeIf(not_zero, instr->environment()); |
5326 } | 5332 } |
5327 } else { | 5333 } else { |
5328 UNREACHABLE(); | 5334 UNREACHABLE(); |
5329 } | 5335 } |
5330 __ bind(&done); | 5336 __ bind(&done); |
5331 } | 5337 } |
5332 | 5338 |
5333 | 5339 |
5334 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 5340 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
5335 class DeferredTaggedToI: public LDeferredCode { | 5341 class DeferredTaggedToI V8_FINAL : public LDeferredCode { |
5336 public: | 5342 public: |
5337 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 5343 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
5338 : LDeferredCode(codegen), instr_(instr) { } | 5344 : LDeferredCode(codegen), instr_(instr) { } |
5339 virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); } | 5345 virtual void Generate() V8_OVERRIDE { |
5340 virtual LInstruction* instr() { return instr_; } | 5346 codegen()->DoDeferredTaggedToI(instr_); |
| 5347 } |
| 5348 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5341 private: | 5349 private: |
5342 LTaggedToI* instr_; | 5350 LTaggedToI* instr_; |
5343 }; | 5351 }; |
5344 | 5352 |
5345 LOperand* input = instr->value(); | 5353 LOperand* input = instr->value(); |
5346 ASSERT(input->IsRegister()); | 5354 ASSERT(input->IsRegister()); |
5347 Register input_reg = ToRegister(input); | 5355 Register input_reg = ToRegister(input); |
5348 ASSERT(input_reg.is(ToRegister(instr->result()))); | 5356 ASSERT(input_reg.is(ToRegister(instr->result()))); |
5349 | 5357 |
5350 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); | 5358 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5484 DeoptimizeIf(zero, instr->environment()); | 5492 DeoptimizeIf(zero, instr->environment()); |
5485 } | 5493 } |
5486 // If the negative subtraction overflows into a positive number, there was an | 5494 // If the negative subtraction overflows into a positive number, there was an |
5487 // overflow --> deopt. | 5495 // overflow --> deopt. |
5488 DeoptimizeIf(positive, instr->environment()); | 5496 DeoptimizeIf(positive, instr->environment()); |
5489 __ bind(&done); | 5497 __ bind(&done); |
5490 } | 5498 } |
5491 | 5499 |
5492 | 5500 |
5493 void LCodeGen::DoTaggedToINoSSE2(LTaggedToINoSSE2* instr) { | 5501 void LCodeGen::DoTaggedToINoSSE2(LTaggedToINoSSE2* instr) { |
5494 class DeferredTaggedToINoSSE2: public LDeferredCode { | 5502 class DeferredTaggedToINoSSE2 V8_FINAL : public LDeferredCode { |
5495 public: | 5503 public: |
5496 DeferredTaggedToINoSSE2(LCodeGen* codegen, LTaggedToINoSSE2* instr) | 5504 DeferredTaggedToINoSSE2(LCodeGen* codegen, LTaggedToINoSSE2* instr) |
5497 : LDeferredCode(codegen), instr_(instr) { } | 5505 : LDeferredCode(codegen), instr_(instr) { } |
5498 virtual void Generate() { codegen()->DoDeferredTaggedToINoSSE2(instr_); } | 5506 virtual void Generate() V8_OVERRIDE { |
5499 virtual LInstruction* instr() { return instr_; } | 5507 codegen()->DoDeferredTaggedToINoSSE2(instr_); |
| 5508 } |
| 5509 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5500 private: | 5510 private: |
5501 LTaggedToINoSSE2* instr_; | 5511 LTaggedToINoSSE2* instr_; |
5502 }; | 5512 }; |
5503 | 5513 |
5504 LOperand* input = instr->value(); | 5514 LOperand* input = instr->value(); |
5505 ASSERT(input->IsRegister()); | 5515 ASSERT(input->IsRegister()); |
5506 Register input_reg = ToRegister(input); | 5516 Register input_reg = ToRegister(input); |
5507 ASSERT(input_reg.is(ToRegister(instr->result()))); | 5517 ASSERT(input_reg.is(ToRegister(instr->result()))); |
5508 | 5518 |
5509 DeferredTaggedToINoSSE2* deferred = | 5519 DeferredTaggedToINoSSE2* deferred = |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5721 RecordSafepointWithRegisters( | 5731 RecordSafepointWithRegisters( |
5722 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); | 5732 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
5723 | 5733 |
5724 __ test(eax, Immediate(kSmiTagMask)); | 5734 __ test(eax, Immediate(kSmiTagMask)); |
5725 } | 5735 } |
5726 DeoptimizeIf(zero, instr->environment()); | 5736 DeoptimizeIf(zero, instr->environment()); |
5727 } | 5737 } |
5728 | 5738 |
5729 | 5739 |
5730 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5740 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
5731 class DeferredCheckMaps: public LDeferredCode { | 5741 class DeferredCheckMaps V8_FINAL : public LDeferredCode { |
5732 public: | 5742 public: |
5733 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 5743 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
5734 : LDeferredCode(codegen), instr_(instr), object_(object) { | 5744 : LDeferredCode(codegen), instr_(instr), object_(object) { |
5735 SetExit(check_maps()); | 5745 SetExit(check_maps()); |
5736 } | 5746 } |
5737 virtual void Generate() { | 5747 virtual void Generate() V8_OVERRIDE { |
5738 codegen()->DoDeferredInstanceMigration(instr_, object_); | 5748 codegen()->DoDeferredInstanceMigration(instr_, object_); |
5739 } | 5749 } |
5740 Label* check_maps() { return &check_maps_; } | 5750 Label* check_maps() { return &check_maps_; } |
5741 virtual LInstruction* instr() { return instr_; } | 5751 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5742 private: | 5752 private: |
5743 LCheckMaps* instr_; | 5753 LCheckMaps* instr_; |
5744 Label check_maps_; | 5754 Label check_maps_; |
5745 Register object_; | 5755 Register object_; |
5746 }; | 5756 }; |
5747 | 5757 |
5748 if (instr->hydrogen()->CanOmitMapChecks()) return; | 5758 if (instr->hydrogen()->CanOmitMapChecks()) return; |
5749 | 5759 |
5750 LOperand* input = instr->value(); | 5760 LOperand* input = instr->value(); |
5751 ASSERT(input->IsRegister()); | 5761 ASSERT(input->IsRegister()); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5944 if (!input_reg.is(result_reg)) { | 5954 if (!input_reg.is(result_reg)) { |
5945 __ mov(result_reg, input_reg); | 5955 __ mov(result_reg, input_reg); |
5946 } | 5956 } |
5947 __ SmiUntag(result_reg); | 5957 __ SmiUntag(result_reg); |
5948 __ ClampUint8(result_reg); | 5958 __ ClampUint8(result_reg); |
5949 __ bind(&done); | 5959 __ bind(&done); |
5950 } | 5960 } |
5951 | 5961 |
5952 | 5962 |
5953 void LCodeGen::DoAllocate(LAllocate* instr) { | 5963 void LCodeGen::DoAllocate(LAllocate* instr) { |
5954 class DeferredAllocate: public LDeferredCode { | 5964 class DeferredAllocate V8_FINAL : public LDeferredCode { |
5955 public: | 5965 public: |
5956 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5966 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
5957 : LDeferredCode(codegen), instr_(instr) { } | 5967 : LDeferredCode(codegen), instr_(instr) { } |
5958 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } | 5968 virtual void Generate() V8_OVERRIDE { |
5959 virtual LInstruction* instr() { return instr_; } | 5969 codegen()->DoDeferredAllocate(instr_); |
| 5970 } |
| 5971 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5960 private: | 5972 private: |
5961 LAllocate* instr_; | 5973 LAllocate* instr_; |
5962 }; | 5974 }; |
5963 | 5975 |
5964 DeferredAllocate* deferred = | 5976 DeferredAllocate* deferred = |
5965 new(zone()) DeferredAllocate(this, instr); | 5977 new(zone()) DeferredAllocate(this, instr); |
5966 | 5978 |
5967 Register result = ToRegister(instr->result()); | 5979 Register result = ToRegister(instr->result()); |
5968 Register temp = ToRegister(instr->temp()); | 5980 Register temp = ToRegister(instr->temp()); |
5969 | 5981 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6293 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 6305 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
6294 RecordSafepointWithLazyDeopt( | 6306 RecordSafepointWithLazyDeopt( |
6295 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 6307 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
6296 ASSERT(instr->HasEnvironment()); | 6308 ASSERT(instr->HasEnvironment()); |
6297 LEnvironment* env = instr->environment(); | 6309 LEnvironment* env = instr->environment(); |
6298 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 6310 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
6299 } | 6311 } |
6300 | 6312 |
6301 | 6313 |
6302 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 6314 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
6303 class DeferredStackCheck: public LDeferredCode { | 6315 class DeferredStackCheck V8_FINAL : public LDeferredCode { |
6304 public: | 6316 public: |
6305 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 6317 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
6306 : LDeferredCode(codegen), instr_(instr) { } | 6318 : LDeferredCode(codegen), instr_(instr) { } |
6307 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } | 6319 virtual void Generate() V8_OVERRIDE { |
6308 virtual LInstruction* instr() { return instr_; } | 6320 codegen()->DoDeferredStackCheck(instr_); |
| 6321 } |
| 6322 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
6309 private: | 6323 private: |
6310 LStackCheck* instr_; | 6324 LStackCheck* instr_; |
6311 }; | 6325 }; |
6312 | 6326 |
6313 ASSERT(instr->HasEnvironment()); | 6327 ASSERT(instr->HasEnvironment()); |
6314 LEnvironment* env = instr->environment(); | 6328 LEnvironment* env = instr->environment(); |
6315 // There is no LLazyBailout instruction for stack-checks. We have to | 6329 // There is no LLazyBailout instruction for stack-checks. We have to |
6316 // prepare for lazy deoptimization explicitly here. | 6330 // prepare for lazy deoptimization explicitly here. |
6317 if (instr->hydrogen()->is_function_entry()) { | 6331 if (instr->hydrogen()->is_function_entry()) { |
6318 // Perform stack overflow check. | 6332 // Perform stack overflow check. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6452 FixedArray::kHeaderSize - kPointerSize)); | 6466 FixedArray::kHeaderSize - kPointerSize)); |
6453 __ bind(&done); | 6467 __ bind(&done); |
6454 } | 6468 } |
6455 | 6469 |
6456 | 6470 |
6457 #undef __ | 6471 #undef __ |
6458 | 6472 |
6459 } } // namespace v8::internal | 6473 } } // namespace v8::internal |
6460 | 6474 |
6461 #endif // V8_TARGET_ARCH_IA32 | 6475 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |