| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" | 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/crankshaft/hydrogen-osr.h" | 9 #include "src/crankshaft/hydrogen-osr.h" |
| 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" |
| (...skipping 4627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4638 } | 4638 } |
| 4639 __ mtc1(src, dbl_scratch); | 4639 __ mtc1(src, dbl_scratch); |
| 4640 __ cvt_d_w(dbl_scratch, dbl_scratch); | 4640 __ cvt_d_w(dbl_scratch, dbl_scratch); |
| 4641 } else { | 4641 } else { |
| 4642 __ mtc1(src, dbl_scratch); | 4642 __ mtc1(src, dbl_scratch); |
| 4643 __ Cvt_d_uw(dbl_scratch, dbl_scratch); | 4643 __ Cvt_d_uw(dbl_scratch, dbl_scratch); |
| 4644 } | 4644 } |
| 4645 | 4645 |
| 4646 if (FLAG_inline_new) { | 4646 if (FLAG_inline_new) { |
| 4647 __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); | 4647 __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); |
| 4648 __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow, TAG_RESULT); | 4648 __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow); |
| 4649 __ Branch(&done); | 4649 __ Branch(&done); |
| 4650 } | 4650 } |
| 4651 | 4651 |
| 4652 // Slow case: Call the runtime system to do the number allocation. | 4652 // Slow case: Call the runtime system to do the number allocation. |
| 4653 __ bind(&slow); | 4653 __ bind(&slow); |
| 4654 { | 4654 { |
| 4655 // TODO(3095996): Put a valid pointer value in the stack slot where the | 4655 // TODO(3095996): Put a valid pointer value in the stack slot where the |
| 4656 // result register is stored, as this register is in the pointer map, but | 4656 // result register is stored, as this register is in the pointer map, but |
| 4657 // contains an integer value. | 4657 // contains an integer value. |
| 4658 __ mov(dst, zero_reg); | 4658 __ mov(dst, zero_reg); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4693 DoubleRegister input_reg = ToDoubleRegister(instr->value()); | 4693 DoubleRegister input_reg = ToDoubleRegister(instr->value()); |
| 4694 Register scratch = scratch0(); | 4694 Register scratch = scratch0(); |
| 4695 Register reg = ToRegister(instr->result()); | 4695 Register reg = ToRegister(instr->result()); |
| 4696 Register temp1 = ToRegister(instr->temp()); | 4696 Register temp1 = ToRegister(instr->temp()); |
| 4697 Register temp2 = ToRegister(instr->temp2()); | 4697 Register temp2 = ToRegister(instr->temp2()); |
| 4698 | 4698 |
| 4699 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); | 4699 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); |
| 4700 if (FLAG_inline_new) { | 4700 if (FLAG_inline_new) { |
| 4701 __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); | 4701 __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); |
| 4702 // We want the untagged address first for performance | 4702 // We want the untagged address first for performance |
| 4703 __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry(), | 4703 __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry()); |
| 4704 DONT_TAG_RESULT); | |
| 4705 } else { | 4704 } else { |
| 4706 __ Branch(deferred->entry()); | 4705 __ Branch(deferred->entry()); |
| 4707 } | 4706 } |
| 4708 __ bind(deferred->exit()); | 4707 __ bind(deferred->exit()); |
| 4709 __ sdc1(input_reg, MemOperand(reg, HeapNumber::kValueOffset)); | 4708 __ sdc1(input_reg, FieldMemOperand(reg, HeapNumber::kValueOffset)); |
| 4710 // Now that we have finished with the object's real address tag it | |
| 4711 __ Daddu(reg, reg, kHeapObjectTag); | |
| 4712 } | 4709 } |
| 4713 | 4710 |
| 4714 | 4711 |
| 4715 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { | 4712 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { |
| 4716 // TODO(3095996): Get rid of this. For now, we need to make the | 4713 // TODO(3095996): Get rid of this. For now, we need to make the |
| 4717 // result register contain a valid pointer because it is already | 4714 // result register contain a valid pointer because it is already |
| 4718 // contained in the register pointer map. | 4715 // contained in the register pointer map. |
| 4719 Register reg = ToRegister(instr->result()); | 4716 Register reg = ToRegister(instr->result()); |
| 4720 __ mov(reg, zero_reg); | 4717 __ mov(reg, zero_reg); |
| 4721 | 4718 |
| 4722 PushSafepointRegistersScope scope(this); | 4719 PushSafepointRegistersScope scope(this); |
| 4723 // NumberTagI and NumberTagD use the context from the frame, rather than | 4720 // NumberTagI and NumberTagD use the context from the frame, rather than |
| 4724 // the environment's HContext or HInlinedContext value. | 4721 // the environment's HContext or HInlinedContext value. |
| 4725 // They only call Runtime::kAllocateHeapNumber. | 4722 // They only call Runtime::kAllocateHeapNumber. |
| 4726 // The corresponding HChange instructions are added in a phase that does | 4723 // The corresponding HChange instructions are added in a phase that does |
| 4727 // not have easy access to the local context. | 4724 // not have easy access to the local context. |
| 4728 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4725 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 4729 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 4726 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
| 4730 RecordSafepointWithRegisters( | 4727 RecordSafepointWithRegisters( |
| 4731 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4728 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
| 4732 __ Dsubu(v0, v0, kHeapObjectTag); | |
| 4733 __ StoreToSafepointRegisterSlot(v0, reg); | 4729 __ StoreToSafepointRegisterSlot(v0, reg); |
| 4734 } | 4730 } |
| 4735 | 4731 |
| 4736 | 4732 |
| 4737 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 4733 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
| 4738 HChange* hchange = instr->hydrogen(); | 4734 HChange* hchange = instr->hydrogen(); |
| 4739 Register input = ToRegister(instr->value()); | 4735 Register input = ToRegister(instr->value()); |
| 4740 Register output = ToRegister(instr->result()); | 4736 Register output = ToRegister(instr->result()); |
| 4741 if (hchange->CheckFlag(HValue::kCanOverflow) && | 4737 if (hchange->CheckFlag(HValue::kCanOverflow) && |
| 4742 hchange->value()->CheckFlag(HValue::kUint32)) { | 4738 hchange->value()->CheckFlag(HValue::kUint32)) { |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5269 }; | 5265 }; |
| 5270 | 5266 |
| 5271 DeferredAllocate* deferred = | 5267 DeferredAllocate* deferred = |
| 5272 new(zone()) DeferredAllocate(this, instr); | 5268 new(zone()) DeferredAllocate(this, instr); |
| 5273 | 5269 |
| 5274 Register result = ToRegister(instr->result()); | 5270 Register result = ToRegister(instr->result()); |
| 5275 Register scratch = ToRegister(instr->temp1()); | 5271 Register scratch = ToRegister(instr->temp1()); |
| 5276 Register scratch2 = ToRegister(instr->temp2()); | 5272 Register scratch2 = ToRegister(instr->temp2()); |
| 5277 | 5273 |
| 5278 // Allocate memory for the object. | 5274 // Allocate memory for the object. |
| 5279 AllocationFlags flags = TAG_OBJECT; | 5275 AllocationFlags flags = NO_ALLOCATION_FLAGS; |
| 5280 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5276 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
| 5281 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5277 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
| 5282 } | 5278 } |
| 5283 if (instr->hydrogen()->IsOldSpaceAllocation()) { | 5279 if (instr->hydrogen()->IsOldSpaceAllocation()) { |
| 5284 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5280 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
| 5285 flags = static_cast<AllocationFlags>(flags | PRETENURE); | 5281 flags = static_cast<AllocationFlags>(flags | PRETENURE); |
| 5286 } | 5282 } |
| 5287 if (instr->size()->IsConstantOperand()) { | 5283 if (instr->size()->IsConstantOperand()) { |
| 5288 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5284 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
| 5289 CHECK(size <= Page::kMaxRegularHeapObjectSize); | 5285 CHECK(size <= Page::kMaxRegularHeapObjectSize); |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5740 __ ld(result, FieldMemOperand(scratch, | 5736 __ ld(result, FieldMemOperand(scratch, |
| 5741 FixedArray::kHeaderSize - kPointerSize)); | 5737 FixedArray::kHeaderSize - kPointerSize)); |
| 5742 __ bind(deferred->exit()); | 5738 __ bind(deferred->exit()); |
| 5743 __ bind(&done); | 5739 __ bind(&done); |
| 5744 } | 5740 } |
| 5745 | 5741 |
| 5746 #undef __ | 5742 #undef __ |
| 5747 | 5743 |
| 5748 } // namespace internal | 5744 } // namespace internal |
| 5749 } // namespace v8 | 5745 } // namespace v8 |
| OLD | NEW |