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 V8_FINAL : public CallWrapper { | 51 class SafepointGenerator : 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 V8_OVERRIDE {} | 61 virtual void BeforeCall(int call_size) const {} |
62 | 62 |
63 virtual void AfterCall() const V8_OVERRIDE { | 63 virtual void AfterCall() const { |
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 V8_FINAL : public LDeferredCode { | 2819 class DeferredInstanceOfKnownGlobal: 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() V8_OVERRIDE { | 2824 virtual void Generate() { |
2825 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2825 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
2826 } | 2826 } |
2827 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 2827 virtual LInstruction* instr() { 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 V8_FINAL : public LDeferredCode { | 3787 class DeferredMathAbsTaggedHeapNumber: 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() V8_OVERRIDE { | 3791 virtual void Generate() { |
3792 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3792 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
3793 } | 3793 } |
3794 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 3794 virtual LInstruction* instr() { 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 V8_FINAL : public LDeferredCode { | 4027 class DeferredDoRandom: 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() V8_OVERRIDE { codegen()->DoDeferredRandom(instr_); } | 4031 virtual void Generate() { codegen()->DoDeferredRandom(instr_); } |
4032 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4032 virtual LInstruction* instr() { 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 V8_FINAL : public LDeferredCode { | 4762 class DeferredStringCharCodeAt: 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() V8_OVERRIDE { | 4766 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } |
4767 codegen()->DoDeferredStringCharCodeAt(instr_); | 4767 virtual LInstruction* instr() { return instr_; } |
4768 } | |
4769 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
4770 private: | 4768 private: |
4771 LStringCharCodeAt* instr_; | 4769 LStringCharCodeAt* instr_; |
4772 }; | 4770 }; |
4773 | 4771 |
4774 DeferredStringCharCodeAt* deferred = | 4772 DeferredStringCharCodeAt* deferred = |
4775 new(zone()) DeferredStringCharCodeAt(this, instr); | 4773 new(zone()) DeferredStringCharCodeAt(this, instr); |
4776 | 4774 |
4777 StringCharLoadGenerator::Generate(masm(), | 4775 StringCharLoadGenerator::Generate(masm(), |
4778 factory(), | 4776 factory(), |
4779 ToRegister(instr->string()), | 4777 ToRegister(instr->string()), |
(...skipping 29 matching lines...) Expand all Loading... |
4809 } | 4807 } |
4810 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, | 4808 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, |
4811 instr, instr->context()); | 4809 instr, instr->context()); |
4812 __ AssertSmi(eax); | 4810 __ AssertSmi(eax); |
4813 __ SmiUntag(eax); | 4811 __ SmiUntag(eax); |
4814 __ StoreToSafepointRegisterSlot(result, eax); | 4812 __ StoreToSafepointRegisterSlot(result, eax); |
4815 } | 4813 } |
4816 | 4814 |
4817 | 4815 |
4818 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4816 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
4819 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { | 4817 class DeferredStringCharFromCode: public LDeferredCode { |
4820 public: | 4818 public: |
4821 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4819 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
4822 : LDeferredCode(codegen), instr_(instr) { } | 4820 : LDeferredCode(codegen), instr_(instr) { } |
4823 virtual void Generate() V8_OVERRIDE { | 4821 virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); } |
4824 codegen()->DoDeferredStringCharFromCode(instr_); | 4822 virtual LInstruction* instr() { return instr_; } |
4825 } | |
4826 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
4827 private: | 4823 private: |
4828 LStringCharFromCode* instr_; | 4824 LStringCharFromCode* instr_; |
4829 }; | 4825 }; |
4830 | 4826 |
4831 DeferredStringCharFromCode* deferred = | 4827 DeferredStringCharFromCode* deferred = |
4832 new(zone()) DeferredStringCharFromCode(this, instr); | 4828 new(zone()) DeferredStringCharFromCode(this, instr); |
4833 | 4829 |
4834 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4830 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
4835 Register char_code = ToRegister(instr->char_code()); | 4831 Register char_code = ToRegister(instr->char_code()); |
4836 Register result = ToRegister(instr->result()); | 4832 Register result = ToRegister(instr->result()); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4903 LOperand* output = instr->result(); | 4899 LOperand* output = instr->result(); |
4904 LOperand* temp = instr->temp(); | 4900 LOperand* temp = instr->temp(); |
4905 | 4901 |
4906 __ LoadUint32(ToDoubleRegister(output), | 4902 __ LoadUint32(ToDoubleRegister(output), |
4907 ToRegister(input), | 4903 ToRegister(input), |
4908 ToDoubleRegister(temp)); | 4904 ToDoubleRegister(temp)); |
4909 } | 4905 } |
4910 | 4906 |
4911 | 4907 |
4912 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4908 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4913 class DeferredNumberTagI V8_FINAL : public LDeferredCode { | 4909 class DeferredNumberTagI: public LDeferredCode { |
4914 public: | 4910 public: |
4915 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4911 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4916 : LDeferredCode(codegen), instr_(instr) { } | 4912 : LDeferredCode(codegen), instr_(instr) { } |
4917 virtual void Generate() V8_OVERRIDE { | 4913 virtual void Generate() { |
4918 codegen()->DoDeferredNumberTagI(instr_, instr_->value(), SIGNED_INT32); | 4914 codegen()->DoDeferredNumberTagI(instr_, instr_->value(), SIGNED_INT32); |
4919 } | 4915 } |
4920 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4916 virtual LInstruction* instr() { return instr_; } |
4921 private: | 4917 private: |
4922 LNumberTagI* instr_; | 4918 LNumberTagI* instr_; |
4923 }; | 4919 }; |
4924 | 4920 |
4925 LOperand* input = instr->value(); | 4921 LOperand* input = instr->value(); |
4926 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4922 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4927 Register reg = ToRegister(input); | 4923 Register reg = ToRegister(input); |
4928 | 4924 |
4929 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); | 4925 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); |
4930 __ SmiTag(reg); | 4926 __ SmiTag(reg); |
4931 __ j(overflow, deferred->entry()); | 4927 __ j(overflow, deferred->entry()); |
4932 __ bind(deferred->exit()); | 4928 __ bind(deferred->exit()); |
4933 } | 4929 } |
4934 | 4930 |
4935 | 4931 |
4936 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4932 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4937 class DeferredNumberTagU V8_FINAL : public LDeferredCode { | 4933 class DeferredNumberTagU: public LDeferredCode { |
4938 public: | 4934 public: |
4939 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4935 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4940 : LDeferredCode(codegen), instr_(instr) { } | 4936 : LDeferredCode(codegen), instr_(instr) { } |
4941 virtual void Generate() V8_OVERRIDE { | 4937 virtual void Generate() { |
4942 codegen()->DoDeferredNumberTagI(instr_, instr_->value(), UNSIGNED_INT32); | 4938 codegen()->DoDeferredNumberTagI(instr_, instr_->value(), UNSIGNED_INT32); |
4943 } | 4939 } |
4944 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4940 virtual LInstruction* instr() { return instr_; } |
4945 private: | 4941 private: |
4946 LNumberTagU* instr_; | 4942 LNumberTagU* instr_; |
4947 }; | 4943 }; |
4948 | 4944 |
4949 LOperand* input = instr->value(); | 4945 LOperand* input = instr->value(); |
4950 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4946 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4951 Register reg = ToRegister(input); | 4947 Register reg = ToRegister(input); |
4952 | 4948 |
4953 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4949 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
4954 __ cmp(reg, Immediate(Smi::kMaxValue)); | 4950 __ cmp(reg, Immediate(Smi::kMaxValue)); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5030 CpuFeatureScope feature_scope(masm(), SSE2); | 5026 CpuFeatureScope feature_scope(masm(), SSE2); |
5031 __ movdbl(FieldOperand(reg, HeapNumber::kValueOffset), xmm0); | 5027 __ movdbl(FieldOperand(reg, HeapNumber::kValueOffset), xmm0); |
5032 } else { | 5028 } else { |
5033 __ fstp_d(FieldOperand(reg, HeapNumber::kValueOffset)); | 5029 __ fstp_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
5034 } | 5030 } |
5035 __ StoreToSafepointRegisterSlot(reg, reg); | 5031 __ StoreToSafepointRegisterSlot(reg, reg); |
5036 } | 5032 } |
5037 | 5033 |
5038 | 5034 |
5039 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 5035 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
5040 class DeferredNumberTagD V8_FINAL : public LDeferredCode { | 5036 class DeferredNumberTagD: public LDeferredCode { |
5041 public: | 5037 public: |
5042 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 5038 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
5043 : LDeferredCode(codegen), instr_(instr) { } | 5039 : LDeferredCode(codegen), instr_(instr) { } |
5044 virtual void Generate() V8_OVERRIDE { | 5040 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } |
5045 codegen()->DoDeferredNumberTagD(instr_); | 5041 virtual LInstruction* instr() { return instr_; } |
5046 } | |
5047 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
5048 private: | 5042 private: |
5049 LNumberTagD* instr_; | 5043 LNumberTagD* instr_; |
5050 }; | 5044 }; |
5051 | 5045 |
5052 Register reg = ToRegister(instr->result()); | 5046 Register reg = ToRegister(instr->result()); |
5053 | 5047 |
5054 bool use_sse2 = CpuFeatures::IsSupported(SSE2); | 5048 bool use_sse2 = CpuFeatures::IsSupported(SSE2); |
5055 if (!use_sse2) { | 5049 if (!use_sse2) { |
5056 // Put the value to the top of stack | 5050 // Put the value to the top of stack |
5057 X87Register src = ToX87Register(instr->value()); | 5051 X87Register src = ToX87Register(instr->value()); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5331 DeoptimizeIf(not_zero, instr->environment()); | 5325 DeoptimizeIf(not_zero, instr->environment()); |
5332 } | 5326 } |
5333 } else { | 5327 } else { |
5334 UNREACHABLE(); | 5328 UNREACHABLE(); |
5335 } | 5329 } |
5336 __ bind(&done); | 5330 __ bind(&done); |
5337 } | 5331 } |
5338 | 5332 |
5339 | 5333 |
5340 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 5334 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
5341 class DeferredTaggedToI V8_FINAL : public LDeferredCode { | 5335 class DeferredTaggedToI: public LDeferredCode { |
5342 public: | 5336 public: |
5343 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 5337 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
5344 : LDeferredCode(codegen), instr_(instr) { } | 5338 : LDeferredCode(codegen), instr_(instr) { } |
5345 virtual void Generate() V8_OVERRIDE { | 5339 virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); } |
5346 codegen()->DoDeferredTaggedToI(instr_); | 5340 virtual LInstruction* instr() { return instr_; } |
5347 } | |
5348 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
5349 private: | 5341 private: |
5350 LTaggedToI* instr_; | 5342 LTaggedToI* instr_; |
5351 }; | 5343 }; |
5352 | 5344 |
5353 LOperand* input = instr->value(); | 5345 LOperand* input = instr->value(); |
5354 ASSERT(input->IsRegister()); | 5346 ASSERT(input->IsRegister()); |
5355 Register input_reg = ToRegister(input); | 5347 Register input_reg = ToRegister(input); |
5356 ASSERT(input_reg.is(ToRegister(instr->result()))); | 5348 ASSERT(input_reg.is(ToRegister(instr->result()))); |
5357 | 5349 |
5358 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); | 5350 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5492 DeoptimizeIf(zero, instr->environment()); | 5484 DeoptimizeIf(zero, instr->environment()); |
5493 } | 5485 } |
5494 // If the negative subtraction overflows into a positive number, there was an | 5486 // If the negative subtraction overflows into a positive number, there was an |
5495 // overflow --> deopt. | 5487 // overflow --> deopt. |
5496 DeoptimizeIf(positive, instr->environment()); | 5488 DeoptimizeIf(positive, instr->environment()); |
5497 __ bind(&done); | 5489 __ bind(&done); |
5498 } | 5490 } |
5499 | 5491 |
5500 | 5492 |
5501 void LCodeGen::DoTaggedToINoSSE2(LTaggedToINoSSE2* instr) { | 5493 void LCodeGen::DoTaggedToINoSSE2(LTaggedToINoSSE2* instr) { |
5502 class DeferredTaggedToINoSSE2 V8_FINAL : public LDeferredCode { | 5494 class DeferredTaggedToINoSSE2: public LDeferredCode { |
5503 public: | 5495 public: |
5504 DeferredTaggedToINoSSE2(LCodeGen* codegen, LTaggedToINoSSE2* instr) | 5496 DeferredTaggedToINoSSE2(LCodeGen* codegen, LTaggedToINoSSE2* instr) |
5505 : LDeferredCode(codegen), instr_(instr) { } | 5497 : LDeferredCode(codegen), instr_(instr) { } |
5506 virtual void Generate() V8_OVERRIDE { | 5498 virtual void Generate() { codegen()->DoDeferredTaggedToINoSSE2(instr_); } |
5507 codegen()->DoDeferredTaggedToINoSSE2(instr_); | 5499 virtual LInstruction* instr() { return instr_; } |
5508 } | |
5509 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
5510 private: | 5500 private: |
5511 LTaggedToINoSSE2* instr_; | 5501 LTaggedToINoSSE2* instr_; |
5512 }; | 5502 }; |
5513 | 5503 |
5514 LOperand* input = instr->value(); | 5504 LOperand* input = instr->value(); |
5515 ASSERT(input->IsRegister()); | 5505 ASSERT(input->IsRegister()); |
5516 Register input_reg = ToRegister(input); | 5506 Register input_reg = ToRegister(input); |
5517 ASSERT(input_reg.is(ToRegister(instr->result()))); | 5507 ASSERT(input_reg.is(ToRegister(instr->result()))); |
5518 | 5508 |
5519 DeferredTaggedToINoSSE2* deferred = | 5509 DeferredTaggedToINoSSE2* deferred = |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5731 RecordSafepointWithRegisters( | 5721 RecordSafepointWithRegisters( |
5732 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); | 5722 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
5733 | 5723 |
5734 __ test(eax, Immediate(kSmiTagMask)); | 5724 __ test(eax, Immediate(kSmiTagMask)); |
5735 } | 5725 } |
5736 DeoptimizeIf(zero, instr->environment()); | 5726 DeoptimizeIf(zero, instr->environment()); |
5737 } | 5727 } |
5738 | 5728 |
5739 | 5729 |
5740 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5730 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
5741 class DeferredCheckMaps V8_FINAL : public LDeferredCode { | 5731 class DeferredCheckMaps: public LDeferredCode { |
5742 public: | 5732 public: |
5743 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 5733 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
5744 : LDeferredCode(codegen), instr_(instr), object_(object) { | 5734 : LDeferredCode(codegen), instr_(instr), object_(object) { |
5745 SetExit(check_maps()); | 5735 SetExit(check_maps()); |
5746 } | 5736 } |
5747 virtual void Generate() V8_OVERRIDE { | 5737 virtual void Generate() { |
5748 codegen()->DoDeferredInstanceMigration(instr_, object_); | 5738 codegen()->DoDeferredInstanceMigration(instr_, object_); |
5749 } | 5739 } |
5750 Label* check_maps() { return &check_maps_; } | 5740 Label* check_maps() { return &check_maps_; } |
5751 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5741 virtual LInstruction* instr() { return instr_; } |
5752 private: | 5742 private: |
5753 LCheckMaps* instr_; | 5743 LCheckMaps* instr_; |
5754 Label check_maps_; | 5744 Label check_maps_; |
5755 Register object_; | 5745 Register object_; |
5756 }; | 5746 }; |
5757 | 5747 |
5758 if (instr->hydrogen()->CanOmitMapChecks()) return; | 5748 if (instr->hydrogen()->CanOmitMapChecks()) return; |
5759 | 5749 |
5760 LOperand* input = instr->value(); | 5750 LOperand* input = instr->value(); |
5761 ASSERT(input->IsRegister()); | 5751 ASSERT(input->IsRegister()); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5954 if (!input_reg.is(result_reg)) { | 5944 if (!input_reg.is(result_reg)) { |
5955 __ mov(result_reg, input_reg); | 5945 __ mov(result_reg, input_reg); |
5956 } | 5946 } |
5957 __ SmiUntag(result_reg); | 5947 __ SmiUntag(result_reg); |
5958 __ ClampUint8(result_reg); | 5948 __ ClampUint8(result_reg); |
5959 __ bind(&done); | 5949 __ bind(&done); |
5960 } | 5950 } |
5961 | 5951 |
5962 | 5952 |
5963 void LCodeGen::DoAllocate(LAllocate* instr) { | 5953 void LCodeGen::DoAllocate(LAllocate* instr) { |
5964 class DeferredAllocate V8_FINAL : public LDeferredCode { | 5954 class DeferredAllocate: public LDeferredCode { |
5965 public: | 5955 public: |
5966 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5956 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
5967 : LDeferredCode(codegen), instr_(instr) { } | 5957 : LDeferredCode(codegen), instr_(instr) { } |
5968 virtual void Generate() V8_OVERRIDE { | 5958 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } |
5969 codegen()->DoDeferredAllocate(instr_); | 5959 virtual LInstruction* instr() { return instr_; } |
5970 } | |
5971 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
5972 private: | 5960 private: |
5973 LAllocate* instr_; | 5961 LAllocate* instr_; |
5974 }; | 5962 }; |
5975 | 5963 |
5976 DeferredAllocate* deferred = | 5964 DeferredAllocate* deferred = |
5977 new(zone()) DeferredAllocate(this, instr); | 5965 new(zone()) DeferredAllocate(this, instr); |
5978 | 5966 |
5979 Register result = ToRegister(instr->result()); | 5967 Register result = ToRegister(instr->result()); |
5980 Register temp = ToRegister(instr->temp()); | 5968 Register temp = ToRegister(instr->temp()); |
5981 | 5969 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6305 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 6293 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
6306 RecordSafepointWithLazyDeopt( | 6294 RecordSafepointWithLazyDeopt( |
6307 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 6295 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
6308 ASSERT(instr->HasEnvironment()); | 6296 ASSERT(instr->HasEnvironment()); |
6309 LEnvironment* env = instr->environment(); | 6297 LEnvironment* env = instr->environment(); |
6310 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 6298 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
6311 } | 6299 } |
6312 | 6300 |
6313 | 6301 |
6314 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 6302 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
6315 class DeferredStackCheck V8_FINAL : public LDeferredCode { | 6303 class DeferredStackCheck: public LDeferredCode { |
6316 public: | 6304 public: |
6317 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 6305 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
6318 : LDeferredCode(codegen), instr_(instr) { } | 6306 : LDeferredCode(codegen), instr_(instr) { } |
6319 virtual void Generate() V8_OVERRIDE { | 6307 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } |
6320 codegen()->DoDeferredStackCheck(instr_); | 6308 virtual LInstruction* instr() { return instr_; } |
6321 } | |
6322 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
6323 private: | 6309 private: |
6324 LStackCheck* instr_; | 6310 LStackCheck* instr_; |
6325 }; | 6311 }; |
6326 | 6312 |
6327 ASSERT(instr->HasEnvironment()); | 6313 ASSERT(instr->HasEnvironment()); |
6328 LEnvironment* env = instr->environment(); | 6314 LEnvironment* env = instr->environment(); |
6329 // There is no LLazyBailout instruction for stack-checks. We have to | 6315 // There is no LLazyBailout instruction for stack-checks. We have to |
6330 // prepare for lazy deoptimization explicitly here. | 6316 // prepare for lazy deoptimization explicitly here. |
6331 if (instr->hydrogen()->is_function_entry()) { | 6317 if (instr->hydrogen()->is_function_entry()) { |
6332 // Perform stack overflow check. | 6318 // Perform stack overflow check. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6466 FixedArray::kHeaderSize - kPointerSize)); | 6452 FixedArray::kHeaderSize - kPointerSize)); |
6467 __ bind(&done); | 6453 __ bind(&done); |
6468 } | 6454 } |
6469 | 6455 |
6470 | 6456 |
6471 #undef __ | 6457 #undef __ |
6472 | 6458 |
6473 } } // namespace v8::internal | 6459 } } // namespace v8::internal |
6474 | 6460 |
6475 #endif // V8_TARGET_ARCH_IA32 | 6461 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |