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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #include "arm/lithium-codegen-arm.h" | 30 #include "arm/lithium-codegen-arm.h" |
31 #include "arm/lithium-gap-resolver-arm.h" | 31 #include "arm/lithium-gap-resolver-arm.h" |
32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
33 #include "stub-cache.h" | 33 #include "stub-cache.h" |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 | 38 |
39 class SafepointGenerator V8_FINAL : public CallWrapper { | 39 class SafepointGenerator : public CallWrapper { |
40 public: | 40 public: |
41 SafepointGenerator(LCodeGen* codegen, | 41 SafepointGenerator(LCodeGen* codegen, |
42 LPointerMap* pointers, | 42 LPointerMap* pointers, |
43 Safepoint::DeoptMode mode) | 43 Safepoint::DeoptMode mode) |
44 : codegen_(codegen), | 44 : codegen_(codegen), |
45 pointers_(pointers), | 45 pointers_(pointers), |
46 deopt_mode_(mode) { } | 46 deopt_mode_(mode) { } |
47 virtual ~SafepointGenerator() {} | 47 virtual ~SafepointGenerator() { } |
48 | 48 |
49 virtual void BeforeCall(int call_size) const V8_OVERRIDE {} | 49 virtual void BeforeCall(int call_size) const { } |
50 | 50 |
51 virtual void AfterCall() const V8_OVERRIDE { | 51 virtual void AfterCall() const { |
52 codegen_->RecordSafepoint(pointers_, deopt_mode_); | 52 codegen_->RecordSafepoint(pointers_, deopt_mode_); |
53 } | 53 } |
54 | 54 |
55 private: | 55 private: |
56 LCodeGen* codegen_; | 56 LCodeGen* codegen_; |
57 LPointerMap* pointers_; | 57 LPointerMap* pointers_; |
58 Safepoint::DeoptMode deopt_mode_; | 58 Safepoint::DeoptMode deopt_mode_; |
59 }; | 59 }; |
60 | 60 |
61 | 61 |
(...skipping 2665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 InstanceofStub stub(InstanceofStub::kArgsInRegisters); | 2727 InstanceofStub stub(InstanceofStub::kArgsInRegisters); |
2728 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 2728 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
2729 | 2729 |
2730 __ cmp(r0, Operand::Zero()); | 2730 __ cmp(r0, Operand::Zero()); |
2731 __ mov(r0, Operand(factory()->false_value()), LeaveCC, ne); | 2731 __ mov(r0, Operand(factory()->false_value()), LeaveCC, ne); |
2732 __ mov(r0, Operand(factory()->true_value()), LeaveCC, eq); | 2732 __ mov(r0, Operand(factory()->true_value()), LeaveCC, eq); |
2733 } | 2733 } |
2734 | 2734 |
2735 | 2735 |
2736 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2736 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
2737 class DeferredInstanceOfKnownGlobal V8_FINAL : public LDeferredCode { | 2737 class DeferredInstanceOfKnownGlobal: public LDeferredCode { |
2738 public: | 2738 public: |
2739 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2739 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
2740 LInstanceOfKnownGlobal* instr) | 2740 LInstanceOfKnownGlobal* instr) |
2741 : LDeferredCode(codegen), instr_(instr) { } | 2741 : LDeferredCode(codegen), instr_(instr) { } |
2742 virtual void Generate() V8_OVERRIDE { | 2742 virtual void Generate() { |
2743 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2743 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
2744 } | 2744 } |
2745 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 2745 virtual LInstruction* instr() { return instr_; } |
2746 Label* map_check() { return &map_check_; } | 2746 Label* map_check() { return &map_check_; } |
2747 private: | 2747 private: |
2748 LInstanceOfKnownGlobal* instr_; | 2748 LInstanceOfKnownGlobal* instr_; |
2749 Label map_check_; | 2749 Label map_check_; |
2750 }; | 2750 }; |
2751 | 2751 |
2752 DeferredInstanceOfKnownGlobal* deferred; | 2752 DeferredInstanceOfKnownGlobal* deferred; |
2753 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); | 2753 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); |
2754 | 2754 |
2755 Label done, false_result; | 2755 Label done, false_result; |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3714 // will clear the V (overflow) flag and rsb won't set this flag | 3714 // will clear the V (overflow) flag and rsb won't set this flag |
3715 // if input is positive. | 3715 // if input is positive. |
3716 __ rsb(result, input, Operand::Zero(), SetCC, mi); | 3716 __ rsb(result, input, Operand::Zero(), SetCC, mi); |
3717 // Deoptimize on overflow. | 3717 // Deoptimize on overflow. |
3718 DeoptimizeIf(vs, instr->environment()); | 3718 DeoptimizeIf(vs, instr->environment()); |
3719 } | 3719 } |
3720 | 3720 |
3721 | 3721 |
3722 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3722 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
3723 // Class for deferred case. | 3723 // Class for deferred case. |
3724 class DeferredMathAbsTaggedHeapNumber V8_FINAL : public LDeferredCode { | 3724 class DeferredMathAbsTaggedHeapNumber: public LDeferredCode { |
3725 public: | 3725 public: |
3726 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) | 3726 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) |
3727 : LDeferredCode(codegen), instr_(instr) { } | 3727 : LDeferredCode(codegen), instr_(instr) { } |
3728 virtual void Generate() V8_OVERRIDE { | 3728 virtual void Generate() { |
3729 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3729 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
3730 } | 3730 } |
3731 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 3731 virtual LInstruction* instr() { return instr_; } |
3732 private: | 3732 private: |
3733 LMathAbs* instr_; | 3733 LMathAbs* instr_; |
3734 }; | 3734 }; |
3735 | 3735 |
3736 Representation r = instr->hydrogen()->value()->representation(); | 3736 Representation r = instr->hydrogen()->value()->representation(); |
3737 if (r.IsDouble()) { | 3737 if (r.IsDouble()) { |
3738 DwVfpRegister input = ToDoubleRegister(instr->value()); | 3738 DwVfpRegister input = ToDoubleRegister(instr->value()); |
3739 DwVfpRegister result = ToDoubleRegister(instr->result()); | 3739 DwVfpRegister result = ToDoubleRegister(instr->result()); |
3740 __ vabs(result, input); | 3740 __ vabs(result, input); |
3741 } else if (r.IsSmiOrInteger32()) { | 3741 } else if (r.IsSmiOrInteger32()) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3870 __ CallStub(&stub); | 3870 __ CallStub(&stub); |
3871 } else { | 3871 } else { |
3872 ASSERT(exponent_type.IsDouble()); | 3872 ASSERT(exponent_type.IsDouble()); |
3873 MathPowStub stub(MathPowStub::DOUBLE); | 3873 MathPowStub stub(MathPowStub::DOUBLE); |
3874 __ CallStub(&stub); | 3874 __ CallStub(&stub); |
3875 } | 3875 } |
3876 } | 3876 } |
3877 | 3877 |
3878 | 3878 |
3879 void LCodeGen::DoRandom(LRandom* instr) { | 3879 void LCodeGen::DoRandom(LRandom* instr) { |
3880 class DeferredDoRandom V8_FINAL : public LDeferredCode { | 3880 class DeferredDoRandom: public LDeferredCode { |
3881 public: | 3881 public: |
3882 DeferredDoRandom(LCodeGen* codegen, LRandom* instr) | 3882 DeferredDoRandom(LCodeGen* codegen, LRandom* instr) |
3883 : LDeferredCode(codegen), instr_(instr) { } | 3883 : LDeferredCode(codegen), instr_(instr) { } |
3884 virtual void Generate() V8_OVERRIDE { codegen()->DoDeferredRandom(instr_); } | 3884 virtual void Generate() { codegen()->DoDeferredRandom(instr_); } |
3885 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 3885 virtual LInstruction* instr() { return instr_; } |
3886 private: | 3886 private: |
3887 LRandom* instr_; | 3887 LRandom* instr_; |
3888 }; | 3888 }; |
3889 | 3889 |
3890 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); | 3890 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); |
3891 | 3891 |
3892 // Having marked this instruction as a call we can use any | 3892 // Having marked this instruction as a call we can use any |
3893 // registers. | 3893 // registers. |
3894 ASSERT(ToDoubleRegister(instr->result()).is(d7)); | 3894 ASSERT(ToDoubleRegister(instr->result()).is(d7)); |
3895 ASSERT(ToRegister(instr->global_object()).is(r0)); | 3895 ASSERT(ToRegister(instr->global_object()).is(r0)); |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4512 | 4512 |
4513 void LCodeGen::DoStringAdd(LStringAdd* instr) { | 4513 void LCodeGen::DoStringAdd(LStringAdd* instr) { |
4514 __ push(ToRegister(instr->left())); | 4514 __ push(ToRegister(instr->left())); |
4515 __ push(ToRegister(instr->right())); | 4515 __ push(ToRegister(instr->right())); |
4516 StringAddStub stub(instr->hydrogen()->flags()); | 4516 StringAddStub stub(instr->hydrogen()->flags()); |
4517 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4517 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
4518 } | 4518 } |
4519 | 4519 |
4520 | 4520 |
4521 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 4521 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
4522 class DeferredStringCharCodeAt V8_FINAL : public LDeferredCode { | 4522 class DeferredStringCharCodeAt: public LDeferredCode { |
4523 public: | 4523 public: |
4524 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) | 4524 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) |
4525 : LDeferredCode(codegen), instr_(instr) { } | 4525 : LDeferredCode(codegen), instr_(instr) { } |
4526 virtual void Generate() V8_OVERRIDE { | 4526 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } |
4527 codegen()->DoDeferredStringCharCodeAt(instr_); | 4527 virtual LInstruction* instr() { return instr_; } |
4528 } | |
4529 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
4530 private: | 4528 private: |
4531 LStringCharCodeAt* instr_; | 4529 LStringCharCodeAt* instr_; |
4532 }; | 4530 }; |
4533 | 4531 |
4534 DeferredStringCharCodeAt* deferred = | 4532 DeferredStringCharCodeAt* deferred = |
4535 new(zone()) DeferredStringCharCodeAt(this, instr); | 4533 new(zone()) DeferredStringCharCodeAt(this, instr); |
4536 | 4534 |
4537 StringCharLoadGenerator::Generate(masm(), | 4535 StringCharLoadGenerator::Generate(masm(), |
4538 ToRegister(instr->string()), | 4536 ToRegister(instr->string()), |
4539 ToRegister(instr->index()), | 4537 ToRegister(instr->index()), |
(...skipping 27 matching lines...) Expand all Loading... |
4567 __ push(index); | 4565 __ push(index); |
4568 } | 4566 } |
4569 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); | 4567 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); |
4570 __ AssertSmi(r0); | 4568 __ AssertSmi(r0); |
4571 __ SmiUntag(r0); | 4569 __ SmiUntag(r0); |
4572 __ StoreToSafepointRegisterSlot(r0, result); | 4570 __ StoreToSafepointRegisterSlot(r0, result); |
4573 } | 4571 } |
4574 | 4572 |
4575 | 4573 |
4576 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4574 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
4577 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { | 4575 class DeferredStringCharFromCode: public LDeferredCode { |
4578 public: | 4576 public: |
4579 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4577 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
4580 : LDeferredCode(codegen), instr_(instr) { } | 4578 : LDeferredCode(codegen), instr_(instr) { } |
4581 virtual void Generate() V8_OVERRIDE { | 4579 virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); } |
4582 codegen()->DoDeferredStringCharFromCode(instr_); | 4580 virtual LInstruction* instr() { return instr_; } |
4583 } | |
4584 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
4585 private: | 4581 private: |
4586 LStringCharFromCode* instr_; | 4582 LStringCharFromCode* instr_; |
4587 }; | 4583 }; |
4588 | 4584 |
4589 DeferredStringCharFromCode* deferred = | 4585 DeferredStringCharFromCode* deferred = |
4590 new(zone()) DeferredStringCharFromCode(this, instr); | 4586 new(zone()) DeferredStringCharFromCode(this, instr); |
4591 | 4587 |
4592 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4588 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
4593 Register char_code = ToRegister(instr->char_code()); | 4589 Register char_code = ToRegister(instr->char_code()); |
4594 Register result = ToRegister(instr->result()); | 4590 Register result = ToRegister(instr->result()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4657 LOperand* input = instr->value(); | 4653 LOperand* input = instr->value(); |
4658 LOperand* output = instr->result(); | 4654 LOperand* output = instr->result(); |
4659 | 4655 |
4660 SwVfpRegister flt_scratch = double_scratch0().low(); | 4656 SwVfpRegister flt_scratch = double_scratch0().low(); |
4661 __ vmov(flt_scratch, ToRegister(input)); | 4657 __ vmov(flt_scratch, ToRegister(input)); |
4662 __ vcvt_f64_u32(ToDoubleRegister(output), flt_scratch); | 4658 __ vcvt_f64_u32(ToDoubleRegister(output), flt_scratch); |
4663 } | 4659 } |
4664 | 4660 |
4665 | 4661 |
4666 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4662 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4667 class DeferredNumberTagI V8_FINAL : public LDeferredCode { | 4663 class DeferredNumberTagI: public LDeferredCode { |
4668 public: | 4664 public: |
4669 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4665 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4670 : LDeferredCode(codegen), instr_(instr) { } | 4666 : LDeferredCode(codegen), instr_(instr) { } |
4671 virtual void Generate() V8_OVERRIDE { | 4667 virtual void Generate() { |
4672 codegen()->DoDeferredNumberTagI(instr_, | 4668 codegen()->DoDeferredNumberTagI(instr_, |
4673 instr_->value(), | 4669 instr_->value(), |
4674 SIGNED_INT32); | 4670 SIGNED_INT32); |
4675 } | 4671 } |
4676 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4672 virtual LInstruction* instr() { return instr_; } |
4677 private: | 4673 private: |
4678 LNumberTagI* instr_; | 4674 LNumberTagI* instr_; |
4679 }; | 4675 }; |
4680 | 4676 |
4681 Register src = ToRegister(instr->value()); | 4677 Register src = ToRegister(instr->value()); |
4682 Register dst = ToRegister(instr->result()); | 4678 Register dst = ToRegister(instr->result()); |
4683 | 4679 |
4684 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); | 4680 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); |
4685 __ SmiTag(dst, src, SetCC); | 4681 __ SmiTag(dst, src, SetCC); |
4686 __ b(vs, deferred->entry()); | 4682 __ b(vs, deferred->entry()); |
4687 __ bind(deferred->exit()); | 4683 __ bind(deferred->exit()); |
4688 } | 4684 } |
4689 | 4685 |
4690 | 4686 |
4691 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4687 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4692 class DeferredNumberTagU V8_FINAL : public LDeferredCode { | 4688 class DeferredNumberTagU: public LDeferredCode { |
4693 public: | 4689 public: |
4694 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4690 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4695 : LDeferredCode(codegen), instr_(instr) { } | 4691 : LDeferredCode(codegen), instr_(instr) { } |
4696 virtual void Generate() V8_OVERRIDE { | 4692 virtual void Generate() { |
4697 codegen()->DoDeferredNumberTagI(instr_, | 4693 codegen()->DoDeferredNumberTagI(instr_, |
4698 instr_->value(), | 4694 instr_->value(), |
4699 UNSIGNED_INT32); | 4695 UNSIGNED_INT32); |
4700 } | 4696 } |
4701 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4697 virtual LInstruction* instr() { return instr_; } |
4702 private: | 4698 private: |
4703 LNumberTagU* instr_; | 4699 LNumberTagU* instr_; |
4704 }; | 4700 }; |
4705 | 4701 |
4706 LOperand* input = instr->value(); | 4702 LOperand* input = instr->value(); |
4707 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4703 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4708 Register reg = ToRegister(input); | 4704 Register reg = ToRegister(input); |
4709 | 4705 |
4710 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4706 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
4711 __ cmp(reg, Operand(Smi::kMaxValue)); | 4707 __ cmp(reg, Operand(Smi::kMaxValue)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4764 // Done. Put the value in dbl_scratch into the value of the allocated heap | 4760 // Done. Put the value in dbl_scratch into the value of the allocated heap |
4765 // number. | 4761 // number. |
4766 __ bind(&done); | 4762 __ bind(&done); |
4767 __ vstr(dbl_scratch, dst, HeapNumber::kValueOffset); | 4763 __ vstr(dbl_scratch, dst, HeapNumber::kValueOffset); |
4768 __ add(dst, dst, Operand(kHeapObjectTag)); | 4764 __ add(dst, dst, Operand(kHeapObjectTag)); |
4769 __ StoreToSafepointRegisterSlot(dst, dst); | 4765 __ StoreToSafepointRegisterSlot(dst, dst); |
4770 } | 4766 } |
4771 | 4767 |
4772 | 4768 |
4773 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4769 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
4774 class DeferredNumberTagD V8_FINAL : public LDeferredCode { | 4770 class DeferredNumberTagD: public LDeferredCode { |
4775 public: | 4771 public: |
4776 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4772 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
4777 : LDeferredCode(codegen), instr_(instr) { } | 4773 : LDeferredCode(codegen), instr_(instr) { } |
4778 virtual void Generate() V8_OVERRIDE { | 4774 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } |
4779 codegen()->DoDeferredNumberTagD(instr_); | 4775 virtual LInstruction* instr() { return instr_; } |
4780 } | |
4781 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
4782 private: | 4776 private: |
4783 LNumberTagD* instr_; | 4777 LNumberTagD* instr_; |
4784 }; | 4778 }; |
4785 | 4779 |
4786 DwVfpRegister input_reg = ToDoubleRegister(instr->value()); | 4780 DwVfpRegister input_reg = ToDoubleRegister(instr->value()); |
4787 Register scratch = scratch0(); | 4781 Register scratch = scratch0(); |
4788 Register reg = ToRegister(instr->result()); | 4782 Register reg = ToRegister(instr->result()); |
4789 Register temp1 = ToRegister(instr->temp()); | 4783 Register temp1 = ToRegister(instr->temp()); |
4790 Register temp2 = ToRegister(instr->temp2()); | 4784 Register temp2 = ToRegister(instr->temp2()); |
4791 | 4785 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4964 __ VmovHigh(scratch1, double_scratch2); | 4958 __ VmovHigh(scratch1, double_scratch2); |
4965 __ tst(scratch1, Operand(HeapNumber::kSignMask)); | 4959 __ tst(scratch1, Operand(HeapNumber::kSignMask)); |
4966 DeoptimizeIf(ne, instr->environment()); | 4960 DeoptimizeIf(ne, instr->environment()); |
4967 } | 4961 } |
4968 } | 4962 } |
4969 __ bind(&done); | 4963 __ bind(&done); |
4970 } | 4964 } |
4971 | 4965 |
4972 | 4966 |
4973 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4967 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
4974 class DeferredTaggedToI V8_FINAL : public LDeferredCode { | 4968 class DeferredTaggedToI: public LDeferredCode { |
4975 public: | 4969 public: |
4976 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4970 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
4977 : LDeferredCode(codegen), instr_(instr) { } | 4971 : LDeferredCode(codegen), instr_(instr) { } |
4978 virtual void Generate() V8_OVERRIDE { | 4972 virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); } |
4979 codegen()->DoDeferredTaggedToI(instr_); | 4973 virtual LInstruction* instr() { return instr_; } |
4980 } | |
4981 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
4982 private: | 4974 private: |
4983 LTaggedToI* instr_; | 4975 LTaggedToI* instr_; |
4984 }; | 4976 }; |
4985 | 4977 |
4986 LOperand* input = instr->value(); | 4978 LOperand* input = instr->value(); |
4987 ASSERT(input->IsRegister()); | 4979 ASSERT(input->IsRegister()); |
4988 ASSERT(input->Equals(instr->result())); | 4980 ASSERT(input->Equals(instr->result())); |
4989 | 4981 |
4990 Register input_reg = ToRegister(input); | 4982 Register input_reg = ToRegister(input); |
4991 | 4983 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5162 __ push(object); | 5154 __ push(object); |
5163 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); | 5155 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
5164 __ StoreToSafepointRegisterSlot(r0, scratch0()); | 5156 __ StoreToSafepointRegisterSlot(r0, scratch0()); |
5165 } | 5157 } |
5166 __ tst(scratch0(), Operand(kSmiTagMask)); | 5158 __ tst(scratch0(), Operand(kSmiTagMask)); |
5167 DeoptimizeIf(eq, instr->environment()); | 5159 DeoptimizeIf(eq, instr->environment()); |
5168 } | 5160 } |
5169 | 5161 |
5170 | 5162 |
5171 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5163 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
5172 class DeferredCheckMaps V8_FINAL : public LDeferredCode { | 5164 class DeferredCheckMaps: public LDeferredCode { |
5173 public: | 5165 public: |
5174 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 5166 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
5175 : LDeferredCode(codegen), instr_(instr), object_(object) { | 5167 : LDeferredCode(codegen), instr_(instr), object_(object) { |
5176 SetExit(check_maps()); | 5168 SetExit(check_maps()); |
5177 } | 5169 } |
5178 virtual void Generate() V8_OVERRIDE { | 5170 virtual void Generate() { |
5179 codegen()->DoDeferredInstanceMigration(instr_, object_); | 5171 codegen()->DoDeferredInstanceMigration(instr_, object_); |
5180 } | 5172 } |
5181 Label* check_maps() { return &check_maps_; } | 5173 Label* check_maps() { return &check_maps_; } |
5182 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5174 virtual LInstruction* instr() { return instr_; } |
5183 private: | 5175 private: |
5184 LCheckMaps* instr_; | 5176 LCheckMaps* instr_; |
5185 Label check_maps_; | 5177 Label check_maps_; |
5186 Register object_; | 5178 Register object_; |
5187 }; | 5179 }; |
5188 | 5180 |
5189 if (instr->hydrogen()->CanOmitMapChecks()) return; | 5181 if (instr->hydrogen()->CanOmitMapChecks()) return; |
5190 Register map_reg = scratch0(); | 5182 Register map_reg = scratch0(); |
5191 | 5183 |
5192 LOperand* input = instr->value(); | 5184 LOperand* input = instr->value(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5265 | 5257 |
5266 // smi | 5258 // smi |
5267 __ bind(&is_smi); | 5259 __ bind(&is_smi); |
5268 __ ClampUint8(result_reg, result_reg); | 5260 __ ClampUint8(result_reg, result_reg); |
5269 | 5261 |
5270 __ bind(&done); | 5262 __ bind(&done); |
5271 } | 5263 } |
5272 | 5264 |
5273 | 5265 |
5274 void LCodeGen::DoAllocate(LAllocate* instr) { | 5266 void LCodeGen::DoAllocate(LAllocate* instr) { |
5275 class DeferredAllocate V8_FINAL : public LDeferredCode { | 5267 class DeferredAllocate: public LDeferredCode { |
5276 public: | 5268 public: |
5277 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5269 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
5278 : LDeferredCode(codegen), instr_(instr) { } | 5270 : LDeferredCode(codegen), instr_(instr) { } |
5279 virtual void Generate() V8_OVERRIDE { | 5271 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } |
5280 codegen()->DoDeferredAllocate(instr_); | 5272 virtual LInstruction* instr() { return instr_; } |
5281 } | |
5282 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
5283 private: | 5273 private: |
5284 LAllocate* instr_; | 5274 LAllocate* instr_; |
5285 }; | 5275 }; |
5286 | 5276 |
5287 DeferredAllocate* deferred = | 5277 DeferredAllocate* deferred = |
5288 new(zone()) DeferredAllocate(this, instr); | 5278 new(zone()) DeferredAllocate(this, instr); |
5289 | 5279 |
5290 Register result = ToRegister(instr->result()); | 5280 Register result = ToRegister(instr->result()); |
5291 Register scratch = ToRegister(instr->temp1()); | 5281 Register scratch = ToRegister(instr->temp1()); |
5292 Register scratch2 = ToRegister(instr->temp2()); | 5282 Register scratch2 = ToRegister(instr->temp2()); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5623 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 5613 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
5624 RecordSafepointWithLazyDeopt( | 5614 RecordSafepointWithLazyDeopt( |
5625 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 5615 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
5626 ASSERT(instr->HasEnvironment()); | 5616 ASSERT(instr->HasEnvironment()); |
5627 LEnvironment* env = instr->environment(); | 5617 LEnvironment* env = instr->environment(); |
5628 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5618 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5629 } | 5619 } |
5630 | 5620 |
5631 | 5621 |
5632 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5622 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
5633 class DeferredStackCheck V8_FINAL : public LDeferredCode { | 5623 class DeferredStackCheck: public LDeferredCode { |
5634 public: | 5624 public: |
5635 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 5625 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
5636 : LDeferredCode(codegen), instr_(instr) { } | 5626 : LDeferredCode(codegen), instr_(instr) { } |
5637 virtual void Generate() V8_OVERRIDE { | 5627 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } |
5638 codegen()->DoDeferredStackCheck(instr_); | 5628 virtual LInstruction* instr() { return instr_; } |
5639 } | |
5640 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
5641 private: | 5629 private: |
5642 LStackCheck* instr_; | 5630 LStackCheck* instr_; |
5643 }; | 5631 }; |
5644 | 5632 |
5645 ASSERT(instr->HasEnvironment()); | 5633 ASSERT(instr->HasEnvironment()); |
5646 LEnvironment* env = instr->environment(); | 5634 LEnvironment* env = instr->environment(); |
5647 // There is no LLazyBailout instruction for stack-checks. We have to | 5635 // There is no LLazyBailout instruction for stack-checks. We have to |
5648 // prepare for lazy deoptimization explicitly here. | 5636 // prepare for lazy deoptimization explicitly here. |
5649 if (instr->hydrogen()->is_function_entry()) { | 5637 if (instr->hydrogen()->is_function_entry()) { |
5650 // Perform stack overflow check. | 5638 // Perform stack overflow check. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5787 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5775 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5788 __ ldr(result, FieldMemOperand(scratch, | 5776 __ ldr(result, FieldMemOperand(scratch, |
5789 FixedArray::kHeaderSize - kPointerSize)); | 5777 FixedArray::kHeaderSize - kPointerSize)); |
5790 __ bind(&done); | 5778 __ bind(&done); |
5791 } | 5779 } |
5792 | 5780 |
5793 | 5781 |
5794 #undef __ | 5782 #undef __ |
5795 | 5783 |
5796 } } // namespace v8::internal | 5784 } } // namespace v8::internal |
OLD | NEW |