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

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

Issue 11618017: Deopt on overflow in integer mod. (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 | « src/hydrogen-instructions.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | 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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 // Reduce the dividend by the divisor. 1161 // Reduce the dividend by the divisor.
1162 __ sub(left_reg, Operand(right_reg)); 1162 __ sub(left_reg, Operand(right_reg));
1163 // Check if the dividend is less than the divisor. 1163 // Check if the dividend is less than the divisor.
1164 __ cmp(left_reg, Operand(right_reg)); 1164 __ cmp(left_reg, Operand(right_reg));
1165 __ j(less, &remainder_eq_dividend, Label::kNear); 1165 __ j(less, &remainder_eq_dividend, Label::kNear);
1166 } 1166 }
1167 __ mov(left_reg, scratch); 1167 __ mov(left_reg, scratch);
1168 1168
1169 // Slow case, using idiv instruction. 1169 // Slow case, using idiv instruction.
1170 __ bind(&slow); 1170 __ bind(&slow);
1171
1172 // Check for (kMinInt % -1).
1173 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1174 Label left_not_min_int;
1175 __ cmp(left_reg, kMinInt);
1176 __ j(not_zero, &left_not_min_int, Label::kNear);
1177 __ cmp(right_reg, -1);
1178 DeoptimizeIf(zero, instr->environment());
1179 __ bind(&left_not_min_int);
1180 }
1181
1171 // Sign extend to edx. 1182 // Sign extend to edx.
1172 __ cdq(); 1183 __ cdq();
1173 1184
1174 // Check for (0 % -x) that will produce negative zero. 1185 // Check for (0 % -x) that will produce negative zero.
1175 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1186 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1176 Label positive_left; 1187 Label positive_left;
1177 Label done; 1188 Label done;
1178 __ test(left_reg, Operand(left_reg)); 1189 __ test(left_reg, Operand(left_reg));
1179 __ j(not_sign, &positive_left, Label::kNear); 1190 __ j(not_sign, &positive_left, Label::kNear);
1180 __ idiv(right_reg); 1191 __ idiv(right_reg);
(...skipping 4749 matching lines...) Expand 10 before | Expand all | Expand 10 after
5930 FixedArray::kHeaderSize - kPointerSize)); 5941 FixedArray::kHeaderSize - kPointerSize));
5931 __ bind(&done); 5942 __ bind(&done);
5932 } 5943 }
5933 5944
5934 5945
5935 #undef __ 5946 #undef __
5936 5947
5937 } } // namespace v8::internal 5948 } } // namespace v8::internal
5938 5949
5939 #endif // V8_TARGET_ARCH_IA32 5950 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698