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 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 __ rsb(result_reg, result_reg, Operand::Zero(), SetCC); | 1126 __ rsb(result_reg, result_reg, Operand::Zero(), SetCC); |
1127 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1127 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1128 DeoptimizeIf(eq, instr->environment()); | 1128 DeoptimizeIf(eq, instr->environment()); |
1129 } | 1129 } |
1130 __ b(&done); | 1130 __ b(&done); |
1131 } | 1131 } |
1132 | 1132 |
1133 __ bind(&left_is_not_negative); | 1133 __ bind(&left_is_not_negative); |
1134 __ and_(result_reg, left_reg, Operand(divisor - 1)); | 1134 __ and_(result_reg, left_reg, Operand(divisor - 1)); |
1135 __ bind(&done); | 1135 __ bind(&done); |
1136 | |
1137 } else if (hmod->fixed_right_arg().has_value) { | |
1138 Register left_reg = ToRegister(instr->left()); | |
1139 Register right_reg = ToRegister(instr->right()); | |
1140 Register result_reg = ToRegister(instr->result()); | |
1141 | |
1142 int32_t divisor = hmod->fixed_right_arg().value; | |
1143 ASSERT(IsPowerOf2(divisor)); | |
1144 | |
1145 // Check if our assumption of a fixed right operand still holds. | |
1146 __ cmp(right_reg, Operand(divisor)); | |
1147 DeoptimizeIf(ne, instr->environment()); | |
1148 | |
1149 Label left_is_not_negative, done; | |
1150 if (left->CanBeNegative()) { | |
1151 __ cmp(left_reg, Operand::Zero()); | |
1152 __ b(pl, &left_is_not_negative); | |
1153 __ rsb(result_reg, left_reg, Operand::Zero()); | |
1154 __ and_(result_reg, result_reg, Operand(divisor - 1)); | |
1155 __ rsb(result_reg, result_reg, Operand::Zero(), SetCC); | |
1156 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { | |
1157 DeoptimizeIf(eq, instr->environment()); | |
1158 } | |
1159 __ b(&done); | |
1160 } | |
1161 | |
1162 __ bind(&left_is_not_negative); | |
1163 __ and_(result_reg, left_reg, Operand(divisor - 1)); | |
1164 __ bind(&done); | |
1165 | |
1166 } else if (CpuFeatures::IsSupported(SUDIV)) { | 1136 } else if (CpuFeatures::IsSupported(SUDIV)) { |
1167 CpuFeatureScope scope(masm(), SUDIV); | 1137 CpuFeatureScope scope(masm(), SUDIV); |
1168 | 1138 |
1169 Register left_reg = ToRegister(instr->left()); | 1139 Register left_reg = ToRegister(instr->left()); |
1170 Register right_reg = ToRegister(instr->right()); | 1140 Register right_reg = ToRegister(instr->right()); |
1171 Register result_reg = ToRegister(instr->result()); | 1141 Register result_reg = ToRegister(instr->result()); |
1172 | 1142 |
1173 Label done; | 1143 Label done; |
1174 // Check for x % 0, sdiv might signal an exception. We have to deopt in this | 1144 // Check for x % 0, sdiv might signal an exception. We have to deopt in this |
1175 // case because we can't return a NaN. | 1145 // case because we can't return a NaN. |
(...skipping 4757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5933 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5903 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5934 __ ldr(result, FieldMemOperand(scratch, | 5904 __ ldr(result, FieldMemOperand(scratch, |
5935 FixedArray::kHeaderSize - kPointerSize)); | 5905 FixedArray::kHeaderSize - kPointerSize)); |
5936 __ bind(&done); | 5906 __ bind(&done); |
5937 } | 5907 } |
5938 | 5908 |
5939 | 5909 |
5940 #undef __ | 5910 #undef __ |
5941 | 5911 |
5942 } } // namespace v8::internal | 5912 } } // namespace v8::internal |
OLD | NEW |