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 "mips/lithium-codegen-mips.h" | 30 #include "mips/lithium-codegen-mips.h" |
31 #include "mips/lithium-gap-resolver-mips.h" | 31 #include "mips/lithium-gap-resolver-mips.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 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2598 __ Branch(&true_label, eq, result, Operand(zero_reg)); | 2598 __ Branch(&true_label, eq, result, Operand(zero_reg)); |
2599 __ li(result, Operand(factory()->false_value())); | 2599 __ li(result, Operand(factory()->false_value())); |
2600 __ Branch(&done); | 2600 __ Branch(&done); |
2601 __ bind(&true_label); | 2601 __ bind(&true_label); |
2602 __ li(result, Operand(factory()->true_value())); | 2602 __ li(result, Operand(factory()->true_value())); |
2603 __ bind(&done); | 2603 __ bind(&done); |
2604 } | 2604 } |
2605 | 2605 |
2606 | 2606 |
2607 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2607 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
2608 class DeferredInstanceOfKnownGlobal: public LDeferredCode { | 2608 class DeferredInstanceOfKnownGlobal V8_FINAL : public LDeferredCode { |
2609 public: | 2609 public: |
2610 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2610 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
2611 LInstanceOfKnownGlobal* instr) | 2611 LInstanceOfKnownGlobal* instr) |
2612 : LDeferredCode(codegen), instr_(instr) { } | 2612 : LDeferredCode(codegen), instr_(instr) { } |
2613 virtual void Generate() { | 2613 virtual void Generate() V8_OVERRIDE { |
2614 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2614 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
2615 } | 2615 } |
2616 virtual LInstruction* instr() { return instr_; } | 2616 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
2617 Label* map_check() { return &map_check_; } | 2617 Label* map_check() { return &map_check_; } |
2618 | 2618 |
2619 private: | 2619 private: |
2620 LInstanceOfKnownGlobal* instr_; | 2620 LInstanceOfKnownGlobal* instr_; |
2621 Label map_check_; | 2621 Label map_check_; |
2622 }; | 2622 }; |
2623 | 2623 |
2624 DeferredInstanceOfKnownGlobal* deferred; | 2624 DeferredInstanceOfKnownGlobal* deferred; |
2625 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); | 2625 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); |
2626 | 2626 |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3592 __ mov(result, input); | 3592 __ mov(result, input); |
3593 __ subu(result, zero_reg, input); | 3593 __ subu(result, zero_reg, input); |
3594 // Overflow if result is still negative, i.e. 0x80000000. | 3594 // Overflow if result is still negative, i.e. 0x80000000. |
3595 DeoptimizeIf(lt, instr->environment(), result, Operand(zero_reg)); | 3595 DeoptimizeIf(lt, instr->environment(), result, Operand(zero_reg)); |
3596 __ bind(&done); | 3596 __ bind(&done); |
3597 } | 3597 } |
3598 | 3598 |
3599 | 3599 |
3600 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3600 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
3601 // Class for deferred case. | 3601 // Class for deferred case. |
3602 class DeferredMathAbsTaggedHeapNumber: public LDeferredCode { | 3602 class DeferredMathAbsTaggedHeapNumber V8_FINAL : public LDeferredCode { |
3603 public: | 3603 public: |
3604 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) | 3604 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) |
3605 : LDeferredCode(codegen), instr_(instr) { } | 3605 : LDeferredCode(codegen), instr_(instr) { } |
3606 virtual void Generate() { | 3606 virtual void Generate() V8_OVERRIDE { |
3607 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3607 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
3608 } | 3608 } |
3609 virtual LInstruction* instr() { return instr_; } | 3609 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
3610 private: | 3610 private: |
3611 LMathAbs* instr_; | 3611 LMathAbs* instr_; |
3612 }; | 3612 }; |
3613 | 3613 |
3614 Representation r = instr->hydrogen()->value()->representation(); | 3614 Representation r = instr->hydrogen()->value()->representation(); |
3615 if (r.IsDouble()) { | 3615 if (r.IsDouble()) { |
3616 FPURegister input = ToDoubleRegister(instr->value()); | 3616 FPURegister input = ToDoubleRegister(instr->value()); |
3617 FPURegister result = ToDoubleRegister(instr->result()); | 3617 FPURegister result = ToDoubleRegister(instr->result()); |
3618 __ abs_d(result, input); | 3618 __ abs_d(result, input); |
3619 } else if (r.IsSmiOrInteger32()) { | 3619 } else if (r.IsSmiOrInteger32()) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3794 __ CallStub(&stub); | 3794 __ CallStub(&stub); |
3795 } else { | 3795 } else { |
3796 ASSERT(exponent_type.IsDouble()); | 3796 ASSERT(exponent_type.IsDouble()); |
3797 MathPowStub stub(MathPowStub::DOUBLE); | 3797 MathPowStub stub(MathPowStub::DOUBLE); |
3798 __ CallStub(&stub); | 3798 __ CallStub(&stub); |
3799 } | 3799 } |
3800 } | 3800 } |
3801 | 3801 |
3802 | 3802 |
3803 void LCodeGen::DoRandom(LRandom* instr) { | 3803 void LCodeGen::DoRandom(LRandom* instr) { |
3804 class DeferredDoRandom: public LDeferredCode { | 3804 class DeferredDoRandom V8_FINAL : public LDeferredCode { |
3805 public: | 3805 public: |
3806 DeferredDoRandom(LCodeGen* codegen, LRandom* instr) | 3806 DeferredDoRandom(LCodeGen* codegen, LRandom* instr) |
3807 : LDeferredCode(codegen), instr_(instr) { } | 3807 : LDeferredCode(codegen), instr_(instr) { } |
3808 virtual void Generate() { codegen()->DoDeferredRandom(instr_); } | 3808 virtual void Generate() V8_OVERRIDE { codegen()->DoDeferredRandom(instr_); } |
3809 virtual LInstruction* instr() { return instr_; } | 3809 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
3810 private: | 3810 private: |
3811 LRandom* instr_; | 3811 LRandom* instr_; |
3812 }; | 3812 }; |
3813 | 3813 |
3814 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); | 3814 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); |
3815 // Having marked this instruction as a call we can use any | 3815 // Having marked this instruction as a call we can use any |
3816 // registers. | 3816 // registers. |
3817 ASSERT(ToDoubleRegister(instr->result()).is(f0)); | 3817 ASSERT(ToDoubleRegister(instr->result()).is(f0)); |
3818 ASSERT(ToRegister(instr->global_object()).is(a0)); | 3818 ASSERT(ToRegister(instr->global_object()).is(a0)); |
3819 | 3819 |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4454 | 4454 |
4455 void LCodeGen::DoStringAdd(LStringAdd* instr) { | 4455 void LCodeGen::DoStringAdd(LStringAdd* instr) { |
4456 __ push(ToRegister(instr->left())); | 4456 __ push(ToRegister(instr->left())); |
4457 __ push(ToRegister(instr->right())); | 4457 __ push(ToRegister(instr->right())); |
4458 StringAddStub stub(instr->hydrogen()->flags()); | 4458 StringAddStub stub(instr->hydrogen()->flags()); |
4459 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4459 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
4460 } | 4460 } |
4461 | 4461 |
4462 | 4462 |
4463 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 4463 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
4464 class DeferredStringCharCodeAt: public LDeferredCode { | 4464 class DeferredStringCharCodeAt V8_FINAL : public LDeferredCode { |
4465 public: | 4465 public: |
4466 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) | 4466 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) |
4467 : LDeferredCode(codegen), instr_(instr) { } | 4467 : LDeferredCode(codegen), instr_(instr) { } |
4468 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } | 4468 virtual void Generate() V8_OVERRIDE { |
4469 virtual LInstruction* instr() { return instr_; } | 4469 codegen()->DoDeferredStringCharCodeAt(instr_); |
| 4470 } |
| 4471 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4470 private: | 4472 private: |
4471 LStringCharCodeAt* instr_; | 4473 LStringCharCodeAt* instr_; |
4472 }; | 4474 }; |
4473 | 4475 |
4474 DeferredStringCharCodeAt* deferred = | 4476 DeferredStringCharCodeAt* deferred = |
4475 new(zone()) DeferredStringCharCodeAt(this, instr); | 4477 new(zone()) DeferredStringCharCodeAt(this, instr); |
4476 StringCharLoadGenerator::Generate(masm(), | 4478 StringCharLoadGenerator::Generate(masm(), |
4477 ToRegister(instr->string()), | 4479 ToRegister(instr->string()), |
4478 ToRegister(instr->index()), | 4480 ToRegister(instr->index()), |
4479 ToRegister(instr->result()), | 4481 ToRegister(instr->result()), |
(...skipping 26 matching lines...) Expand all Loading... |
4506 __ push(index); | 4508 __ push(index); |
4507 } | 4509 } |
4508 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); | 4510 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); |
4509 __ AssertSmi(v0); | 4511 __ AssertSmi(v0); |
4510 __ SmiUntag(v0); | 4512 __ SmiUntag(v0); |
4511 __ StoreToSafepointRegisterSlot(v0, result); | 4513 __ StoreToSafepointRegisterSlot(v0, result); |
4512 } | 4514 } |
4513 | 4515 |
4514 | 4516 |
4515 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4517 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
4516 class DeferredStringCharFromCode: public LDeferredCode { | 4518 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { |
4517 public: | 4519 public: |
4518 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4520 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
4519 : LDeferredCode(codegen), instr_(instr) { } | 4521 : LDeferredCode(codegen), instr_(instr) { } |
4520 virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); } | 4522 virtual void Generate() V8_OVERRIDE { |
4521 virtual LInstruction* instr() { return instr_; } | 4523 codegen()->DoDeferredStringCharFromCode(instr_); |
| 4524 } |
| 4525 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4522 private: | 4526 private: |
4523 LStringCharFromCode* instr_; | 4527 LStringCharFromCode* instr_; |
4524 }; | 4528 }; |
4525 | 4529 |
4526 DeferredStringCharFromCode* deferred = | 4530 DeferredStringCharFromCode* deferred = |
4527 new(zone()) DeferredStringCharFromCode(this, instr); | 4531 new(zone()) DeferredStringCharFromCode(this, instr); |
4528 | 4532 |
4529 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4533 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
4530 Register char_code = ToRegister(instr->char_code()); | 4534 Register char_code = ToRegister(instr->char_code()); |
4531 Register result = ToRegister(instr->result()); | 4535 Register result = ToRegister(instr->result()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4597 LOperand* input = instr->value(); | 4601 LOperand* input = instr->value(); |
4598 LOperand* output = instr->result(); | 4602 LOperand* output = instr->result(); |
4599 | 4603 |
4600 FPURegister dbl_scratch = double_scratch0(); | 4604 FPURegister dbl_scratch = double_scratch0(); |
4601 __ mtc1(ToRegister(input), dbl_scratch); | 4605 __ mtc1(ToRegister(input), dbl_scratch); |
4602 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); | 4606 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); |
4603 } | 4607 } |
4604 | 4608 |
4605 | 4609 |
4606 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4610 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4607 class DeferredNumberTagI: public LDeferredCode { | 4611 class DeferredNumberTagI V8_FINAL : public LDeferredCode { |
4608 public: | 4612 public: |
4609 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4613 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4610 : LDeferredCode(codegen), instr_(instr) { } | 4614 : LDeferredCode(codegen), instr_(instr) { } |
4611 virtual void Generate() { | 4615 virtual void Generate() V8_OVERRIDE { |
4612 codegen()->DoDeferredNumberTagI(instr_, | 4616 codegen()->DoDeferredNumberTagI(instr_, |
4613 instr_->value(), | 4617 instr_->value(), |
4614 SIGNED_INT32); | 4618 SIGNED_INT32); |
4615 } | 4619 } |
4616 virtual LInstruction* instr() { return instr_; } | 4620 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4617 private: | 4621 private: |
4618 LNumberTagI* instr_; | 4622 LNumberTagI* instr_; |
4619 }; | 4623 }; |
4620 | 4624 |
4621 Register src = ToRegister(instr->value()); | 4625 Register src = ToRegister(instr->value()); |
4622 Register dst = ToRegister(instr->result()); | 4626 Register dst = ToRegister(instr->result()); |
4623 Register overflow = scratch0(); | 4627 Register overflow = scratch0(); |
4624 | 4628 |
4625 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); | 4629 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); |
4626 __ SmiTagCheckOverflow(dst, src, overflow); | 4630 __ SmiTagCheckOverflow(dst, src, overflow); |
4627 __ BranchOnOverflow(deferred->entry(), overflow); | 4631 __ BranchOnOverflow(deferred->entry(), overflow); |
4628 __ bind(deferred->exit()); | 4632 __ bind(deferred->exit()); |
4629 } | 4633 } |
4630 | 4634 |
4631 | 4635 |
4632 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4636 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4633 class DeferredNumberTagU: public LDeferredCode { | 4637 class DeferredNumberTagU V8_FINAL : public LDeferredCode { |
4634 public: | 4638 public: |
4635 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4639 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4636 : LDeferredCode(codegen), instr_(instr) { } | 4640 : LDeferredCode(codegen), instr_(instr) { } |
4637 virtual void Generate() { | 4641 virtual void Generate() V8_OVERRIDE { |
4638 codegen()->DoDeferredNumberTagI(instr_, | 4642 codegen()->DoDeferredNumberTagI(instr_, |
4639 instr_->value(), | 4643 instr_->value(), |
4640 UNSIGNED_INT32); | 4644 UNSIGNED_INT32); |
4641 } | 4645 } |
4642 virtual LInstruction* instr() { return instr_; } | 4646 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4643 private: | 4647 private: |
4644 LNumberTagU* instr_; | 4648 LNumberTagU* instr_; |
4645 }; | 4649 }; |
4646 | 4650 |
4647 LOperand* input = instr->value(); | 4651 LOperand* input = instr->value(); |
4648 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4652 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4649 Register reg = ToRegister(input); | 4653 Register reg = ToRegister(input); |
4650 | 4654 |
4651 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4655 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
4652 __ Branch(deferred->entry(), hi, reg, Operand(Smi::kMaxValue)); | 4656 __ Branch(deferred->entry(), hi, reg, Operand(Smi::kMaxValue)); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4703 // Done. Put the value in dbl_scratch into the value of the allocated heap | 4707 // Done. Put the value in dbl_scratch into the value of the allocated heap |
4704 // number. | 4708 // number. |
4705 __ bind(&done); | 4709 __ bind(&done); |
4706 __ sdc1(dbl_scratch, MemOperand(dst, HeapNumber::kValueOffset)); | 4710 __ sdc1(dbl_scratch, MemOperand(dst, HeapNumber::kValueOffset)); |
4707 __ Addu(dst, dst, kHeapObjectTag); | 4711 __ Addu(dst, dst, kHeapObjectTag); |
4708 __ StoreToSafepointRegisterSlot(dst, dst); | 4712 __ StoreToSafepointRegisterSlot(dst, dst); |
4709 } | 4713 } |
4710 | 4714 |
4711 | 4715 |
4712 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4716 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
4713 class DeferredNumberTagD: public LDeferredCode { | 4717 class DeferredNumberTagD V8_FINAL : public LDeferredCode { |
4714 public: | 4718 public: |
4715 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4719 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
4716 : LDeferredCode(codegen), instr_(instr) { } | 4720 : LDeferredCode(codegen), instr_(instr) { } |
4717 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } | 4721 virtual void Generate() V8_OVERRIDE { |
4718 virtual LInstruction* instr() { return instr_; } | 4722 codegen()->DoDeferredNumberTagD(instr_); |
| 4723 } |
| 4724 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4719 private: | 4725 private: |
4720 LNumberTagD* instr_; | 4726 LNumberTagD* instr_; |
4721 }; | 4727 }; |
4722 | 4728 |
4723 DoubleRegister input_reg = ToDoubleRegister(instr->value()); | 4729 DoubleRegister input_reg = ToDoubleRegister(instr->value()); |
4724 Register scratch = scratch0(); | 4730 Register scratch = scratch0(); |
4725 Register reg = ToRegister(instr->result()); | 4731 Register reg = ToRegister(instr->result()); |
4726 Register temp1 = ToRegister(instr->temp()); | 4732 Register temp1 = ToRegister(instr->temp()); |
4727 Register temp2 = ToRegister(instr->temp2()); | 4733 Register temp2 = ToRegister(instr->temp2()); |
4728 | 4734 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4907 __ mfc1(scratch1, double_scratch.high()); | 4913 __ mfc1(scratch1, double_scratch.high()); |
4908 __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | 4914 __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
4909 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(zero_reg)); | 4915 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(zero_reg)); |
4910 } | 4916 } |
4911 } | 4917 } |
4912 __ bind(&done); | 4918 __ bind(&done); |
4913 } | 4919 } |
4914 | 4920 |
4915 | 4921 |
4916 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4922 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
4917 class DeferredTaggedToI: public LDeferredCode { | 4923 class DeferredTaggedToI V8_FINAL : public LDeferredCode { |
4918 public: | 4924 public: |
4919 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4925 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
4920 : LDeferredCode(codegen), instr_(instr) { } | 4926 : LDeferredCode(codegen), instr_(instr) { } |
4921 virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); } | 4927 virtual void Generate() V8_OVERRIDE { |
4922 virtual LInstruction* instr() { return instr_; } | 4928 codegen()->DoDeferredTaggedToI(instr_); |
| 4929 } |
| 4930 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4923 private: | 4931 private: |
4924 LTaggedToI* instr_; | 4932 LTaggedToI* instr_; |
4925 }; | 4933 }; |
4926 | 4934 |
4927 LOperand* input = instr->value(); | 4935 LOperand* input = instr->value(); |
4928 ASSERT(input->IsRegister()); | 4936 ASSERT(input->IsRegister()); |
4929 ASSERT(input->Equals(instr->result())); | 4937 ASSERT(input->Equals(instr->result())); |
4930 | 4938 |
4931 Register input_reg = ToRegister(input); | 4939 Register input_reg = ToRegister(input); |
4932 | 4940 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5125 __ push(object); | 5133 __ push(object); |
5126 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); | 5134 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
5127 __ StoreToSafepointRegisterSlot(v0, scratch0()); | 5135 __ StoreToSafepointRegisterSlot(v0, scratch0()); |
5128 } | 5136 } |
5129 __ And(at, scratch0(), Operand(kSmiTagMask)); | 5137 __ And(at, scratch0(), Operand(kSmiTagMask)); |
5130 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg)); | 5138 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg)); |
5131 } | 5139 } |
5132 | 5140 |
5133 | 5141 |
5134 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5142 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
5135 class DeferredCheckMaps: public LDeferredCode { | 5143 class DeferredCheckMaps V8_FINAL : public LDeferredCode { |
5136 public: | 5144 public: |
5137 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 5145 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
5138 : LDeferredCode(codegen), instr_(instr), object_(object) { | 5146 : LDeferredCode(codegen), instr_(instr), object_(object) { |
5139 SetExit(check_maps()); | 5147 SetExit(check_maps()); |
5140 } | 5148 } |
5141 virtual void Generate() { | 5149 virtual void Generate() V8_OVERRIDE { |
5142 codegen()->DoDeferredInstanceMigration(instr_, object_); | 5150 codegen()->DoDeferredInstanceMigration(instr_, object_); |
5143 } | 5151 } |
5144 Label* check_maps() { return &check_maps_; } | 5152 Label* check_maps() { return &check_maps_; } |
5145 virtual LInstruction* instr() { return instr_; } | 5153 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5146 private: | 5154 private: |
5147 LCheckMaps* instr_; | 5155 LCheckMaps* instr_; |
5148 Label check_maps_; | 5156 Label check_maps_; |
5149 Register object_; | 5157 Register object_; |
5150 }; | 5158 }; |
5151 | 5159 |
5152 if (instr->hydrogen()->CanOmitMapChecks()) return; | 5160 if (instr->hydrogen()->CanOmitMapChecks()) return; |
5153 Register map_reg = scratch0(); | 5161 Register map_reg = scratch0(); |
5154 LOperand* input = instr->value(); | 5162 LOperand* input = instr->value(); |
5155 ASSERT(input->IsRegister()); | 5163 ASSERT(input->IsRegister()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5224 __ jmp(&done); | 5232 __ jmp(&done); |
5225 | 5233 |
5226 __ bind(&is_smi); | 5234 __ bind(&is_smi); |
5227 __ ClampUint8(result_reg, scratch); | 5235 __ ClampUint8(result_reg, scratch); |
5228 | 5236 |
5229 __ bind(&done); | 5237 __ bind(&done); |
5230 } | 5238 } |
5231 | 5239 |
5232 | 5240 |
5233 void LCodeGen::DoAllocate(LAllocate* instr) { | 5241 void LCodeGen::DoAllocate(LAllocate* instr) { |
5234 class DeferredAllocate: public LDeferredCode { | 5242 class DeferredAllocate V8_FINAL : public LDeferredCode { |
5235 public: | 5243 public: |
5236 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5244 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
5237 : LDeferredCode(codegen), instr_(instr) { } | 5245 : LDeferredCode(codegen), instr_(instr) { } |
5238 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } | 5246 virtual void Generate() V8_OVERRIDE { |
5239 virtual LInstruction* instr() { return instr_; } | 5247 codegen()->DoDeferredAllocate(instr_); |
| 5248 } |
| 5249 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5240 private: | 5250 private: |
5241 LAllocate* instr_; | 5251 LAllocate* instr_; |
5242 }; | 5252 }; |
5243 | 5253 |
5244 DeferredAllocate* deferred = | 5254 DeferredAllocate* deferred = |
5245 new(zone()) DeferredAllocate(this, instr); | 5255 new(zone()) DeferredAllocate(this, instr); |
5246 | 5256 |
5247 Register result = ToRegister(instr->result()); | 5257 Register result = ToRegister(instr->result()); |
5248 Register scratch = ToRegister(instr->temp1()); | 5258 Register scratch = ToRegister(instr->temp1()); |
5249 Register scratch2 = ToRegister(instr->temp2()); | 5259 Register scratch2 = ToRegister(instr->temp2()); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5626 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 5636 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
5627 RecordSafepointWithLazyDeopt( | 5637 RecordSafepointWithLazyDeopt( |
5628 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 5638 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
5629 ASSERT(instr->HasEnvironment()); | 5639 ASSERT(instr->HasEnvironment()); |
5630 LEnvironment* env = instr->environment(); | 5640 LEnvironment* env = instr->environment(); |
5631 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5641 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5632 } | 5642 } |
5633 | 5643 |
5634 | 5644 |
5635 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5645 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
5636 class DeferredStackCheck: public LDeferredCode { | 5646 class DeferredStackCheck V8_FINAL : public LDeferredCode { |
5637 public: | 5647 public: |
5638 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 5648 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
5639 : LDeferredCode(codegen), instr_(instr) { } | 5649 : LDeferredCode(codegen), instr_(instr) { } |
5640 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } | 5650 virtual void Generate() V8_OVERRIDE { |
5641 virtual LInstruction* instr() { return instr_; } | 5651 codegen()->DoDeferredStackCheck(instr_); |
| 5652 } |
| 5653 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5642 private: | 5654 private: |
5643 LStackCheck* instr_; | 5655 LStackCheck* instr_; |
5644 }; | 5656 }; |
5645 | 5657 |
5646 ASSERT(instr->HasEnvironment()); | 5658 ASSERT(instr->HasEnvironment()); |
5647 LEnvironment* env = instr->environment(); | 5659 LEnvironment* env = instr->environment(); |
5648 // There is no LLazyBailout instruction for stack-checks. We have to | 5660 // There is no LLazyBailout instruction for stack-checks. We have to |
5649 // prepare for lazy deoptimization explicitly here. | 5661 // prepare for lazy deoptimization explicitly here. |
5650 if (instr->hydrogen()->is_function_entry()) { | 5662 if (instr->hydrogen()->is_function_entry()) { |
5651 // Perform stack overflow check. | 5663 // Perform stack overflow check. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5783 __ Subu(scratch, result, scratch); | 5795 __ Subu(scratch, result, scratch); |
5784 __ lw(result, FieldMemOperand(scratch, | 5796 __ lw(result, FieldMemOperand(scratch, |
5785 FixedArray::kHeaderSize - kPointerSize)); | 5797 FixedArray::kHeaderSize - kPointerSize)); |
5786 __ bind(&done); | 5798 __ bind(&done); |
5787 } | 5799 } |
5788 | 5800 |
5789 | 5801 |
5790 #undef __ | 5802 #undef __ |
5791 | 5803 |
5792 } } // namespace v8::internal | 5804 } } // namespace v8::internal |
OLD | NEW |