Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 11618020: Fix ARM code for DoModI. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 Label done; 1098 Label done;
1099 1099
1100 if (CpuFeatures::IsSupported(SUDIV)) { 1100 if (CpuFeatures::IsSupported(SUDIV)) {
1101 CpuFeatures::Scope scope(SUDIV); 1101 CpuFeatures::Scope scope(SUDIV);
1102 // Check for x % 0. 1102 // Check for x % 0.
1103 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) { 1103 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
1104 __ cmp(right, Operand(0)); 1104 __ cmp(right, Operand(0));
1105 DeoptimizeIf(eq, instr->environment()); 1105 DeoptimizeIf(eq, instr->environment());
1106 } 1106 }
1107 1107
1108 // Check for (kMinInt % -1).
1109 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1110 Label left_not_min_int;
1111 __ cmp(left, Operand(kMinInt));
1112 __ b(ne, &left_not_min_int);
1113 __ cmp(right, Operand(-1));
1114 DeoptimizeIf(eq, instr->environment());
1115 __ bind(&left_not_min_int);
1116 }
1117
1108 // For r3 = r1 % r2; we can have the following ARM code 1118 // For r3 = r1 % r2; we can have the following ARM code
1109 // sdiv r3, r1, r2 1119 // sdiv r3, r1, r2
1110 // mls r3, r3, r2, r1 1120 // mls r3, r3, r2, r1
1111 1121
1112 __ sdiv(result, left, right); 1122 __ sdiv(result, left, right);
1113 __ mls(result, result, right, left); 1123 __ mls(result, result, right, left);
1114 __ cmp(result, Operand(0)); 1124 __ cmp(result, Operand(0));
1115 __ b(ne, &done); 1125 __ b(ne, &done);
1116 1126
1117 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1127 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1118 __ cmp(left, Operand(0)); 1128 __ cmp(left, Operand(0));
1119 DeoptimizeIf(lt, instr->environment()); 1129 DeoptimizeIf(lt, instr->environment());
1120 } 1130 }
1121 } else { 1131 } else {
1122 Register scratch = scratch0(); 1132 Register scratch = scratch0();
1123 Register scratch2 = ToRegister(instr->temp()); 1133 Register scratch2 = ToRegister(instr->temp());
1124 DwVfpRegister dividend = ToDoubleRegister(instr->temp2()); 1134 DwVfpRegister dividend = ToDoubleRegister(instr->temp2());
1125 DwVfpRegister divisor = ToDoubleRegister(instr->temp3()); 1135 DwVfpRegister divisor = ToDoubleRegister(instr->temp3());
1126 DwVfpRegister quotient = double_scratch0(); 1136 DwVfpRegister quotient = double_scratch0();
1127 1137
1128 ASSERT(!dividend.is(divisor)); 1138 ASSERT(!dividend.is(divisor));
1129 ASSERT(!dividend.is(quotient)); 1139 ASSERT(!dividend.is(quotient));
1130 ASSERT(!divisor.is(quotient)); 1140 ASSERT(!divisor.is(quotient));
1131 ASSERT(!scratch.is(left)); 1141 ASSERT(!scratch.is(left));
1132 ASSERT(!scratch.is(right)); 1142 ASSERT(!scratch.is(right));
1133 ASSERT(!scratch.is(result)); 1143 ASSERT(!scratch.is(result));
1134 1144
1135 Label vfp_modulo, both_positive, right_negative; 1145 Label vfp_modulo, both_positive, right_negative;
1136 1146
1147 CpuFeatures::Scope scope(VFP2);
1148
1137 // Check for x % 0. 1149 // Check for x % 0.
1138 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) { 1150 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
1139 __ cmp(right, Operand(0)); 1151 __ cmp(right, Operand(0));
1140 DeoptimizeIf(eq, instr->environment()); 1152 DeoptimizeIf(eq, instr->environment());
1141 } 1153 }
1142 1154
1143 __ Move(result, left); 1155 __ Move(result, left);
1144 1156
1145 // (0 % x) must yield 0 (if x is finite, which is the case here). 1157 // (0 % x) must yield 0 (if x is finite, which is the case here).
1146 __ cmp(left, Operand(0)); 1158 __ cmp(left, Operand(0));
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 // Check for (0 / -x) that will produce negative zero. 1361 // Check for (0 / -x) that will produce negative zero.
1350 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1362 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1351 Label left_not_zero; 1363 Label left_not_zero;
1352 __ cmp(left, Operand(0)); 1364 __ cmp(left, Operand(0));
1353 __ b(ne, &left_not_zero); 1365 __ b(ne, &left_not_zero);
1354 __ cmp(right, Operand(0)); 1366 __ cmp(right, Operand(0));
1355 DeoptimizeIf(mi, instr->environment()); 1367 DeoptimizeIf(mi, instr->environment());
1356 __ bind(&left_not_zero); 1368 __ bind(&left_not_zero);
1357 } 1369 }
1358 1370
1359 // Check for (-kMinInt / -1). 1371 // Check for (kMinInt / -1).
1360 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { 1372 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1361 Label left_not_min_int; 1373 Label left_not_min_int;
1362 __ cmp(left, Operand(kMinInt)); 1374 __ cmp(left, Operand(kMinInt));
1363 __ b(ne, &left_not_min_int); 1375 __ b(ne, &left_not_min_int);
1364 __ cmp(right, Operand(-1)); 1376 __ cmp(right, Operand(-1));
1365 DeoptimizeIf(eq, instr->environment()); 1377 DeoptimizeIf(eq, instr->environment());
1366 __ bind(&left_not_min_int); 1378 __ bind(&left_not_min_int);
1367 } 1379 }
1368 1380
1369 Label done, deoptimize; 1381 Label done, deoptimize;
(...skipping 4658 matching lines...) Expand 10 before | Expand all | Expand 10 after
6028 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 6040 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
6029 __ ldr(result, FieldMemOperand(scratch, 6041 __ ldr(result, FieldMemOperand(scratch,
6030 FixedArray::kHeaderSize - kPointerSize)); 6042 FixedArray::kHeaderSize - kPointerSize));
6031 __ bind(&done); 6043 __ bind(&done);
6032 } 6044 }
6033 6045
6034 6046
6035 #undef __ 6047 #undef __
6036 6048
6037 } } // namespace v8::internal 6049 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698