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 : public CallWrapper { | 39 class SafepointGenerator V8_FINAL : 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 { } | 49 virtual void BeforeCall(int call_size) const V8_OVERRIDE {} |
50 | 50 |
51 virtual void AfterCall() const { | 51 virtual void AfterCall() const V8_OVERRIDE { |
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: public LDeferredCode { | 2737 class DeferredInstanceOfKnownGlobal V8_FINAL : 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() { | 2742 virtual void Generate() V8_OVERRIDE { |
2743 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2743 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
2744 } | 2744 } |
2745 virtual LInstruction* instr() { return instr_; } | 2745 virtual LInstruction* instr() V8_OVERRIDE { 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: public LDeferredCode { | 3724 class DeferredMathAbsTaggedHeapNumber V8_FINAL : 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() { | 3728 virtual void Generate() V8_OVERRIDE { |
3729 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3729 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
3730 } | 3730 } |
3731 virtual LInstruction* instr() { return instr_; } | 3731 virtual LInstruction* instr() V8_OVERRIDE { 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: public LDeferredCode { | 3880 class DeferredDoRandom V8_FINAL : 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() { codegen()->DoDeferredRandom(instr_); } | 3884 virtual void Generate() V8_OVERRIDE { codegen()->DoDeferredRandom(instr_); } |
3885 virtual LInstruction* instr() { return instr_; } | 3885 virtual LInstruction* instr() V8_OVERRIDE { 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: public LDeferredCode { | 4522 class DeferredStringCharCodeAt V8_FINAL : 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() { codegen()->DoDeferredStringCharCodeAt(instr_); } | 4526 virtual void Generate() V8_OVERRIDE { |
4527 virtual LInstruction* instr() { return instr_; } | 4527 codegen()->DoDeferredStringCharCodeAt(instr_); |
| 4528 } |
| 4529 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4528 private: | 4530 private: |
4529 LStringCharCodeAt* instr_; | 4531 LStringCharCodeAt* instr_; |
4530 }; | 4532 }; |
4531 | 4533 |
4532 DeferredStringCharCodeAt* deferred = | 4534 DeferredStringCharCodeAt* deferred = |
4533 new(zone()) DeferredStringCharCodeAt(this, instr); | 4535 new(zone()) DeferredStringCharCodeAt(this, instr); |
4534 | 4536 |
4535 StringCharLoadGenerator::Generate(masm(), | 4537 StringCharLoadGenerator::Generate(masm(), |
4536 ToRegister(instr->string()), | 4538 ToRegister(instr->string()), |
4537 ToRegister(instr->index()), | 4539 ToRegister(instr->index()), |
(...skipping 27 matching lines...) Expand all Loading... |
4565 __ push(index); | 4567 __ push(index); |
4566 } | 4568 } |
4567 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); | 4569 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); |
4568 __ AssertSmi(r0); | 4570 __ AssertSmi(r0); |
4569 __ SmiUntag(r0); | 4571 __ SmiUntag(r0); |
4570 __ StoreToSafepointRegisterSlot(r0, result); | 4572 __ StoreToSafepointRegisterSlot(r0, result); |
4571 } | 4573 } |
4572 | 4574 |
4573 | 4575 |
4574 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4576 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
4575 class DeferredStringCharFromCode: public LDeferredCode { | 4577 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { |
4576 public: | 4578 public: |
4577 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4579 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
4578 : LDeferredCode(codegen), instr_(instr) { } | 4580 : LDeferredCode(codegen), instr_(instr) { } |
4579 virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); } | 4581 virtual void Generate() V8_OVERRIDE { |
4580 virtual LInstruction* instr() { return instr_; } | 4582 codegen()->DoDeferredStringCharFromCode(instr_); |
| 4583 } |
| 4584 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4581 private: | 4585 private: |
4582 LStringCharFromCode* instr_; | 4586 LStringCharFromCode* instr_; |
4583 }; | 4587 }; |
4584 | 4588 |
4585 DeferredStringCharFromCode* deferred = | 4589 DeferredStringCharFromCode* deferred = |
4586 new(zone()) DeferredStringCharFromCode(this, instr); | 4590 new(zone()) DeferredStringCharFromCode(this, instr); |
4587 | 4591 |
4588 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4592 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
4589 Register char_code = ToRegister(instr->char_code()); | 4593 Register char_code = ToRegister(instr->char_code()); |
4590 Register result = ToRegister(instr->result()); | 4594 Register result = ToRegister(instr->result()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4653 LOperand* input = instr->value(); | 4657 LOperand* input = instr->value(); |
4654 LOperand* output = instr->result(); | 4658 LOperand* output = instr->result(); |
4655 | 4659 |
4656 SwVfpRegister flt_scratch = double_scratch0().low(); | 4660 SwVfpRegister flt_scratch = double_scratch0().low(); |
4657 __ vmov(flt_scratch, ToRegister(input)); | 4661 __ vmov(flt_scratch, ToRegister(input)); |
4658 __ vcvt_f64_u32(ToDoubleRegister(output), flt_scratch); | 4662 __ vcvt_f64_u32(ToDoubleRegister(output), flt_scratch); |
4659 } | 4663 } |
4660 | 4664 |
4661 | 4665 |
4662 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4666 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4663 class DeferredNumberTagI: public LDeferredCode { | 4667 class DeferredNumberTagI V8_FINAL : public LDeferredCode { |
4664 public: | 4668 public: |
4665 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4669 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4666 : LDeferredCode(codegen), instr_(instr) { } | 4670 : LDeferredCode(codegen), instr_(instr) { } |
4667 virtual void Generate() { | 4671 virtual void Generate() V8_OVERRIDE { |
4668 codegen()->DoDeferredNumberTagI(instr_, | 4672 codegen()->DoDeferredNumberTagI(instr_, |
4669 instr_->value(), | 4673 instr_->value(), |
4670 SIGNED_INT32); | 4674 SIGNED_INT32); |
4671 } | 4675 } |
4672 virtual LInstruction* instr() { return instr_; } | 4676 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4673 private: | 4677 private: |
4674 LNumberTagI* instr_; | 4678 LNumberTagI* instr_; |
4675 }; | 4679 }; |
4676 | 4680 |
4677 Register src = ToRegister(instr->value()); | 4681 Register src = ToRegister(instr->value()); |
4678 Register dst = ToRegister(instr->result()); | 4682 Register dst = ToRegister(instr->result()); |
4679 | 4683 |
4680 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); | 4684 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); |
4681 __ SmiTag(dst, src, SetCC); | 4685 __ SmiTag(dst, src, SetCC); |
4682 __ b(vs, deferred->entry()); | 4686 __ b(vs, deferred->entry()); |
4683 __ bind(deferred->exit()); | 4687 __ bind(deferred->exit()); |
4684 } | 4688 } |
4685 | 4689 |
4686 | 4690 |
4687 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4691 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4688 class DeferredNumberTagU: public LDeferredCode { | 4692 class DeferredNumberTagU V8_FINAL : public LDeferredCode { |
4689 public: | 4693 public: |
4690 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4694 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4691 : LDeferredCode(codegen), instr_(instr) { } | 4695 : LDeferredCode(codegen), instr_(instr) { } |
4692 virtual void Generate() { | 4696 virtual void Generate() V8_OVERRIDE { |
4693 codegen()->DoDeferredNumberTagI(instr_, | 4697 codegen()->DoDeferredNumberTagI(instr_, |
4694 instr_->value(), | 4698 instr_->value(), |
4695 UNSIGNED_INT32); | 4699 UNSIGNED_INT32); |
4696 } | 4700 } |
4697 virtual LInstruction* instr() { return instr_; } | 4701 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4698 private: | 4702 private: |
4699 LNumberTagU* instr_; | 4703 LNumberTagU* instr_; |
4700 }; | 4704 }; |
4701 | 4705 |
4702 LOperand* input = instr->value(); | 4706 LOperand* input = instr->value(); |
4703 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4707 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4704 Register reg = ToRegister(input); | 4708 Register reg = ToRegister(input); |
4705 | 4709 |
4706 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4710 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
4707 __ cmp(reg, Operand(Smi::kMaxValue)); | 4711 __ cmp(reg, Operand(Smi::kMaxValue)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4760 // Done. Put the value in dbl_scratch into the value of the allocated heap | 4764 // Done. Put the value in dbl_scratch into the value of the allocated heap |
4761 // number. | 4765 // number. |
4762 __ bind(&done); | 4766 __ bind(&done); |
4763 __ vstr(dbl_scratch, dst, HeapNumber::kValueOffset); | 4767 __ vstr(dbl_scratch, dst, HeapNumber::kValueOffset); |
4764 __ add(dst, dst, Operand(kHeapObjectTag)); | 4768 __ add(dst, dst, Operand(kHeapObjectTag)); |
4765 __ StoreToSafepointRegisterSlot(dst, dst); | 4769 __ StoreToSafepointRegisterSlot(dst, dst); |
4766 } | 4770 } |
4767 | 4771 |
4768 | 4772 |
4769 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4773 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
4770 class DeferredNumberTagD: public LDeferredCode { | 4774 class DeferredNumberTagD V8_FINAL : public LDeferredCode { |
4771 public: | 4775 public: |
4772 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4776 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
4773 : LDeferredCode(codegen), instr_(instr) { } | 4777 : LDeferredCode(codegen), instr_(instr) { } |
4774 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } | 4778 virtual void Generate() V8_OVERRIDE { |
4775 virtual LInstruction* instr() { return instr_; } | 4779 codegen()->DoDeferredNumberTagD(instr_); |
| 4780 } |
| 4781 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4776 private: | 4782 private: |
4777 LNumberTagD* instr_; | 4783 LNumberTagD* instr_; |
4778 }; | 4784 }; |
4779 | 4785 |
4780 DwVfpRegister input_reg = ToDoubleRegister(instr->value()); | 4786 DwVfpRegister input_reg = ToDoubleRegister(instr->value()); |
4781 Register scratch = scratch0(); | 4787 Register scratch = scratch0(); |
4782 Register reg = ToRegister(instr->result()); | 4788 Register reg = ToRegister(instr->result()); |
4783 Register temp1 = ToRegister(instr->temp()); | 4789 Register temp1 = ToRegister(instr->temp()); |
4784 Register temp2 = ToRegister(instr->temp2()); | 4790 Register temp2 = ToRegister(instr->temp2()); |
4785 | 4791 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4958 __ VmovHigh(scratch1, double_scratch2); | 4964 __ VmovHigh(scratch1, double_scratch2); |
4959 __ tst(scratch1, Operand(HeapNumber::kSignMask)); | 4965 __ tst(scratch1, Operand(HeapNumber::kSignMask)); |
4960 DeoptimizeIf(ne, instr->environment()); | 4966 DeoptimizeIf(ne, instr->environment()); |
4961 } | 4967 } |
4962 } | 4968 } |
4963 __ bind(&done); | 4969 __ bind(&done); |
4964 } | 4970 } |
4965 | 4971 |
4966 | 4972 |
4967 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4973 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
4968 class DeferredTaggedToI: public LDeferredCode { | 4974 class DeferredTaggedToI V8_FINAL : public LDeferredCode { |
4969 public: | 4975 public: |
4970 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4976 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
4971 : LDeferredCode(codegen), instr_(instr) { } | 4977 : LDeferredCode(codegen), instr_(instr) { } |
4972 virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); } | 4978 virtual void Generate() V8_OVERRIDE { |
4973 virtual LInstruction* instr() { return instr_; } | 4979 codegen()->DoDeferredTaggedToI(instr_); |
| 4980 } |
| 4981 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4974 private: | 4982 private: |
4975 LTaggedToI* instr_; | 4983 LTaggedToI* instr_; |
4976 }; | 4984 }; |
4977 | 4985 |
4978 LOperand* input = instr->value(); | 4986 LOperand* input = instr->value(); |
4979 ASSERT(input->IsRegister()); | 4987 ASSERT(input->IsRegister()); |
4980 ASSERT(input->Equals(instr->result())); | 4988 ASSERT(input->Equals(instr->result())); |
4981 | 4989 |
4982 Register input_reg = ToRegister(input); | 4990 Register input_reg = ToRegister(input); |
4983 | 4991 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5154 __ push(object); | 5162 __ push(object); |
5155 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); | 5163 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
5156 __ StoreToSafepointRegisterSlot(r0, scratch0()); | 5164 __ StoreToSafepointRegisterSlot(r0, scratch0()); |
5157 } | 5165 } |
5158 __ tst(scratch0(), Operand(kSmiTagMask)); | 5166 __ tst(scratch0(), Operand(kSmiTagMask)); |
5159 DeoptimizeIf(eq, instr->environment()); | 5167 DeoptimizeIf(eq, instr->environment()); |
5160 } | 5168 } |
5161 | 5169 |
5162 | 5170 |
5163 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5171 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
5164 class DeferredCheckMaps: public LDeferredCode { | 5172 class DeferredCheckMaps V8_FINAL : public LDeferredCode { |
5165 public: | 5173 public: |
5166 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 5174 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
5167 : LDeferredCode(codegen), instr_(instr), object_(object) { | 5175 : LDeferredCode(codegen), instr_(instr), object_(object) { |
5168 SetExit(check_maps()); | 5176 SetExit(check_maps()); |
5169 } | 5177 } |
5170 virtual void Generate() { | 5178 virtual void Generate() V8_OVERRIDE { |
5171 codegen()->DoDeferredInstanceMigration(instr_, object_); | 5179 codegen()->DoDeferredInstanceMigration(instr_, object_); |
5172 } | 5180 } |
5173 Label* check_maps() { return &check_maps_; } | 5181 Label* check_maps() { return &check_maps_; } |
5174 virtual LInstruction* instr() { return instr_; } | 5182 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5175 private: | 5183 private: |
5176 LCheckMaps* instr_; | 5184 LCheckMaps* instr_; |
5177 Label check_maps_; | 5185 Label check_maps_; |
5178 Register object_; | 5186 Register object_; |
5179 }; | 5187 }; |
5180 | 5188 |
5181 if (instr->hydrogen()->CanOmitMapChecks()) return; | 5189 if (instr->hydrogen()->CanOmitMapChecks()) return; |
5182 Register map_reg = scratch0(); | 5190 Register map_reg = scratch0(); |
5183 | 5191 |
5184 LOperand* input = instr->value(); | 5192 LOperand* input = instr->value(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5257 | 5265 |
5258 // smi | 5266 // smi |
5259 __ bind(&is_smi); | 5267 __ bind(&is_smi); |
5260 __ ClampUint8(result_reg, result_reg); | 5268 __ ClampUint8(result_reg, result_reg); |
5261 | 5269 |
5262 __ bind(&done); | 5270 __ bind(&done); |
5263 } | 5271 } |
5264 | 5272 |
5265 | 5273 |
5266 void LCodeGen::DoAllocate(LAllocate* instr) { | 5274 void LCodeGen::DoAllocate(LAllocate* instr) { |
5267 class DeferredAllocate: public LDeferredCode { | 5275 class DeferredAllocate V8_FINAL : public LDeferredCode { |
5268 public: | 5276 public: |
5269 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5277 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
5270 : LDeferredCode(codegen), instr_(instr) { } | 5278 : LDeferredCode(codegen), instr_(instr) { } |
5271 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } | 5279 virtual void Generate() V8_OVERRIDE { |
5272 virtual LInstruction* instr() { return instr_; } | 5280 codegen()->DoDeferredAllocate(instr_); |
| 5281 } |
| 5282 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5273 private: | 5283 private: |
5274 LAllocate* instr_; | 5284 LAllocate* instr_; |
5275 }; | 5285 }; |
5276 | 5286 |
5277 DeferredAllocate* deferred = | 5287 DeferredAllocate* deferred = |
5278 new(zone()) DeferredAllocate(this, instr); | 5288 new(zone()) DeferredAllocate(this, instr); |
5279 | 5289 |
5280 Register result = ToRegister(instr->result()); | 5290 Register result = ToRegister(instr->result()); |
5281 Register scratch = ToRegister(instr->temp1()); | 5291 Register scratch = ToRegister(instr->temp1()); |
5282 Register scratch2 = ToRegister(instr->temp2()); | 5292 Register scratch2 = ToRegister(instr->temp2()); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5613 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 5623 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
5614 RecordSafepointWithLazyDeopt( | 5624 RecordSafepointWithLazyDeopt( |
5615 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 5625 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
5616 ASSERT(instr->HasEnvironment()); | 5626 ASSERT(instr->HasEnvironment()); |
5617 LEnvironment* env = instr->environment(); | 5627 LEnvironment* env = instr->environment(); |
5618 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5628 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5619 } | 5629 } |
5620 | 5630 |
5621 | 5631 |
5622 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5632 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
5623 class DeferredStackCheck: public LDeferredCode { | 5633 class DeferredStackCheck V8_FINAL : public LDeferredCode { |
5624 public: | 5634 public: |
5625 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 5635 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
5626 : LDeferredCode(codegen), instr_(instr) { } | 5636 : LDeferredCode(codegen), instr_(instr) { } |
5627 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } | 5637 virtual void Generate() V8_OVERRIDE { |
5628 virtual LInstruction* instr() { return instr_; } | 5638 codegen()->DoDeferredStackCheck(instr_); |
| 5639 } |
| 5640 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5629 private: | 5641 private: |
5630 LStackCheck* instr_; | 5642 LStackCheck* instr_; |
5631 }; | 5643 }; |
5632 | 5644 |
5633 ASSERT(instr->HasEnvironment()); | 5645 ASSERT(instr->HasEnvironment()); |
5634 LEnvironment* env = instr->environment(); | 5646 LEnvironment* env = instr->environment(); |
5635 // There is no LLazyBailout instruction for stack-checks. We have to | 5647 // There is no LLazyBailout instruction for stack-checks. We have to |
5636 // prepare for lazy deoptimization explicitly here. | 5648 // prepare for lazy deoptimization explicitly here. |
5637 if (instr->hydrogen()->is_function_entry()) { | 5649 if (instr->hydrogen()->is_function_entry()) { |
5638 // Perform stack overflow check. | 5650 // Perform stack overflow check. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5775 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5787 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5776 __ ldr(result, FieldMemOperand(scratch, | 5788 __ ldr(result, FieldMemOperand(scratch, |
5777 FixedArray::kHeaderSize - kPointerSize)); | 5789 FixedArray::kHeaderSize - kPointerSize)); |
5778 __ bind(&done); | 5790 __ bind(&done); |
5779 } | 5791 } |
5780 | 5792 |
5781 | 5793 |
5782 #undef __ | 5794 #undef __ |
5783 | 5795 |
5784 } } // namespace v8::internal | 5796 } } // namespace v8::internal |
OLD | NEW |