OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arm/lithium-codegen-arm.h" | 7 #include "src/arm/lithium-codegen-arm.h" |
8 #include "src/arm/lithium-gap-resolver-arm.h" | 8 #include "src/arm/lithium-gap-resolver-arm.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 | 15 |
16 class SafepointGenerator V8_FINAL : public CallWrapper { | 16 class SafepointGenerator FINAL : public CallWrapper { |
17 public: | 17 public: |
18 SafepointGenerator(LCodeGen* codegen, | 18 SafepointGenerator(LCodeGen* codegen, |
19 LPointerMap* pointers, | 19 LPointerMap* pointers, |
20 Safepoint::DeoptMode mode) | 20 Safepoint::DeoptMode mode) |
21 : codegen_(codegen), | 21 : codegen_(codegen), |
22 pointers_(pointers), | 22 pointers_(pointers), |
23 deopt_mode_(mode) { } | 23 deopt_mode_(mode) { } |
24 virtual ~SafepointGenerator() {} | 24 virtual ~SafepointGenerator() {} |
25 | 25 |
26 virtual void BeforeCall(int call_size) const V8_OVERRIDE {} | 26 virtual void BeforeCall(int call_size) const OVERRIDE {} |
27 | 27 |
28 virtual void AfterCall() const V8_OVERRIDE { | 28 virtual void AfterCall() const OVERRIDE { |
29 codegen_->RecordSafepoint(pointers_, deopt_mode_); | 29 codegen_->RecordSafepoint(pointers_, deopt_mode_); |
30 } | 30 } |
31 | 31 |
32 private: | 32 private: |
33 LCodeGen* codegen_; | 33 LCodeGen* codegen_; |
34 LPointerMap* pointers_; | 34 LPointerMap* pointers_; |
35 Safepoint::DeoptMode deopt_mode_; | 35 Safepoint::DeoptMode deopt_mode_; |
36 }; | 36 }; |
37 | 37 |
38 | 38 |
(...skipping 2733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2772 InstanceofStub stub(isolate(), InstanceofStub::kArgsInRegisters); | 2772 InstanceofStub stub(isolate(), InstanceofStub::kArgsInRegisters); |
2773 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2773 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
2774 | 2774 |
2775 __ cmp(r0, Operand::Zero()); | 2775 __ cmp(r0, Operand::Zero()); |
2776 __ mov(r0, Operand(factory()->false_value()), LeaveCC, ne); | 2776 __ mov(r0, Operand(factory()->false_value()), LeaveCC, ne); |
2777 __ mov(r0, Operand(factory()->true_value()), LeaveCC, eq); | 2777 __ mov(r0, Operand(factory()->true_value()), LeaveCC, eq); |
2778 } | 2778 } |
2779 | 2779 |
2780 | 2780 |
2781 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2781 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
2782 class DeferredInstanceOfKnownGlobal V8_FINAL : public LDeferredCode { | 2782 class DeferredInstanceOfKnownGlobal FINAL : public LDeferredCode { |
2783 public: | 2783 public: |
2784 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2784 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
2785 LInstanceOfKnownGlobal* instr) | 2785 LInstanceOfKnownGlobal* instr) |
2786 : LDeferredCode(codegen), instr_(instr) { } | 2786 : LDeferredCode(codegen), instr_(instr) { } |
2787 virtual void Generate() V8_OVERRIDE { | 2787 virtual void Generate() OVERRIDE { |
2788 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_, | 2788 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_, |
2789 &load_bool_); | 2789 &load_bool_); |
2790 } | 2790 } |
2791 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 2791 virtual LInstruction* instr() OVERRIDE { return instr_; } |
2792 Label* map_check() { return &map_check_; } | 2792 Label* map_check() { return &map_check_; } |
2793 Label* load_bool() { return &load_bool_; } | 2793 Label* load_bool() { return &load_bool_; } |
2794 | 2794 |
2795 private: | 2795 private: |
2796 LInstanceOfKnownGlobal* instr_; | 2796 LInstanceOfKnownGlobal* instr_; |
2797 Label map_check_; | 2797 Label map_check_; |
2798 Label load_bool_; | 2798 Label load_bool_; |
2799 }; | 2799 }; |
2800 | 2800 |
2801 DeferredInstanceOfKnownGlobal* deferred; | 2801 DeferredInstanceOfKnownGlobal* deferred; |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3746 // will clear the V (overflow) flag and rsb won't set this flag | 3746 // will clear the V (overflow) flag and rsb won't set this flag |
3747 // if input is positive. | 3747 // if input is positive. |
3748 __ rsb(result, input, Operand::Zero(), SetCC, mi); | 3748 __ rsb(result, input, Operand::Zero(), SetCC, mi); |
3749 // Deoptimize on overflow. | 3749 // Deoptimize on overflow. |
3750 DeoptimizeIf(vs, instr->environment()); | 3750 DeoptimizeIf(vs, instr->environment()); |
3751 } | 3751 } |
3752 | 3752 |
3753 | 3753 |
3754 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3754 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
3755 // Class for deferred case. | 3755 // Class for deferred case. |
3756 class DeferredMathAbsTaggedHeapNumber V8_FINAL : public LDeferredCode { | 3756 class DeferredMathAbsTaggedHeapNumber FINAL : public LDeferredCode { |
3757 public: | 3757 public: |
3758 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) | 3758 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) |
3759 : LDeferredCode(codegen), instr_(instr) { } | 3759 : LDeferredCode(codegen), instr_(instr) { } |
3760 virtual void Generate() V8_OVERRIDE { | 3760 virtual void Generate() OVERRIDE { |
3761 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3761 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
3762 } | 3762 } |
3763 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 3763 virtual LInstruction* instr() OVERRIDE { return instr_; } |
3764 private: | 3764 private: |
3765 LMathAbs* instr_; | 3765 LMathAbs* instr_; |
3766 }; | 3766 }; |
3767 | 3767 |
3768 Representation r = instr->hydrogen()->value()->representation(); | 3768 Representation r = instr->hydrogen()->value()->representation(); |
3769 if (r.IsDouble()) { | 3769 if (r.IsDouble()) { |
3770 DwVfpRegister input = ToDoubleRegister(instr->value()); | 3770 DwVfpRegister input = ToDoubleRegister(instr->value()); |
3771 DwVfpRegister result = ToDoubleRegister(instr->result()); | 3771 DwVfpRegister result = ToDoubleRegister(instr->result()); |
3772 __ vabs(result, input); | 3772 __ vabs(result, input); |
3773 } else if (r.IsSmiOrInteger32()) { | 3773 } else if (r.IsSmiOrInteger32()) { |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4485 DCHECK(ToRegister(instr->left()).is(r1)); | 4485 DCHECK(ToRegister(instr->left()).is(r1)); |
4486 DCHECK(ToRegister(instr->right()).is(r0)); | 4486 DCHECK(ToRegister(instr->right()).is(r0)); |
4487 StringAddStub stub(isolate(), | 4487 StringAddStub stub(isolate(), |
4488 instr->hydrogen()->flags(), | 4488 instr->hydrogen()->flags(), |
4489 instr->hydrogen()->pretenure_flag()); | 4489 instr->hydrogen()->pretenure_flag()); |
4490 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4490 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4491 } | 4491 } |
4492 | 4492 |
4493 | 4493 |
4494 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 4494 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
4495 class DeferredStringCharCodeAt V8_FINAL : public LDeferredCode { | 4495 class DeferredStringCharCodeAt FINAL : public LDeferredCode { |
4496 public: | 4496 public: |
4497 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) | 4497 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) |
4498 : LDeferredCode(codegen), instr_(instr) { } | 4498 : LDeferredCode(codegen), instr_(instr) { } |
4499 virtual void Generate() V8_OVERRIDE { | 4499 virtual void Generate() OVERRIDE { |
4500 codegen()->DoDeferredStringCharCodeAt(instr_); | 4500 codegen()->DoDeferredStringCharCodeAt(instr_); |
4501 } | 4501 } |
4502 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4502 virtual LInstruction* instr() OVERRIDE { return instr_; } |
4503 private: | 4503 private: |
4504 LStringCharCodeAt* instr_; | 4504 LStringCharCodeAt* instr_; |
4505 }; | 4505 }; |
4506 | 4506 |
4507 DeferredStringCharCodeAt* deferred = | 4507 DeferredStringCharCodeAt* deferred = |
4508 new(zone()) DeferredStringCharCodeAt(this, instr); | 4508 new(zone()) DeferredStringCharCodeAt(this, instr); |
4509 | 4509 |
4510 StringCharLoadGenerator::Generate(masm(), | 4510 StringCharLoadGenerator::Generate(masm(), |
4511 ToRegister(instr->string()), | 4511 ToRegister(instr->string()), |
4512 ToRegister(instr->index()), | 4512 ToRegister(instr->index()), |
(...skipping 28 matching lines...) Expand all Loading... |
4541 } | 4541 } |
4542 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, instr, | 4542 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, instr, |
4543 instr->context()); | 4543 instr->context()); |
4544 __ AssertSmi(r0); | 4544 __ AssertSmi(r0); |
4545 __ SmiUntag(r0); | 4545 __ SmiUntag(r0); |
4546 __ StoreToSafepointRegisterSlot(r0, result); | 4546 __ StoreToSafepointRegisterSlot(r0, result); |
4547 } | 4547 } |
4548 | 4548 |
4549 | 4549 |
4550 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4550 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
4551 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { | 4551 class DeferredStringCharFromCode FINAL : public LDeferredCode { |
4552 public: | 4552 public: |
4553 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4553 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
4554 : LDeferredCode(codegen), instr_(instr) { } | 4554 : LDeferredCode(codegen), instr_(instr) { } |
4555 virtual void Generate() V8_OVERRIDE { | 4555 virtual void Generate() OVERRIDE { |
4556 codegen()->DoDeferredStringCharFromCode(instr_); | 4556 codegen()->DoDeferredStringCharFromCode(instr_); |
4557 } | 4557 } |
4558 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4558 virtual LInstruction* instr() OVERRIDE { return instr_; } |
4559 private: | 4559 private: |
4560 LStringCharFromCode* instr_; | 4560 LStringCharFromCode* instr_; |
4561 }; | 4561 }; |
4562 | 4562 |
4563 DeferredStringCharFromCode* deferred = | 4563 DeferredStringCharFromCode* deferred = |
4564 new(zone()) DeferredStringCharFromCode(this, instr); | 4564 new(zone()) DeferredStringCharFromCode(this, instr); |
4565 | 4565 |
4566 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); | 4566 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); |
4567 Register char_code = ToRegister(instr->char_code()); | 4567 Register char_code = ToRegister(instr->char_code()); |
4568 Register result = ToRegister(instr->result()); | 4568 Register result = ToRegister(instr->result()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4618 LOperand* input = instr->value(); | 4618 LOperand* input = instr->value(); |
4619 LOperand* output = instr->result(); | 4619 LOperand* output = instr->result(); |
4620 | 4620 |
4621 SwVfpRegister flt_scratch = double_scratch0().low(); | 4621 SwVfpRegister flt_scratch = double_scratch0().low(); |
4622 __ vmov(flt_scratch, ToRegister(input)); | 4622 __ vmov(flt_scratch, ToRegister(input)); |
4623 __ vcvt_f64_u32(ToDoubleRegister(output), flt_scratch); | 4623 __ vcvt_f64_u32(ToDoubleRegister(output), flt_scratch); |
4624 } | 4624 } |
4625 | 4625 |
4626 | 4626 |
4627 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4627 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4628 class DeferredNumberTagI V8_FINAL : public LDeferredCode { | 4628 class DeferredNumberTagI FINAL : public LDeferredCode { |
4629 public: | 4629 public: |
4630 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4630 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4631 : LDeferredCode(codegen), instr_(instr) { } | 4631 : LDeferredCode(codegen), instr_(instr) { } |
4632 virtual void Generate() V8_OVERRIDE { | 4632 virtual void Generate() OVERRIDE { |
4633 codegen()->DoDeferredNumberTagIU(instr_, | 4633 codegen()->DoDeferredNumberTagIU(instr_, |
4634 instr_->value(), | 4634 instr_->value(), |
4635 instr_->temp1(), | 4635 instr_->temp1(), |
4636 instr_->temp2(), | 4636 instr_->temp2(), |
4637 SIGNED_INT32); | 4637 SIGNED_INT32); |
4638 } | 4638 } |
4639 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4639 virtual LInstruction* instr() OVERRIDE { return instr_; } |
4640 private: | 4640 private: |
4641 LNumberTagI* instr_; | 4641 LNumberTagI* instr_; |
4642 }; | 4642 }; |
4643 | 4643 |
4644 Register src = ToRegister(instr->value()); | 4644 Register src = ToRegister(instr->value()); |
4645 Register dst = ToRegister(instr->result()); | 4645 Register dst = ToRegister(instr->result()); |
4646 | 4646 |
4647 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); | 4647 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); |
4648 __ SmiTag(dst, src, SetCC); | 4648 __ SmiTag(dst, src, SetCC); |
4649 __ b(vs, deferred->entry()); | 4649 __ b(vs, deferred->entry()); |
4650 __ bind(deferred->exit()); | 4650 __ bind(deferred->exit()); |
4651 } | 4651 } |
4652 | 4652 |
4653 | 4653 |
4654 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4654 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4655 class DeferredNumberTagU V8_FINAL : public LDeferredCode { | 4655 class DeferredNumberTagU FINAL : public LDeferredCode { |
4656 public: | 4656 public: |
4657 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4657 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4658 : LDeferredCode(codegen), instr_(instr) { } | 4658 : LDeferredCode(codegen), instr_(instr) { } |
4659 virtual void Generate() V8_OVERRIDE { | 4659 virtual void Generate() OVERRIDE { |
4660 codegen()->DoDeferredNumberTagIU(instr_, | 4660 codegen()->DoDeferredNumberTagIU(instr_, |
4661 instr_->value(), | 4661 instr_->value(), |
4662 instr_->temp1(), | 4662 instr_->temp1(), |
4663 instr_->temp2(), | 4663 instr_->temp2(), |
4664 UNSIGNED_INT32); | 4664 UNSIGNED_INT32); |
4665 } | 4665 } |
4666 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4666 virtual LInstruction* instr() OVERRIDE { return instr_; } |
4667 private: | 4667 private: |
4668 LNumberTagU* instr_; | 4668 LNumberTagU* instr_; |
4669 }; | 4669 }; |
4670 | 4670 |
4671 Register input = ToRegister(instr->value()); | 4671 Register input = ToRegister(instr->value()); |
4672 Register result = ToRegister(instr->result()); | 4672 Register result = ToRegister(instr->result()); |
4673 | 4673 |
4674 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4674 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
4675 __ cmp(input, Operand(Smi::kMaxValue)); | 4675 __ cmp(input, Operand(Smi::kMaxValue)); |
4676 __ b(hi, deferred->entry()); | 4676 __ b(hi, deferred->entry()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4739 | 4739 |
4740 // Done. Put the value in dbl_scratch into the value of the allocated heap | 4740 // Done. Put the value in dbl_scratch into the value of the allocated heap |
4741 // number. | 4741 // number. |
4742 __ bind(&done); | 4742 __ bind(&done); |
4743 __ vstr(dbl_scratch, dst, HeapNumber::kValueOffset); | 4743 __ vstr(dbl_scratch, dst, HeapNumber::kValueOffset); |
4744 __ add(dst, dst, Operand(kHeapObjectTag)); | 4744 __ add(dst, dst, Operand(kHeapObjectTag)); |
4745 } | 4745 } |
4746 | 4746 |
4747 | 4747 |
4748 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4748 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
4749 class DeferredNumberTagD V8_FINAL : public LDeferredCode { | 4749 class DeferredNumberTagD FINAL : public LDeferredCode { |
4750 public: | 4750 public: |
4751 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4751 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
4752 : LDeferredCode(codegen), instr_(instr) { } | 4752 : LDeferredCode(codegen), instr_(instr) { } |
4753 virtual void Generate() V8_OVERRIDE { | 4753 virtual void Generate() OVERRIDE { |
4754 codegen()->DoDeferredNumberTagD(instr_); | 4754 codegen()->DoDeferredNumberTagD(instr_); |
4755 } | 4755 } |
4756 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4756 virtual LInstruction* instr() OVERRIDE { return instr_; } |
4757 private: | 4757 private: |
4758 LNumberTagD* instr_; | 4758 LNumberTagD* instr_; |
4759 }; | 4759 }; |
4760 | 4760 |
4761 DwVfpRegister input_reg = ToDoubleRegister(instr->value()); | 4761 DwVfpRegister input_reg = ToDoubleRegister(instr->value()); |
4762 Register scratch = scratch0(); | 4762 Register scratch = scratch0(); |
4763 Register reg = ToRegister(instr->result()); | 4763 Register reg = ToRegister(instr->result()); |
4764 Register temp1 = ToRegister(instr->temp()); | 4764 Register temp1 = ToRegister(instr->temp()); |
4765 Register temp2 = ToRegister(instr->temp2()); | 4765 Register temp2 = ToRegister(instr->temp2()); |
4766 | 4766 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4959 __ VmovHigh(scratch1, double_scratch2); | 4959 __ VmovHigh(scratch1, double_scratch2); |
4960 __ tst(scratch1, Operand(HeapNumber::kSignMask)); | 4960 __ tst(scratch1, Operand(HeapNumber::kSignMask)); |
4961 DeoptimizeIf(ne, instr->environment()); | 4961 DeoptimizeIf(ne, instr->environment()); |
4962 } | 4962 } |
4963 } | 4963 } |
4964 __ bind(&done); | 4964 __ bind(&done); |
4965 } | 4965 } |
4966 | 4966 |
4967 | 4967 |
4968 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4968 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
4969 class DeferredTaggedToI V8_FINAL : public LDeferredCode { | 4969 class DeferredTaggedToI FINAL : public LDeferredCode { |
4970 public: | 4970 public: |
4971 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4971 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
4972 : LDeferredCode(codegen), instr_(instr) { } | 4972 : LDeferredCode(codegen), instr_(instr) { } |
4973 virtual void Generate() V8_OVERRIDE { | 4973 virtual void Generate() OVERRIDE { |
4974 codegen()->DoDeferredTaggedToI(instr_); | 4974 codegen()->DoDeferredTaggedToI(instr_); |
4975 } | 4975 } |
4976 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4976 virtual LInstruction* instr() OVERRIDE { return instr_; } |
4977 private: | 4977 private: |
4978 LTaggedToI* instr_; | 4978 LTaggedToI* instr_; |
4979 }; | 4979 }; |
4980 | 4980 |
4981 LOperand* input = instr->value(); | 4981 LOperand* input = instr->value(); |
4982 DCHECK(input->IsRegister()); | 4982 DCHECK(input->IsRegister()); |
4983 DCHECK(input->Equals(instr->result())); | 4983 DCHECK(input->Equals(instr->result())); |
4984 | 4984 |
4985 Register input_reg = ToRegister(input); | 4985 Register input_reg = ToRegister(input); |
4986 | 4986 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5158 RecordSafepointWithRegisters( | 5158 RecordSafepointWithRegisters( |
5159 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); | 5159 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
5160 __ StoreToSafepointRegisterSlot(r0, scratch0()); | 5160 __ StoreToSafepointRegisterSlot(r0, scratch0()); |
5161 } | 5161 } |
5162 __ tst(scratch0(), Operand(kSmiTagMask)); | 5162 __ tst(scratch0(), Operand(kSmiTagMask)); |
5163 DeoptimizeIf(eq, instr->environment()); | 5163 DeoptimizeIf(eq, instr->environment()); |
5164 } | 5164 } |
5165 | 5165 |
5166 | 5166 |
5167 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5167 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
5168 class DeferredCheckMaps V8_FINAL : public LDeferredCode { | 5168 class DeferredCheckMaps FINAL : public LDeferredCode { |
5169 public: | 5169 public: |
5170 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 5170 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
5171 : LDeferredCode(codegen), instr_(instr), object_(object) { | 5171 : LDeferredCode(codegen), instr_(instr), object_(object) { |
5172 SetExit(check_maps()); | 5172 SetExit(check_maps()); |
5173 } | 5173 } |
5174 virtual void Generate() V8_OVERRIDE { | 5174 virtual void Generate() OVERRIDE { |
5175 codegen()->DoDeferredInstanceMigration(instr_, object_); | 5175 codegen()->DoDeferredInstanceMigration(instr_, object_); |
5176 } | 5176 } |
5177 Label* check_maps() { return &check_maps_; } | 5177 Label* check_maps() { return &check_maps_; } |
5178 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5178 virtual LInstruction* instr() OVERRIDE { return instr_; } |
5179 private: | 5179 private: |
5180 LCheckMaps* instr_; | 5180 LCheckMaps* instr_; |
5181 Label check_maps_; | 5181 Label check_maps_; |
5182 Register object_; | 5182 Register object_; |
5183 }; | 5183 }; |
5184 | 5184 |
5185 if (instr->hydrogen()->IsStabilityCheck()) { | 5185 if (instr->hydrogen()->IsStabilityCheck()) { |
5186 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); | 5186 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); |
5187 for (int i = 0; i < maps->size(); ++i) { | 5187 for (int i = 0; i < maps->size(); ++i) { |
5188 AddStabilityDependency(maps->at(i).handle()); | 5188 AddStabilityDependency(maps->at(i).handle()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5288 void LCodeGen::DoConstructDouble(LConstructDouble* instr) { | 5288 void LCodeGen::DoConstructDouble(LConstructDouble* instr) { |
5289 Register hi_reg = ToRegister(instr->hi()); | 5289 Register hi_reg = ToRegister(instr->hi()); |
5290 Register lo_reg = ToRegister(instr->lo()); | 5290 Register lo_reg = ToRegister(instr->lo()); |
5291 DwVfpRegister result_reg = ToDoubleRegister(instr->result()); | 5291 DwVfpRegister result_reg = ToDoubleRegister(instr->result()); |
5292 __ VmovHigh(result_reg, hi_reg); | 5292 __ VmovHigh(result_reg, hi_reg); |
5293 __ VmovLow(result_reg, lo_reg); | 5293 __ VmovLow(result_reg, lo_reg); |
5294 } | 5294 } |
5295 | 5295 |
5296 | 5296 |
5297 void LCodeGen::DoAllocate(LAllocate* instr) { | 5297 void LCodeGen::DoAllocate(LAllocate* instr) { |
5298 class DeferredAllocate V8_FINAL : public LDeferredCode { | 5298 class DeferredAllocate FINAL : public LDeferredCode { |
5299 public: | 5299 public: |
5300 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5300 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
5301 : LDeferredCode(codegen), instr_(instr) { } | 5301 : LDeferredCode(codegen), instr_(instr) { } |
5302 virtual void Generate() V8_OVERRIDE { | 5302 virtual void Generate() OVERRIDE { |
5303 codegen()->DoDeferredAllocate(instr_); | 5303 codegen()->DoDeferredAllocate(instr_); |
5304 } | 5304 } |
5305 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5305 virtual LInstruction* instr() OVERRIDE { return instr_; } |
5306 private: | 5306 private: |
5307 LAllocate* instr_; | 5307 LAllocate* instr_; |
5308 }; | 5308 }; |
5309 | 5309 |
5310 DeferredAllocate* deferred = | 5310 DeferredAllocate* deferred = |
5311 new(zone()) DeferredAllocate(this, instr); | 5311 new(zone()) DeferredAllocate(this, instr); |
5312 | 5312 |
5313 Register result = ToRegister(instr->result()); | 5313 Register result = ToRegister(instr->result()); |
5314 Register scratch = ToRegister(instr->temp1()); | 5314 Register scratch = ToRegister(instr->temp1()); |
5315 Register scratch2 = ToRegister(instr->temp2()); | 5315 Register scratch2 = ToRegister(instr->temp2()); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5655 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 5655 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
5656 RecordSafepointWithLazyDeopt( | 5656 RecordSafepointWithLazyDeopt( |
5657 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 5657 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
5658 DCHECK(instr->HasEnvironment()); | 5658 DCHECK(instr->HasEnvironment()); |
5659 LEnvironment* env = instr->environment(); | 5659 LEnvironment* env = instr->environment(); |
5660 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5660 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5661 } | 5661 } |
5662 | 5662 |
5663 | 5663 |
5664 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5664 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
5665 class DeferredStackCheck V8_FINAL : public LDeferredCode { | 5665 class DeferredStackCheck FINAL : public LDeferredCode { |
5666 public: | 5666 public: |
5667 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 5667 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
5668 : LDeferredCode(codegen), instr_(instr) { } | 5668 : LDeferredCode(codegen), instr_(instr) { } |
5669 virtual void Generate() V8_OVERRIDE { | 5669 virtual void Generate() OVERRIDE { |
5670 codegen()->DoDeferredStackCheck(instr_); | 5670 codegen()->DoDeferredStackCheck(instr_); |
5671 } | 5671 } |
5672 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5672 virtual LInstruction* instr() OVERRIDE { return instr_; } |
5673 private: | 5673 private: |
5674 LStackCheck* instr_; | 5674 LStackCheck* instr_; |
5675 }; | 5675 }; |
5676 | 5676 |
5677 DCHECK(instr->HasEnvironment()); | 5677 DCHECK(instr->HasEnvironment()); |
5678 LEnvironment* env = instr->environment(); | 5678 LEnvironment* env = instr->environment(); |
5679 // There is no LLazyBailout instruction for stack-checks. We have to | 5679 // There is no LLazyBailout instruction for stack-checks. We have to |
5680 // prepare for lazy deoptimization explicitly here. | 5680 // prepare for lazy deoptimization explicitly here. |
5681 if (instr->hydrogen()->is_function_entry()) { | 5681 if (instr->hydrogen()->is_function_entry()) { |
5682 // Perform stack overflow check. | 5682 // Perform stack overflow check. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5802 __ Push(index); | 5802 __ Push(index); |
5803 __ mov(cp, Operand::Zero()); | 5803 __ mov(cp, Operand::Zero()); |
5804 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); | 5804 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); |
5805 RecordSafepointWithRegisters( | 5805 RecordSafepointWithRegisters( |
5806 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); | 5806 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); |
5807 __ StoreToSafepointRegisterSlot(r0, result); | 5807 __ StoreToSafepointRegisterSlot(r0, result); |
5808 } | 5808 } |
5809 | 5809 |
5810 | 5810 |
5811 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { | 5811 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
5812 class DeferredLoadMutableDouble V8_FINAL : public LDeferredCode { | 5812 class DeferredLoadMutableDouble FINAL : public LDeferredCode { |
5813 public: | 5813 public: |
5814 DeferredLoadMutableDouble(LCodeGen* codegen, | 5814 DeferredLoadMutableDouble(LCodeGen* codegen, |
5815 LLoadFieldByIndex* instr, | 5815 LLoadFieldByIndex* instr, |
5816 Register result, | 5816 Register result, |
5817 Register object, | 5817 Register object, |
5818 Register index) | 5818 Register index) |
5819 : LDeferredCode(codegen), | 5819 : LDeferredCode(codegen), |
5820 instr_(instr), | 5820 instr_(instr), |
5821 result_(result), | 5821 result_(result), |
5822 object_(object), | 5822 object_(object), |
5823 index_(index) { | 5823 index_(index) { |
5824 } | 5824 } |
5825 virtual void Generate() V8_OVERRIDE { | 5825 virtual void Generate() OVERRIDE { |
5826 codegen()->DoDeferredLoadMutableDouble(instr_, result_, object_, index_); | 5826 codegen()->DoDeferredLoadMutableDouble(instr_, result_, object_, index_); |
5827 } | 5827 } |
5828 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5828 virtual LInstruction* instr() OVERRIDE { return instr_; } |
5829 private: | 5829 private: |
5830 LLoadFieldByIndex* instr_; | 5830 LLoadFieldByIndex* instr_; |
5831 Register result_; | 5831 Register result_; |
5832 Register object_; | 5832 Register object_; |
5833 Register index_; | 5833 Register index_; |
5834 }; | 5834 }; |
5835 | 5835 |
5836 Register object = ToRegister(instr->object()); | 5836 Register object = ToRegister(instr->object()); |
5837 Register index = ToRegister(instr->index()); | 5837 Register index = ToRegister(instr->index()); |
5838 Register result = ToRegister(instr->result()); | 5838 Register result = ToRegister(instr->result()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5879 __ Push(scope_info); | 5879 __ Push(scope_info); |
5880 __ push(ToRegister(instr->function())); | 5880 __ push(ToRegister(instr->function())); |
5881 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5881 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5882 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5882 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5883 } | 5883 } |
5884 | 5884 |
5885 | 5885 |
5886 #undef __ | 5886 #undef __ |
5887 | 5887 |
5888 } } // namespace v8::internal | 5888 } } // namespace v8::internal |
OLD | NEW |