| 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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 | 1159 |
| 1160 | 1160 |
| 1161 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { | 1161 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { |
| 1162 Register dividend = ToRegister(instr->dividend()); | 1162 Register dividend = ToRegister(instr->dividend()); |
| 1163 Register result = ToRegister(instr->result()); | 1163 Register result = ToRegister(instr->result()); |
| 1164 int32_t divisor = instr->divisor(); | 1164 int32_t divisor = instr->divisor(); |
| 1165 Register scratch = result.is(dividend) ? scratch0() : dividend; | 1165 Register scratch = result.is(dividend) ? scratch0() : dividend; |
| 1166 DCHECK(!result.is(dividend) || !scratch.is(dividend)); | 1166 DCHECK(!result.is(dividend) || !scratch.is(dividend)); |
| 1167 | 1167 |
| 1168 // If the divisor is 1, return the dividend. | 1168 // If the divisor is 1, return the dividend. |
| 1169 if (divisor == 1) { | 1169 if (divisor == 0) { |
| 1170 __ Move(result, dividend); | 1170 __ Move(result, dividend); |
| 1171 return; | 1171 return; |
| 1172 } | 1172 } |
| 1173 | 1173 |
| 1174 // If the divisor is positive, things are easy: There can be no deopts and we | 1174 // If the divisor is positive, things are easy: There can be no deopts and we |
| 1175 // can simply do an arithmetic right shift. | 1175 // can simply do an arithmetic right shift. |
| 1176 uint16_t shift = WhichPowerOf2Abs(divisor); | 1176 uint16_t shift = WhichPowerOf2Abs(divisor); |
| 1177 if (divisor > 1) { | 1177 if (divisor > 1) { |
| 1178 __ dsra(result, dividend, shift); | 1178 __ dsra(result, dividend, shift); |
| 1179 return; | 1179 return; |
| (...skipping 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3833 } | 3833 } |
| 3834 } | 3834 } |
| 3835 | 3835 |
| 3836 | 3836 |
| 3837 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 3837 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
| 3838 DCHECK(ToRegister(instr->context()).is(cp)); | 3838 DCHECK(ToRegister(instr->context()).is(cp)); |
| 3839 DCHECK(ToRegister(instr->constructor()).is(a1)); | 3839 DCHECK(ToRegister(instr->constructor()).is(a1)); |
| 3840 DCHECK(ToRegister(instr->result()).is(v0)); | 3840 DCHECK(ToRegister(instr->result()).is(v0)); |
| 3841 | 3841 |
| 3842 __ li(a0, Operand(instr->arity())); | 3842 __ li(a0, Operand(instr->arity())); |
| 3843 if (instr->arity() == 1) { | 3843 __ li(a2, instr->hydrogen()->site()); |
| 3844 // We only need the allocation site for the case we have a length argument. | 3844 |
| 3845 // The case may bail out to the runtime, which will determine the correct | |
| 3846 // elements kind with the site. | |
| 3847 __ li(a2, instr->hydrogen()->site()); | |
| 3848 } else { | |
| 3849 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | |
| 3850 } | |
| 3851 ElementsKind kind = instr->hydrogen()->elements_kind(); | 3845 ElementsKind kind = instr->hydrogen()->elements_kind(); |
| 3852 AllocationSiteOverrideMode override_mode = | 3846 AllocationSiteOverrideMode override_mode = |
| 3853 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 3847 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
| 3854 ? DISABLE_ALLOCATION_SITES | 3848 ? DISABLE_ALLOCATION_SITES |
| 3855 : DONT_OVERRIDE; | 3849 : DONT_OVERRIDE; |
| 3856 | 3850 |
| 3857 if (instr->arity() == 0) { | 3851 if (instr->arity() == 0) { |
| 3858 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); | 3852 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); |
| 3859 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3853 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3860 } else if (instr->arity() == 1) { | 3854 } else if (instr->arity() == 1) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3872 override_mode); | 3866 override_mode); |
| 3873 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3867 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3874 __ jmp(&done); | 3868 __ jmp(&done); |
| 3875 __ bind(&packed_case); | 3869 __ bind(&packed_case); |
| 3876 } | 3870 } |
| 3877 | 3871 |
| 3878 ArraySingleArgumentConstructorStub stub(isolate(), kind, override_mode); | 3872 ArraySingleArgumentConstructorStub stub(isolate(), kind, override_mode); |
| 3879 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3873 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3880 __ bind(&done); | 3874 __ bind(&done); |
| 3881 } else { | 3875 } else { |
| 3882 ArrayNArgumentsConstructorStub stub(isolate(), kind, override_mode); | 3876 ArrayNArgumentsConstructorStub stub(isolate()); |
| 3883 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3877 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3884 } | 3878 } |
| 3885 } | 3879 } |
| 3886 | 3880 |
| 3887 | 3881 |
| 3888 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 3882 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
| 3889 CallRuntime(instr->function(), instr->arity(), instr); | 3883 CallRuntime(instr->function(), instr->arity(), instr); |
| 3890 } | 3884 } |
| 3891 | 3885 |
| 3892 | 3886 |
| (...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5760 __ ld(result, FieldMemOperand(scratch, | 5754 __ ld(result, FieldMemOperand(scratch, |
| 5761 FixedArray::kHeaderSize - kPointerSize)); | 5755 FixedArray::kHeaderSize - kPointerSize)); |
| 5762 __ bind(deferred->exit()); | 5756 __ bind(deferred->exit()); |
| 5763 __ bind(&done); | 5757 __ bind(&done); |
| 5764 } | 5758 } |
| 5765 | 5759 |
| 5766 #undef __ | 5760 #undef __ |
| 5767 | 5761 |
| 5768 } // namespace internal | 5762 } // namespace internal |
| 5769 } // namespace v8 | 5763 } // namespace v8 |
| OLD | NEW |