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 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 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 FINAL : 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() OVERRIDE { | 2613 virtual void Generate() V8_OVERRIDE { |
2614 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2614 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
2615 } | 2615 } |
2616 virtual LInstruction* instr() OVERRIDE { 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 FINAL : 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() OVERRIDE { | 3606 virtual void Generate() V8_OVERRIDE { |
3607 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3607 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
3608 } | 3608 } |
3609 virtual LInstruction* instr() OVERRIDE { 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 FINAL : 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() OVERRIDE { codegen()->DoDeferredRandom(instr_); } | 3808 virtual void Generate() V8_OVERRIDE { codegen()->DoDeferredRandom(instr_); } |
3809 virtual LInstruction* instr() OVERRIDE { 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 FINAL : 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() OVERRIDE { | 4468 virtual void Generate() V8_OVERRIDE { |
4469 codegen()->DoDeferredStringCharCodeAt(instr_); | 4469 codegen()->DoDeferredStringCharCodeAt(instr_); |
4470 } | 4470 } |
4471 virtual LInstruction* instr() OVERRIDE { return instr_; } | 4471 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4472 private: | 4472 private: |
4473 LStringCharCodeAt* instr_; | 4473 LStringCharCodeAt* instr_; |
4474 }; | 4474 }; |
4475 | 4475 |
4476 DeferredStringCharCodeAt* deferred = | 4476 DeferredStringCharCodeAt* deferred = |
4477 new(zone()) DeferredStringCharCodeAt(this, instr); | 4477 new(zone()) DeferredStringCharCodeAt(this, instr); |
4478 StringCharLoadGenerator::Generate(masm(), | 4478 StringCharLoadGenerator::Generate(masm(), |
4479 ToRegister(instr->string()), | 4479 ToRegister(instr->string()), |
4480 ToRegister(instr->index()), | 4480 ToRegister(instr->index()), |
4481 ToRegister(instr->result()), | 4481 ToRegister(instr->result()), |
(...skipping 26 matching lines...) Expand all Loading... |
4508 __ push(index); | 4508 __ push(index); |
4509 } | 4509 } |
4510 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); | 4510 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); |
4511 __ AssertSmi(v0); | 4511 __ AssertSmi(v0); |
4512 __ SmiUntag(v0); | 4512 __ SmiUntag(v0); |
4513 __ StoreToSafepointRegisterSlot(v0, result); | 4513 __ StoreToSafepointRegisterSlot(v0, result); |
4514 } | 4514 } |
4515 | 4515 |
4516 | 4516 |
4517 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4517 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
4518 class DeferredStringCharFromCode FINAL : public LDeferredCode { | 4518 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { |
4519 public: | 4519 public: |
4520 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4520 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
4521 : LDeferredCode(codegen), instr_(instr) { } | 4521 : LDeferredCode(codegen), instr_(instr) { } |
4522 virtual void Generate() OVERRIDE { | 4522 virtual void Generate() V8_OVERRIDE { |
4523 codegen()->DoDeferredStringCharFromCode(instr_); | 4523 codegen()->DoDeferredStringCharFromCode(instr_); |
4524 } | 4524 } |
4525 virtual LInstruction* instr() OVERRIDE { return instr_; } | 4525 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4526 private: | 4526 private: |
4527 LStringCharFromCode* instr_; | 4527 LStringCharFromCode* instr_; |
4528 }; | 4528 }; |
4529 | 4529 |
4530 DeferredStringCharFromCode* deferred = | 4530 DeferredStringCharFromCode* deferred = |
4531 new(zone()) DeferredStringCharFromCode(this, instr); | 4531 new(zone()) DeferredStringCharFromCode(this, instr); |
4532 | 4532 |
4533 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4533 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
4534 Register char_code = ToRegister(instr->char_code()); | 4534 Register char_code = ToRegister(instr->char_code()); |
4535 Register result = ToRegister(instr->result()); | 4535 Register result = ToRegister(instr->result()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4601 LOperand* input = instr->value(); | 4601 LOperand* input = instr->value(); |
4602 LOperand* output = instr->result(); | 4602 LOperand* output = instr->result(); |
4603 | 4603 |
4604 FPURegister dbl_scratch = double_scratch0(); | 4604 FPURegister dbl_scratch = double_scratch0(); |
4605 __ mtc1(ToRegister(input), dbl_scratch); | 4605 __ mtc1(ToRegister(input), dbl_scratch); |
4606 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); | 4606 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); |
4607 } | 4607 } |
4608 | 4608 |
4609 | 4609 |
4610 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4610 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4611 class DeferredNumberTagI FINAL : public LDeferredCode { | 4611 class DeferredNumberTagI V8_FINAL : public LDeferredCode { |
4612 public: | 4612 public: |
4613 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4613 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4614 : LDeferredCode(codegen), instr_(instr) { } | 4614 : LDeferredCode(codegen), instr_(instr) { } |
4615 virtual void Generate() OVERRIDE { | 4615 virtual void Generate() V8_OVERRIDE { |
4616 codegen()->DoDeferredNumberTagI(instr_, | 4616 codegen()->DoDeferredNumberTagI(instr_, |
4617 instr_->value(), | 4617 instr_->value(), |
4618 SIGNED_INT32); | 4618 SIGNED_INT32); |
4619 } | 4619 } |
4620 virtual LInstruction* instr() OVERRIDE { return instr_; } | 4620 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4621 private: | 4621 private: |
4622 LNumberTagI* instr_; | 4622 LNumberTagI* instr_; |
4623 }; | 4623 }; |
4624 | 4624 |
4625 Register src = ToRegister(instr->value()); | 4625 Register src = ToRegister(instr->value()); |
4626 Register dst = ToRegister(instr->result()); | 4626 Register dst = ToRegister(instr->result()); |
4627 Register overflow = scratch0(); | 4627 Register overflow = scratch0(); |
4628 | 4628 |
4629 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); | 4629 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); |
4630 __ SmiTagCheckOverflow(dst, src, overflow); | 4630 __ SmiTagCheckOverflow(dst, src, overflow); |
4631 __ BranchOnOverflow(deferred->entry(), overflow); | 4631 __ BranchOnOverflow(deferred->entry(), overflow); |
4632 __ bind(deferred->exit()); | 4632 __ bind(deferred->exit()); |
4633 } | 4633 } |
4634 | 4634 |
4635 | 4635 |
4636 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4636 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4637 class DeferredNumberTagU FINAL : public LDeferredCode { | 4637 class DeferredNumberTagU V8_FINAL : public LDeferredCode { |
4638 public: | 4638 public: |
4639 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4639 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4640 : LDeferredCode(codegen), instr_(instr) { } | 4640 : LDeferredCode(codegen), instr_(instr) { } |
4641 virtual void Generate() OVERRIDE { | 4641 virtual void Generate() V8_OVERRIDE { |
4642 codegen()->DoDeferredNumberTagI(instr_, | 4642 codegen()->DoDeferredNumberTagI(instr_, |
4643 instr_->value(), | 4643 instr_->value(), |
4644 UNSIGNED_INT32); | 4644 UNSIGNED_INT32); |
4645 } | 4645 } |
4646 virtual LInstruction* instr() OVERRIDE { return instr_; } | 4646 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4647 private: | 4647 private: |
4648 LNumberTagU* instr_; | 4648 LNumberTagU* instr_; |
4649 }; | 4649 }; |
4650 | 4650 |
4651 LOperand* input = instr->value(); | 4651 LOperand* input = instr->value(); |
4652 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4652 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4653 Register reg = ToRegister(input); | 4653 Register reg = ToRegister(input); |
4654 | 4654 |
4655 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4655 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
4656 __ 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... |
4707 // 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 |
4708 // number. | 4708 // number. |
4709 __ bind(&done); | 4709 __ bind(&done); |
4710 __ sdc1(dbl_scratch, MemOperand(dst, HeapNumber::kValueOffset)); | 4710 __ sdc1(dbl_scratch, MemOperand(dst, HeapNumber::kValueOffset)); |
4711 __ Addu(dst, dst, kHeapObjectTag); | 4711 __ Addu(dst, dst, kHeapObjectTag); |
4712 __ StoreToSafepointRegisterSlot(dst, dst); | 4712 __ StoreToSafepointRegisterSlot(dst, dst); |
4713 } | 4713 } |
4714 | 4714 |
4715 | 4715 |
4716 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4716 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
4717 class DeferredNumberTagD FINAL : public LDeferredCode { | 4717 class DeferredNumberTagD V8_FINAL : public LDeferredCode { |
4718 public: | 4718 public: |
4719 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4719 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
4720 : LDeferredCode(codegen), instr_(instr) { } | 4720 : LDeferredCode(codegen), instr_(instr) { } |
4721 virtual void Generate() OVERRIDE { | 4721 virtual void Generate() V8_OVERRIDE { |
4722 codegen()->DoDeferredNumberTagD(instr_); | 4722 codegen()->DoDeferredNumberTagD(instr_); |
4723 } | 4723 } |
4724 virtual LInstruction* instr() OVERRIDE { return instr_; } | 4724 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4725 private: | 4725 private: |
4726 LNumberTagD* instr_; | 4726 LNumberTagD* instr_; |
4727 }; | 4727 }; |
4728 | 4728 |
4729 DoubleRegister input_reg = ToDoubleRegister(instr->value()); | 4729 DoubleRegister input_reg = ToDoubleRegister(instr->value()); |
4730 Register scratch = scratch0(); | 4730 Register scratch = scratch0(); |
4731 Register reg = ToRegister(instr->result()); | 4731 Register reg = ToRegister(instr->result()); |
4732 Register temp1 = ToRegister(instr->temp()); | 4732 Register temp1 = ToRegister(instr->temp()); |
4733 Register temp2 = ToRegister(instr->temp2()); | 4733 Register temp2 = ToRegister(instr->temp2()); |
4734 | 4734 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4913 __ mfc1(scratch1, double_scratch.high()); | 4913 __ mfc1(scratch1, double_scratch.high()); |
4914 __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | 4914 __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
4915 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(zero_reg)); | 4915 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(zero_reg)); |
4916 } | 4916 } |
4917 } | 4917 } |
4918 __ bind(&done); | 4918 __ bind(&done); |
4919 } | 4919 } |
4920 | 4920 |
4921 | 4921 |
4922 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4922 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
4923 class DeferredTaggedToI FINAL : public LDeferredCode { | 4923 class DeferredTaggedToI V8_FINAL : public LDeferredCode { |
4924 public: | 4924 public: |
4925 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4925 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
4926 : LDeferredCode(codegen), instr_(instr) { } | 4926 : LDeferredCode(codegen), instr_(instr) { } |
4927 virtual void Generate() OVERRIDE { codegen()->DoDeferredTaggedToI(instr_); } | 4927 virtual void Generate() V8_OVERRIDE { |
4928 virtual LInstruction* instr() OVERRIDE { return instr_; } | 4928 codegen()->DoDeferredTaggedToI(instr_); |
| 4929 } |
| 4930 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
4929 private: | 4931 private: |
4930 LTaggedToI* instr_; | 4932 LTaggedToI* instr_; |
4931 }; | 4933 }; |
4932 | 4934 |
4933 LOperand* input = instr->value(); | 4935 LOperand* input = instr->value(); |
4934 ASSERT(input->IsRegister()); | 4936 ASSERT(input->IsRegister()); |
4935 ASSERT(input->Equals(instr->result())); | 4937 ASSERT(input->Equals(instr->result())); |
4936 | 4938 |
4937 Register input_reg = ToRegister(input); | 4939 Register input_reg = ToRegister(input); |
4938 | 4940 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5131 __ push(object); | 5133 __ push(object); |
5132 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); | 5134 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
5133 __ StoreToSafepointRegisterSlot(v0, scratch0()); | 5135 __ StoreToSafepointRegisterSlot(v0, scratch0()); |
5134 } | 5136 } |
5135 __ And(at, scratch0(), Operand(kSmiTagMask)); | 5137 __ And(at, scratch0(), Operand(kSmiTagMask)); |
5136 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg)); | 5138 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg)); |
5137 } | 5139 } |
5138 | 5140 |
5139 | 5141 |
5140 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5142 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
5141 class DeferredCheckMaps FINAL : public LDeferredCode { | 5143 class DeferredCheckMaps V8_FINAL : public LDeferredCode { |
5142 public: | 5144 public: |
5143 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 5145 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
5144 : LDeferredCode(codegen), instr_(instr), object_(object) { | 5146 : LDeferredCode(codegen), instr_(instr), object_(object) { |
5145 SetExit(check_maps()); | 5147 SetExit(check_maps()); |
5146 } | 5148 } |
5147 virtual void Generate() OVERRIDE { | 5149 virtual void Generate() V8_OVERRIDE { |
5148 codegen()->DoDeferredInstanceMigration(instr_, object_); | 5150 codegen()->DoDeferredInstanceMigration(instr_, object_); |
5149 } | 5151 } |
5150 Label* check_maps() { return &check_maps_; } | 5152 Label* check_maps() { return &check_maps_; } |
5151 virtual LInstruction* instr() OVERRIDE { return instr_; } | 5153 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5152 private: | 5154 private: |
5153 LCheckMaps* instr_; | 5155 LCheckMaps* instr_; |
5154 Label check_maps_; | 5156 Label check_maps_; |
5155 Register object_; | 5157 Register object_; |
5156 }; | 5158 }; |
5157 | 5159 |
5158 if (instr->hydrogen()->CanOmitMapChecks()) return; | 5160 if (instr->hydrogen()->CanOmitMapChecks()) return; |
5159 Register map_reg = scratch0(); | 5161 Register map_reg = scratch0(); |
5160 LOperand* input = instr->value(); | 5162 LOperand* input = instr->value(); |
5161 ASSERT(input->IsRegister()); | 5163 ASSERT(input->IsRegister()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5230 __ jmp(&done); | 5232 __ jmp(&done); |
5231 | 5233 |
5232 __ bind(&is_smi); | 5234 __ bind(&is_smi); |
5233 __ ClampUint8(result_reg, scratch); | 5235 __ ClampUint8(result_reg, scratch); |
5234 | 5236 |
5235 __ bind(&done); | 5237 __ bind(&done); |
5236 } | 5238 } |
5237 | 5239 |
5238 | 5240 |
5239 void LCodeGen::DoAllocate(LAllocate* instr) { | 5241 void LCodeGen::DoAllocate(LAllocate* instr) { |
5240 class DeferredAllocate FINAL : public LDeferredCode { | 5242 class DeferredAllocate V8_FINAL : public LDeferredCode { |
5241 public: | 5243 public: |
5242 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5244 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
5243 : LDeferredCode(codegen), instr_(instr) { } | 5245 : LDeferredCode(codegen), instr_(instr) { } |
5244 virtual void Generate() OVERRIDE { codegen()->DoDeferredAllocate(instr_); } | 5246 virtual void Generate() V8_OVERRIDE { |
5245 virtual LInstruction* instr() OVERRIDE { return instr_; } | 5247 codegen()->DoDeferredAllocate(instr_); |
| 5248 } |
| 5249 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5246 private: | 5250 private: |
5247 LAllocate* instr_; | 5251 LAllocate* instr_; |
5248 }; | 5252 }; |
5249 | 5253 |
5250 DeferredAllocate* deferred = | 5254 DeferredAllocate* deferred = |
5251 new(zone()) DeferredAllocate(this, instr); | 5255 new(zone()) DeferredAllocate(this, instr); |
5252 | 5256 |
5253 Register result = ToRegister(instr->result()); | 5257 Register result = ToRegister(instr->result()); |
5254 Register scratch = ToRegister(instr->temp1()); | 5258 Register scratch = ToRegister(instr->temp1()); |
5255 Register scratch2 = ToRegister(instr->temp2()); | 5259 Register scratch2 = ToRegister(instr->temp2()); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5632 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 5636 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
5633 RecordSafepointWithLazyDeopt( | 5637 RecordSafepointWithLazyDeopt( |
5634 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 5638 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
5635 ASSERT(instr->HasEnvironment()); | 5639 ASSERT(instr->HasEnvironment()); |
5636 LEnvironment* env = instr->environment(); | 5640 LEnvironment* env = instr->environment(); |
5637 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5641 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5638 } | 5642 } |
5639 | 5643 |
5640 | 5644 |
5641 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5645 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
5642 class DeferredStackCheck FINAL : public LDeferredCode { | 5646 class DeferredStackCheck V8_FINAL : public LDeferredCode { |
5643 public: | 5647 public: |
5644 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 5648 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
5645 : LDeferredCode(codegen), instr_(instr) { } | 5649 : LDeferredCode(codegen), instr_(instr) { } |
5646 virtual void Generate() OVERRIDE { | 5650 virtual void Generate() V8_OVERRIDE { |
5647 codegen()->DoDeferredStackCheck(instr_); | 5651 codegen()->DoDeferredStackCheck(instr_); |
5648 } | 5652 } |
5649 virtual LInstruction* instr() OVERRIDE { return instr_; } | 5653 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
5650 private: | 5654 private: |
5651 LStackCheck* instr_; | 5655 LStackCheck* instr_; |
5652 }; | 5656 }; |
5653 | 5657 |
5654 ASSERT(instr->HasEnvironment()); | 5658 ASSERT(instr->HasEnvironment()); |
5655 LEnvironment* env = instr->environment(); | 5659 LEnvironment* env = instr->environment(); |
5656 // There is no LLazyBailout instruction for stack-checks. We have to | 5660 // There is no LLazyBailout instruction for stack-checks. We have to |
5657 // prepare for lazy deoptimization explicitly here. | 5661 // prepare for lazy deoptimization explicitly here. |
5658 if (instr->hydrogen()->is_function_entry()) { | 5662 if (instr->hydrogen()->is_function_entry()) { |
5659 // Perform stack overflow check. | 5663 // Perform stack overflow check. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5791 __ Subu(scratch, result, scratch); | 5795 __ Subu(scratch, result, scratch); |
5792 __ lw(result, FieldMemOperand(scratch, | 5796 __ lw(result, FieldMemOperand(scratch, |
5793 FixedArray::kHeaderSize - kPointerSize)); | 5797 FixedArray::kHeaderSize - kPointerSize)); |
5794 __ bind(&done); | 5798 __ bind(&done); |
5795 } | 5799 } |
5796 | 5800 |
5797 | 5801 |
5798 #undef __ | 5802 #undef __ |
5799 | 5803 |
5800 } } // namespace v8::internal | 5804 } } // namespace v8::internal |
OLD | NEW |