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