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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 } else { | 969 } else { |
970 // div runs in the background while we check for special cases. | 970 // div runs in the background while we check for special cases. |
971 Register right = EmitLoadRegister(instr->right(), scratch); | 971 Register right = EmitLoadRegister(instr->right(), scratch); |
972 __ div(left, right); | 972 __ div(left, right); |
973 | 973 |
974 // Check for x % 0. | 974 // Check for x % 0. |
975 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) { | 975 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) { |
976 DeoptimizeIf(eq, instr->environment(), right, Operand(zero_reg)); | 976 DeoptimizeIf(eq, instr->environment(), right, Operand(zero_reg)); |
977 } | 977 } |
978 | 978 |
| 979 // Check for (kMinInt % -1). |
| 980 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 981 Label left_not_min_int; |
| 982 __ Branch(&left_not_min_int, ne, left, Operand(kMinInt)); |
| 983 DeoptimizeIf(eq, instr->environment(), right, Operand(-1)); |
| 984 __ bind(&left_not_min_int); |
| 985 } |
| 986 |
979 __ Branch(USE_DELAY_SLOT, &done, ge, left, Operand(zero_reg)); | 987 __ Branch(USE_DELAY_SLOT, &done, ge, left, Operand(zero_reg)); |
980 __ mfhi(result); | 988 __ mfhi(result); |
981 | 989 |
982 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 990 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
983 DeoptimizeIf(eq, instr->environment(), result, Operand(zero_reg)); | 991 DeoptimizeIf(eq, instr->environment(), result, Operand(zero_reg)); |
984 } | 992 } |
985 } | 993 } |
986 __ bind(&done); | 994 __ bind(&done); |
987 } | 995 } |
988 | 996 |
(...skipping 13 matching lines...) Expand all Loading... |
1002 } | 1010 } |
1003 | 1011 |
1004 // Check for (0 / -x) that will produce negative zero. | 1012 // Check for (0 / -x) that will produce negative zero. |
1005 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1013 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1006 Label left_not_zero; | 1014 Label left_not_zero; |
1007 __ Branch(&left_not_zero, ne, left, Operand(zero_reg)); | 1015 __ Branch(&left_not_zero, ne, left, Operand(zero_reg)); |
1008 DeoptimizeIf(lt, instr->environment(), right, Operand(zero_reg)); | 1016 DeoptimizeIf(lt, instr->environment(), right, Operand(zero_reg)); |
1009 __ bind(&left_not_zero); | 1017 __ bind(&left_not_zero); |
1010 } | 1018 } |
1011 | 1019 |
1012 // Check for (-kMinInt / -1). | 1020 // Check for (kMinInt / -1). |
1013 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1021 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
1014 Label left_not_min_int; | 1022 Label left_not_min_int; |
1015 __ Branch(&left_not_min_int, ne, left, Operand(kMinInt)); | 1023 __ Branch(&left_not_min_int, ne, left, Operand(kMinInt)); |
1016 DeoptimizeIf(eq, instr->environment(), right, Operand(-1)); | 1024 DeoptimizeIf(eq, instr->environment(), right, Operand(-1)); |
1017 __ bind(&left_not_min_int); | 1025 __ bind(&left_not_min_int); |
1018 } | 1026 } |
1019 | 1027 |
1020 __ mfhi(result); | 1028 __ mfhi(result); |
1021 DeoptimizeIf(ne, instr->environment(), result, Operand(zero_reg)); | 1029 DeoptimizeIf(ne, instr->environment(), result, Operand(zero_reg)); |
1022 __ mflo(result); | 1030 __ mflo(result); |
(...skipping 4498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5521 __ Subu(scratch, result, scratch); | 5529 __ Subu(scratch, result, scratch); |
5522 __ lw(result, FieldMemOperand(scratch, | 5530 __ lw(result, FieldMemOperand(scratch, |
5523 FixedArray::kHeaderSize - kPointerSize)); | 5531 FixedArray::kHeaderSize - kPointerSize)); |
5524 __ bind(&done); | 5532 __ bind(&done); |
5525 } | 5533 } |
5526 | 5534 |
5527 | 5535 |
5528 #undef __ | 5536 #undef __ |
5529 | 5537 |
5530 } } // namespace v8::internal | 5538 } } // namespace v8::internal |
OLD | NEW |