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