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