OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
11 #include "src/code-stubs.h" | 11 #include "src/code-stubs.h" |
12 #include "src/cpu-profiler.h" | 12 #include "src/cpu-profiler.h" |
13 #include "src/hydrogen-osr.h" | 13 #include "src/hydrogen-osr.h" |
14 #include "src/ic/ic.h" | 14 #include "src/ic/ic.h" |
15 #include "src/ic/stub-cache.h" | 15 #include "src/ic/stub-cache.h" |
16 #include "src/x64/lithium-codegen-x64.h" | 16 #include "src/x64/lithium-codegen-x64.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 | 21 |
22 // When invoking builtins, we need to record the safepoint in the middle of | 22 // When invoking builtins, we need to record the safepoint in the middle of |
23 // the invoke instruction sequence generated by the macro assembler. | 23 // the invoke instruction sequence generated by the macro assembler. |
24 class SafepointGenerator FINAL : public CallWrapper { | 24 class SafepointGenerator final : public CallWrapper { |
25 public: | 25 public: |
26 SafepointGenerator(LCodeGen* codegen, | 26 SafepointGenerator(LCodeGen* codegen, |
27 LPointerMap* pointers, | 27 LPointerMap* pointers, |
28 Safepoint::DeoptMode mode) | 28 Safepoint::DeoptMode mode) |
29 : codegen_(codegen), | 29 : codegen_(codegen), |
30 pointers_(pointers), | 30 pointers_(pointers), |
31 deopt_mode_(mode) { } | 31 deopt_mode_(mode) { } |
32 virtual ~SafepointGenerator() {} | 32 virtual ~SafepointGenerator() {} |
33 | 33 |
34 void BeforeCall(int call_size) const OVERRIDE {} | 34 void BeforeCall(int call_size) const override {} |
35 | 35 |
36 void AfterCall() const OVERRIDE { | 36 void AfterCall() const override { |
37 codegen_->RecordSafepoint(pointers_, deopt_mode_); | 37 codegen_->RecordSafepoint(pointers_, deopt_mode_); |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 LCodeGen* codegen_; | 41 LCodeGen* codegen_; |
42 LPointerMap* pointers_; | 42 LPointerMap* pointers_; |
43 Safepoint::DeoptMode deopt_mode_; | 43 Safepoint::DeoptMode deopt_mode_; |
44 }; | 44 }; |
45 | 45 |
46 | 46 |
(...skipping 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2711 __ j(zero, &true_value, Label::kNear); | 2711 __ j(zero, &true_value, Label::kNear); |
2712 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); | 2712 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); |
2713 __ jmp(&done, Label::kNear); | 2713 __ jmp(&done, Label::kNear); |
2714 __ bind(&true_value); | 2714 __ bind(&true_value); |
2715 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); | 2715 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); |
2716 __ bind(&done); | 2716 __ bind(&done); |
2717 } | 2717 } |
2718 | 2718 |
2719 | 2719 |
2720 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2720 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
2721 class DeferredInstanceOfKnownGlobal FINAL : public LDeferredCode { | 2721 class DeferredInstanceOfKnownGlobal final : public LDeferredCode { |
2722 public: | 2722 public: |
2723 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2723 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
2724 LInstanceOfKnownGlobal* instr) | 2724 LInstanceOfKnownGlobal* instr) |
2725 : LDeferredCode(codegen), instr_(instr) { } | 2725 : LDeferredCode(codegen), instr_(instr) { } |
2726 void Generate() OVERRIDE { | 2726 void Generate() override { |
2727 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2727 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
2728 } | 2728 } |
2729 LInstruction* instr() OVERRIDE { return instr_; } | 2729 LInstruction* instr() override { return instr_; } |
2730 Label* map_check() { return &map_check_; } | 2730 Label* map_check() { return &map_check_; } |
2731 private: | 2731 private: |
2732 LInstanceOfKnownGlobal* instr_; | 2732 LInstanceOfKnownGlobal* instr_; |
2733 Label map_check_; | 2733 Label map_check_; |
2734 }; | 2734 }; |
2735 | 2735 |
2736 DCHECK(ToRegister(instr->context()).is(rsi)); | 2736 DCHECK(ToRegister(instr->context()).is(rsi)); |
2737 DeferredInstanceOfKnownGlobal* deferred; | 2737 DeferredInstanceOfKnownGlobal* deferred; |
2738 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); | 2738 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); |
2739 | 2739 |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3694 Label is_positive; | 3694 Label is_positive; |
3695 __ j(not_sign, &is_positive, Label::kNear); | 3695 __ j(not_sign, &is_positive, Label::kNear); |
3696 __ negp(input_reg); // Sets flags. | 3696 __ negp(input_reg); // Sets flags. |
3697 DeoptimizeIf(negative, instr, Deoptimizer::kOverflow); | 3697 DeoptimizeIf(negative, instr, Deoptimizer::kOverflow); |
3698 __ bind(&is_positive); | 3698 __ bind(&is_positive); |
3699 } | 3699 } |
3700 | 3700 |
3701 | 3701 |
3702 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3702 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
3703 // Class for deferred case. | 3703 // Class for deferred case. |
3704 class DeferredMathAbsTaggedHeapNumber FINAL : public LDeferredCode { | 3704 class DeferredMathAbsTaggedHeapNumber final : public LDeferredCode { |
3705 public: | 3705 public: |
3706 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) | 3706 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) |
3707 : LDeferredCode(codegen), instr_(instr) { } | 3707 : LDeferredCode(codegen), instr_(instr) { } |
3708 void Generate() OVERRIDE { | 3708 void Generate() override { |
3709 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3709 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
3710 } | 3710 } |
3711 LInstruction* instr() OVERRIDE { return instr_; } | 3711 LInstruction* instr() override { return instr_; } |
3712 | 3712 |
3713 private: | 3713 private: |
3714 LMathAbs* instr_; | 3714 LMathAbs* instr_; |
3715 }; | 3715 }; |
3716 | 3716 |
3717 DCHECK(instr->value()->Equals(instr->result())); | 3717 DCHECK(instr->value()->Equals(instr->result())); |
3718 Representation r = instr->hydrogen()->value()->representation(); | 3718 Representation r = instr->hydrogen()->value()->representation(); |
3719 | 3719 |
3720 if (r.IsDouble()) { | 3720 if (r.IsDouble()) { |
3721 XMMRegister scratch = double_scratch0(); | 3721 XMMRegister scratch = double_scratch0(); |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4578 DCHECK(ToRegister(instr->left()).is(rdx)); | 4578 DCHECK(ToRegister(instr->left()).is(rdx)); |
4579 DCHECK(ToRegister(instr->right()).is(rax)); | 4579 DCHECK(ToRegister(instr->right()).is(rax)); |
4580 StringAddStub stub(isolate(), | 4580 StringAddStub stub(isolate(), |
4581 instr->hydrogen()->flags(), | 4581 instr->hydrogen()->flags(), |
4582 instr->hydrogen()->pretenure_flag()); | 4582 instr->hydrogen()->pretenure_flag()); |
4583 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4583 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4584 } | 4584 } |
4585 | 4585 |
4586 | 4586 |
4587 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 4587 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
4588 class DeferredStringCharCodeAt FINAL : public LDeferredCode { | 4588 class DeferredStringCharCodeAt final : public LDeferredCode { |
4589 public: | 4589 public: |
4590 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) | 4590 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) |
4591 : LDeferredCode(codegen), instr_(instr) { } | 4591 : LDeferredCode(codegen), instr_(instr) { } |
4592 void Generate() OVERRIDE { codegen()->DoDeferredStringCharCodeAt(instr_); } | 4592 void Generate() override { codegen()->DoDeferredStringCharCodeAt(instr_); } |
4593 LInstruction* instr() OVERRIDE { return instr_; } | 4593 LInstruction* instr() override { return instr_; } |
4594 | 4594 |
4595 private: | 4595 private: |
4596 LStringCharCodeAt* instr_; | 4596 LStringCharCodeAt* instr_; |
4597 }; | 4597 }; |
4598 | 4598 |
4599 DeferredStringCharCodeAt* deferred = | 4599 DeferredStringCharCodeAt* deferred = |
4600 new(zone()) DeferredStringCharCodeAt(this, instr); | 4600 new(zone()) DeferredStringCharCodeAt(this, instr); |
4601 | 4601 |
4602 StringCharLoadGenerator::Generate(masm(), | 4602 StringCharLoadGenerator::Generate(masm(), |
4603 ToRegister(instr->string()), | 4603 ToRegister(instr->string()), |
(...skipping 28 matching lines...) Expand all Loading... |
4632 } | 4632 } |
4633 CallRuntimeFromDeferred( | 4633 CallRuntimeFromDeferred( |
4634 Runtime::kStringCharCodeAtRT, 2, instr, instr->context()); | 4634 Runtime::kStringCharCodeAtRT, 2, instr, instr->context()); |
4635 __ AssertSmi(rax); | 4635 __ AssertSmi(rax); |
4636 __ SmiToInteger32(rax, rax); | 4636 __ SmiToInteger32(rax, rax); |
4637 __ StoreToSafepointRegisterSlot(result, rax); | 4637 __ StoreToSafepointRegisterSlot(result, rax); |
4638 } | 4638 } |
4639 | 4639 |
4640 | 4640 |
4641 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4641 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
4642 class DeferredStringCharFromCode FINAL : public LDeferredCode { | 4642 class DeferredStringCharFromCode final : public LDeferredCode { |
4643 public: | 4643 public: |
4644 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4644 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
4645 : LDeferredCode(codegen), instr_(instr) { } | 4645 : LDeferredCode(codegen), instr_(instr) { } |
4646 void Generate() OVERRIDE { | 4646 void Generate() override { |
4647 codegen()->DoDeferredStringCharFromCode(instr_); | 4647 codegen()->DoDeferredStringCharFromCode(instr_); |
4648 } | 4648 } |
4649 LInstruction* instr() OVERRIDE { return instr_; } | 4649 LInstruction* instr() override { return instr_; } |
4650 | 4650 |
4651 private: | 4651 private: |
4652 LStringCharFromCode* instr_; | 4652 LStringCharFromCode* instr_; |
4653 }; | 4653 }; |
4654 | 4654 |
4655 DeferredStringCharFromCode* deferred = | 4655 DeferredStringCharFromCode* deferred = |
4656 new(zone()) DeferredStringCharFromCode(this, instr); | 4656 new(zone()) DeferredStringCharFromCode(this, instr); |
4657 | 4657 |
4658 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); | 4658 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); |
4659 Register char_code = ToRegister(instr->char_code()); | 4659 Register char_code = ToRegister(instr->char_code()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4705 | 4705 |
4706 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { | 4706 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
4707 LOperand* input = instr->value(); | 4707 LOperand* input = instr->value(); |
4708 LOperand* output = instr->result(); | 4708 LOperand* output = instr->result(); |
4709 | 4709 |
4710 __ LoadUint32(ToDoubleRegister(output), ToRegister(input)); | 4710 __ LoadUint32(ToDoubleRegister(output), ToRegister(input)); |
4711 } | 4711 } |
4712 | 4712 |
4713 | 4713 |
4714 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4714 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4715 class DeferredNumberTagI FINAL : public LDeferredCode { | 4715 class DeferredNumberTagI final : public LDeferredCode { |
4716 public: | 4716 public: |
4717 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4717 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4718 : LDeferredCode(codegen), instr_(instr) { } | 4718 : LDeferredCode(codegen), instr_(instr) { } |
4719 void Generate() OVERRIDE { | 4719 void Generate() override { |
4720 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp1(), | 4720 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp1(), |
4721 instr_->temp2(), SIGNED_INT32); | 4721 instr_->temp2(), SIGNED_INT32); |
4722 } | 4722 } |
4723 LInstruction* instr() OVERRIDE { return instr_; } | 4723 LInstruction* instr() override { return instr_; } |
4724 | 4724 |
4725 private: | 4725 private: |
4726 LNumberTagI* instr_; | 4726 LNumberTagI* instr_; |
4727 }; | 4727 }; |
4728 | 4728 |
4729 LOperand* input = instr->value(); | 4729 LOperand* input = instr->value(); |
4730 DCHECK(input->IsRegister() && input->Equals(instr->result())); | 4730 DCHECK(input->IsRegister() && input->Equals(instr->result())); |
4731 Register reg = ToRegister(input); | 4731 Register reg = ToRegister(input); |
4732 | 4732 |
4733 if (SmiValuesAre32Bits()) { | 4733 if (SmiValuesAre32Bits()) { |
4734 __ Integer32ToSmi(reg, reg); | 4734 __ Integer32ToSmi(reg, reg); |
4735 } else { | 4735 } else { |
4736 DCHECK(SmiValuesAre31Bits()); | 4736 DCHECK(SmiValuesAre31Bits()); |
4737 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); | 4737 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); |
4738 __ Integer32ToSmi(reg, reg); | 4738 __ Integer32ToSmi(reg, reg); |
4739 __ j(overflow, deferred->entry()); | 4739 __ j(overflow, deferred->entry()); |
4740 __ bind(deferred->exit()); | 4740 __ bind(deferred->exit()); |
4741 } | 4741 } |
4742 } | 4742 } |
4743 | 4743 |
4744 | 4744 |
4745 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4745 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4746 class DeferredNumberTagU FINAL : public LDeferredCode { | 4746 class DeferredNumberTagU final : public LDeferredCode { |
4747 public: | 4747 public: |
4748 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4748 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4749 : LDeferredCode(codegen), instr_(instr) { } | 4749 : LDeferredCode(codegen), instr_(instr) { } |
4750 void Generate() OVERRIDE { | 4750 void Generate() override { |
4751 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp1(), | 4751 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp1(), |
4752 instr_->temp2(), UNSIGNED_INT32); | 4752 instr_->temp2(), UNSIGNED_INT32); |
4753 } | 4753 } |
4754 LInstruction* instr() OVERRIDE { return instr_; } | 4754 LInstruction* instr() override { return instr_; } |
4755 | 4755 |
4756 private: | 4756 private: |
4757 LNumberTagU* instr_; | 4757 LNumberTagU* instr_; |
4758 }; | 4758 }; |
4759 | 4759 |
4760 LOperand* input = instr->value(); | 4760 LOperand* input = instr->value(); |
4761 DCHECK(input->IsRegister() && input->Equals(instr->result())); | 4761 DCHECK(input->IsRegister() && input->Equals(instr->result())); |
4762 Register reg = ToRegister(input); | 4762 Register reg = ToRegister(input); |
4763 | 4763 |
4764 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4764 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4824 } | 4824 } |
4825 | 4825 |
4826 // Done. Put the value in temp_xmm into the value of the allocated heap | 4826 // Done. Put the value in temp_xmm into the value of the allocated heap |
4827 // number. | 4827 // number. |
4828 __ bind(&done); | 4828 __ bind(&done); |
4829 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), temp_xmm); | 4829 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), temp_xmm); |
4830 } | 4830 } |
4831 | 4831 |
4832 | 4832 |
4833 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4833 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
4834 class DeferredNumberTagD FINAL : public LDeferredCode { | 4834 class DeferredNumberTagD final : public LDeferredCode { |
4835 public: | 4835 public: |
4836 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4836 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
4837 : LDeferredCode(codegen), instr_(instr) { } | 4837 : LDeferredCode(codegen), instr_(instr) { } |
4838 void Generate() OVERRIDE { codegen()->DoDeferredNumberTagD(instr_); } | 4838 void Generate() override { codegen()->DoDeferredNumberTagD(instr_); } |
4839 LInstruction* instr() OVERRIDE { return instr_; } | 4839 LInstruction* instr() override { return instr_; } |
4840 | 4840 |
4841 private: | 4841 private: |
4842 LNumberTagD* instr_; | 4842 LNumberTagD* instr_; |
4843 }; | 4843 }; |
4844 | 4844 |
4845 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 4845 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
4846 Register reg = ToRegister(instr->result()); | 4846 Register reg = ToRegister(instr->result()); |
4847 Register tmp = ToRegister(instr->temp()); | 4847 Register tmp = ToRegister(instr->temp()); |
4848 | 4848 |
4849 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); | 4849 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5019 __ j(not_zero, done); | 5019 __ j(not_zero, done); |
5020 __ movmskpd(input_reg, xmm0); | 5020 __ movmskpd(input_reg, xmm0); |
5021 __ andl(input_reg, Immediate(1)); | 5021 __ andl(input_reg, Immediate(1)); |
5022 DeoptimizeIf(not_zero, instr, Deoptimizer::kMinusZero); | 5022 DeoptimizeIf(not_zero, instr, Deoptimizer::kMinusZero); |
5023 } | 5023 } |
5024 } | 5024 } |
5025 } | 5025 } |
5026 | 5026 |
5027 | 5027 |
5028 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 5028 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
5029 class DeferredTaggedToI FINAL : public LDeferredCode { | 5029 class DeferredTaggedToI final : public LDeferredCode { |
5030 public: | 5030 public: |
5031 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 5031 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
5032 : LDeferredCode(codegen), instr_(instr) { } | 5032 : LDeferredCode(codegen), instr_(instr) { } |
5033 void Generate() OVERRIDE { codegen()->DoDeferredTaggedToI(instr_, done()); } | 5033 void Generate() override { codegen()->DoDeferredTaggedToI(instr_, done()); } |
5034 LInstruction* instr() OVERRIDE { return instr_; } | 5034 LInstruction* instr() override { return instr_; } |
5035 | 5035 |
5036 private: | 5036 private: |
5037 LTaggedToI* instr_; | 5037 LTaggedToI* instr_; |
5038 }; | 5038 }; |
5039 | 5039 |
5040 LOperand* input = instr->value(); | 5040 LOperand* input = instr->value(); |
5041 DCHECK(input->IsRegister()); | 5041 DCHECK(input->IsRegister()); |
5042 DCHECK(input->Equals(instr->result())); | 5042 DCHECK(input->Equals(instr->result())); |
5043 Register input_reg = ToRegister(input); | 5043 Register input_reg = ToRegister(input); |
5044 | 5044 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5207 RecordSafepointWithRegisters( | 5207 RecordSafepointWithRegisters( |
5208 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); | 5208 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
5209 | 5209 |
5210 __ testp(rax, Immediate(kSmiTagMask)); | 5210 __ testp(rax, Immediate(kSmiTagMask)); |
5211 } | 5211 } |
5212 DeoptimizeIf(zero, instr, Deoptimizer::kInstanceMigrationFailed); | 5212 DeoptimizeIf(zero, instr, Deoptimizer::kInstanceMigrationFailed); |
5213 } | 5213 } |
5214 | 5214 |
5215 | 5215 |
5216 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5216 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
5217 class DeferredCheckMaps FINAL : public LDeferredCode { | 5217 class DeferredCheckMaps final : public LDeferredCode { |
5218 public: | 5218 public: |
5219 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 5219 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
5220 : LDeferredCode(codegen), instr_(instr), object_(object) { | 5220 : LDeferredCode(codegen), instr_(instr), object_(object) { |
5221 SetExit(check_maps()); | 5221 SetExit(check_maps()); |
5222 } | 5222 } |
5223 void Generate() OVERRIDE { | 5223 void Generate() override { |
5224 codegen()->DoDeferredInstanceMigration(instr_, object_); | 5224 codegen()->DoDeferredInstanceMigration(instr_, object_); |
5225 } | 5225 } |
5226 Label* check_maps() { return &check_maps_; } | 5226 Label* check_maps() { return &check_maps_; } |
5227 LInstruction* instr() OVERRIDE { return instr_; } | 5227 LInstruction* instr() override { return instr_; } |
5228 | 5228 |
5229 private: | 5229 private: |
5230 LCheckMaps* instr_; | 5230 LCheckMaps* instr_; |
5231 Label check_maps_; | 5231 Label check_maps_; |
5232 Register object_; | 5232 Register object_; |
5233 }; | 5233 }; |
5234 | 5234 |
5235 if (instr->hydrogen()->IsStabilityCheck()) { | 5235 if (instr->hydrogen()->IsStabilityCheck()) { |
5236 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); | 5236 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); |
5237 for (int i = 0; i < maps->size(); ++i) { | 5237 for (int i = 0; i < maps->size(); ++i) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5339 XMMRegister result_reg = ToDoubleRegister(instr->result()); | 5339 XMMRegister result_reg = ToDoubleRegister(instr->result()); |
5340 XMMRegister xmm_scratch = double_scratch0(); | 5340 XMMRegister xmm_scratch = double_scratch0(); |
5341 __ movd(result_reg, hi_reg); | 5341 __ movd(result_reg, hi_reg); |
5342 __ psllq(result_reg, 32); | 5342 __ psllq(result_reg, 32); |
5343 __ movd(xmm_scratch, lo_reg); | 5343 __ movd(xmm_scratch, lo_reg); |
5344 __ orps(result_reg, xmm_scratch); | 5344 __ orps(result_reg, xmm_scratch); |
5345 } | 5345 } |
5346 | 5346 |
5347 | 5347 |
5348 void LCodeGen::DoAllocate(LAllocate* instr) { | 5348 void LCodeGen::DoAllocate(LAllocate* instr) { |
5349 class DeferredAllocate FINAL : public LDeferredCode { | 5349 class DeferredAllocate final : public LDeferredCode { |
5350 public: | 5350 public: |
5351 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5351 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
5352 : LDeferredCode(codegen), instr_(instr) { } | 5352 : LDeferredCode(codegen), instr_(instr) { } |
5353 void Generate() OVERRIDE { codegen()->DoDeferredAllocate(instr_); } | 5353 void Generate() override { codegen()->DoDeferredAllocate(instr_); } |
5354 LInstruction* instr() OVERRIDE { return instr_; } | 5354 LInstruction* instr() override { return instr_; } |
5355 | 5355 |
5356 private: | 5356 private: |
5357 LAllocate* instr_; | 5357 LAllocate* instr_; |
5358 }; | 5358 }; |
5359 | 5359 |
5360 DeferredAllocate* deferred = | 5360 DeferredAllocate* deferred = |
5361 new(zone()) DeferredAllocate(this, instr); | 5361 new(zone()) DeferredAllocate(this, instr); |
5362 | 5362 |
5363 Register result = ToRegister(instr->result()); | 5363 Register result = ToRegister(instr->result()); |
5364 Register temp = ToRegister(instr->temp()); | 5364 Register temp = ToRegister(instr->temp()); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5703 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 5703 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
5704 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 5704 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
5705 RecordSafepointWithLazyDeopt(instr, RECORD_SAFEPOINT_WITH_REGISTERS, 0); | 5705 RecordSafepointWithLazyDeopt(instr, RECORD_SAFEPOINT_WITH_REGISTERS, 0); |
5706 DCHECK(instr->HasEnvironment()); | 5706 DCHECK(instr->HasEnvironment()); |
5707 LEnvironment* env = instr->environment(); | 5707 LEnvironment* env = instr->environment(); |
5708 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5708 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5709 } | 5709 } |
5710 | 5710 |
5711 | 5711 |
5712 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5712 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
5713 class DeferredStackCheck FINAL : public LDeferredCode { | 5713 class DeferredStackCheck final : public LDeferredCode { |
5714 public: | 5714 public: |
5715 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 5715 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
5716 : LDeferredCode(codegen), instr_(instr) { } | 5716 : LDeferredCode(codegen), instr_(instr) { } |
5717 void Generate() OVERRIDE { codegen()->DoDeferredStackCheck(instr_); } | 5717 void Generate() override { codegen()->DoDeferredStackCheck(instr_); } |
5718 LInstruction* instr() OVERRIDE { return instr_; } | 5718 LInstruction* instr() override { return instr_; } |
5719 | 5719 |
5720 private: | 5720 private: |
5721 LStackCheck* instr_; | 5721 LStackCheck* instr_; |
5722 }; | 5722 }; |
5723 | 5723 |
5724 DCHECK(instr->HasEnvironment()); | 5724 DCHECK(instr->HasEnvironment()); |
5725 LEnvironment* env = instr->environment(); | 5725 LEnvironment* env = instr->environment(); |
5726 // There is no LLazyBailout instruction for stack-checks. We have to | 5726 // There is no LLazyBailout instruction for stack-checks. We have to |
5727 // prepare for lazy deoptimization explicitly here. | 5727 // prepare for lazy deoptimization explicitly here. |
5728 if (instr->hydrogen()->is_function_entry()) { | 5728 if (instr->hydrogen()->is_function_entry()) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5839 __ Push(index); | 5839 __ Push(index); |
5840 __ xorp(rsi, rsi); | 5840 __ xorp(rsi, rsi); |
5841 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); | 5841 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); |
5842 RecordSafepointWithRegisters( | 5842 RecordSafepointWithRegisters( |
5843 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); | 5843 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); |
5844 __ StoreToSafepointRegisterSlot(object, rax); | 5844 __ StoreToSafepointRegisterSlot(object, rax); |
5845 } | 5845 } |
5846 | 5846 |
5847 | 5847 |
5848 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { | 5848 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
5849 class DeferredLoadMutableDouble FINAL : public LDeferredCode { | 5849 class DeferredLoadMutableDouble final : public LDeferredCode { |
5850 public: | 5850 public: |
5851 DeferredLoadMutableDouble(LCodeGen* codegen, | 5851 DeferredLoadMutableDouble(LCodeGen* codegen, |
5852 LLoadFieldByIndex* instr, | 5852 LLoadFieldByIndex* instr, |
5853 Register object, | 5853 Register object, |
5854 Register index) | 5854 Register index) |
5855 : LDeferredCode(codegen), | 5855 : LDeferredCode(codegen), |
5856 instr_(instr), | 5856 instr_(instr), |
5857 object_(object), | 5857 object_(object), |
5858 index_(index) { | 5858 index_(index) { |
5859 } | 5859 } |
5860 void Generate() OVERRIDE { | 5860 void Generate() override { |
5861 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); | 5861 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); |
5862 } | 5862 } |
5863 LInstruction* instr() OVERRIDE { return instr_; } | 5863 LInstruction* instr() override { return instr_; } |
5864 | 5864 |
5865 private: | 5865 private: |
5866 LLoadFieldByIndex* instr_; | 5866 LLoadFieldByIndex* instr_; |
5867 Register object_; | 5867 Register object_; |
5868 Register index_; | 5868 Register index_; |
5869 }; | 5869 }; |
5870 | 5870 |
5871 Register object = ToRegister(instr->object()); | 5871 Register object = ToRegister(instr->object()); |
5872 Register index = ToRegister(instr->index()); | 5872 Register index = ToRegister(instr->index()); |
5873 | 5873 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5916 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5916 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5917 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5917 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5918 } | 5918 } |
5919 | 5919 |
5920 | 5920 |
5921 #undef __ | 5921 #undef __ |
5922 | 5922 |
5923 } } // namespace v8::internal | 5923 } } // namespace v8::internal |
5924 | 5924 |
5925 #endif // V8_TARGET_ARCH_X64 | 5925 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |