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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arm/lithium-codegen-arm.h" | 7 #include "src/arm/lithium-codegen-arm.h" |
8 #include "src/arm/lithium-gap-resolver-arm.h" | 8 #include "src/arm/lithium-gap-resolver-arm.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/stub-cache.h" | 10 #include "src/stub-cache.h" |
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 __ jmp(&done); | 1208 __ jmp(&done); |
1209 } | 1209 } |
1210 __ bind(&no_overflow_possible); | 1210 __ bind(&no_overflow_possible); |
1211 } | 1211 } |
1212 | 1212 |
1213 // For 'r3 = r1 % r2' we can have the following ARM code: | 1213 // For 'r3 = r1 % r2' we can have the following ARM code: |
1214 // sdiv r3, r1, r2 | 1214 // sdiv r3, r1, r2 |
1215 // mls r3, r3, r2, r1 | 1215 // mls r3, r3, r2, r1 |
1216 | 1216 |
1217 __ sdiv(result_reg, left_reg, right_reg); | 1217 __ sdiv(result_reg, left_reg, right_reg); |
1218 __ mls(result_reg, result_reg, right_reg, left_reg); | 1218 __ Mls(result_reg, result_reg, right_reg, left_reg); |
1219 | 1219 |
1220 // If we care about -0, test if the dividend is <0 and the result is 0. | 1220 // If we care about -0, test if the dividend is <0 and the result is 0. |
1221 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1221 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1222 __ cmp(result_reg, Operand::Zero()); | 1222 __ cmp(result_reg, Operand::Zero()); |
1223 __ b(ne, &done); | 1223 __ b(ne, &done); |
1224 __ cmp(left_reg, Operand::Zero()); | 1224 __ cmp(left_reg, Operand::Zero()); |
1225 DeoptimizeIf(lt, instr->environment()); | 1225 DeoptimizeIf(lt, instr->environment()); |
1226 } | 1226 } |
1227 __ bind(&done); | 1227 __ bind(&done); |
1228 | 1228 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 __ vmov(double_scratch0().low(), divisor); | 1406 __ vmov(double_scratch0().low(), divisor); |
1407 __ vcvt_f64_s32(vright, double_scratch0().low()); | 1407 __ vcvt_f64_s32(vright, double_scratch0().low()); |
1408 __ vdiv(vleft, vleft, vright); // vleft now contains the result. | 1408 __ vdiv(vleft, vleft, vright); // vleft now contains the result. |
1409 __ vcvt_s32_f64(double_scratch0().low(), vleft); | 1409 __ vcvt_s32_f64(double_scratch0().low(), vleft); |
1410 __ vmov(result, double_scratch0().low()); | 1410 __ vmov(result, double_scratch0().low()); |
1411 } | 1411 } |
1412 | 1412 |
1413 if (!hdiv->CheckFlag(HValue::kAllUsesTruncatingToInt32)) { | 1413 if (!hdiv->CheckFlag(HValue::kAllUsesTruncatingToInt32)) { |
1414 // Compute remainder and deopt if it's not zero. | 1414 // Compute remainder and deopt if it's not zero. |
1415 Register remainder = scratch0(); | 1415 Register remainder = scratch0(); |
1416 __ mls(remainder, result, divisor, dividend); | 1416 __ Mls(remainder, result, divisor, dividend); |
1417 __ cmp(remainder, Operand::Zero()); | 1417 __ cmp(remainder, Operand::Zero()); |
1418 DeoptimizeIf(ne, instr->environment()); | 1418 DeoptimizeIf(ne, instr->environment()); |
1419 } | 1419 } |
1420 } | 1420 } |
1421 | 1421 |
1422 | 1422 |
1423 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) { | 1423 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) { |
1424 DwVfpRegister addend = ToDoubleRegister(instr->addend()); | 1424 DwVfpRegister addend = ToDoubleRegister(instr->addend()); |
1425 DwVfpRegister multiplier = ToDoubleRegister(instr->multiplier()); | 1425 DwVfpRegister multiplier = ToDoubleRegister(instr->multiplier()); |
1426 DwVfpRegister multiplicand = ToDoubleRegister(instr->multiplicand()); | 1426 DwVfpRegister multiplicand = ToDoubleRegister(instr->multiplicand()); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 __ vcvt_f64_s32(vleft, double_scratch0().low()); | 1581 __ vcvt_f64_s32(vleft, double_scratch0().low()); |
1582 __ vmov(double_scratch0().low(), right); | 1582 __ vmov(double_scratch0().low(), right); |
1583 __ vcvt_f64_s32(vright, double_scratch0().low()); | 1583 __ vcvt_f64_s32(vright, double_scratch0().low()); |
1584 __ vdiv(vleft, vleft, vright); // vleft now contains the result. | 1584 __ vdiv(vleft, vleft, vright); // vleft now contains the result. |
1585 __ vcvt_s32_f64(double_scratch0().low(), vleft); | 1585 __ vcvt_s32_f64(double_scratch0().low(), vleft); |
1586 __ vmov(result, double_scratch0().low()); | 1586 __ vmov(result, double_scratch0().low()); |
1587 } | 1587 } |
1588 | 1588 |
1589 Label done; | 1589 Label done; |
1590 Register remainder = scratch0(); | 1590 Register remainder = scratch0(); |
1591 __ mls(remainder, result, right, left); | 1591 __ Mls(remainder, result, right, left); |
1592 __ cmp(remainder, Operand::Zero()); | 1592 __ cmp(remainder, Operand::Zero()); |
1593 __ b(eq, &done); | 1593 __ b(eq, &done); |
1594 __ eor(remainder, remainder, Operand(right)); | 1594 __ eor(remainder, remainder, Operand(right)); |
1595 __ add(result, result, Operand(remainder, ASR, 31)); | 1595 __ add(result, result, Operand(remainder, ASR, 31)); |
1596 __ bind(&done); | 1596 __ bind(&done); |
1597 } | 1597 } |
1598 | 1598 |
1599 | 1599 |
1600 void LCodeGen::DoMulI(LMulI* instr) { | 1600 void LCodeGen::DoMulI(LMulI* instr) { |
1601 Register result = ToRegister(instr->result()); | 1601 Register result = ToRegister(instr->result()); |
(...skipping 4231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5833 __ Push(scope_info); | 5833 __ Push(scope_info); |
5834 __ push(ToRegister(instr->function())); | 5834 __ push(ToRegister(instr->function())); |
5835 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr); | 5835 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr); |
5836 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5836 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5837 } | 5837 } |
5838 | 5838 |
5839 | 5839 |
5840 #undef __ | 5840 #undef __ |
5841 | 5841 |
5842 } } // namespace v8::internal | 5842 } } // namespace v8::internal |
OLD | NEW |