OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 masm->GetCode(&desc); | 1124 masm->GetCode(&desc); |
1125 // Call the function from C++. | 1125 // Call the function from C++. |
1126 int result = FUNCTION_CAST<F0>(buffer)(); | 1126 int result = FUNCTION_CAST<F0>(buffer)(); |
1127 CHECK_EQ(0, result); | 1127 CHECK_EQ(0, result); |
1128 } | 1128 } |
1129 | 1129 |
1130 | 1130 |
1131 void TestSmiDiv(MacroAssembler* masm, Label* exit, int id, int x, int y) { | 1131 void TestSmiDiv(MacroAssembler* masm, Label* exit, int id, int x, int y) { |
1132 bool division_by_zero = (y == 0); | 1132 bool division_by_zero = (y == 0); |
1133 bool negative_zero = (x == 0 && y < 0); | 1133 bool negative_zero = (x == 0 && y < 0); |
1134 #ifdef V8_TARGET_ARCH_X64 | 1134 #if V8_TARGET_ARCH_X64 |
1135 bool overflow = (x == Smi::kMinValue && y < 0); // Safe approx. used. | 1135 bool overflow = (x == Smi::kMinValue && y < 0); // Safe approx. used. |
1136 #else | 1136 #else |
1137 bool overflow = (x == Smi::kMinValue && y == -1); | 1137 bool overflow = (x == Smi::kMinValue && y == -1); |
1138 #endif | 1138 #endif |
1139 bool fraction = !division_by_zero && !overflow && (x % y != 0); | 1139 bool fraction = !division_by_zero && !overflow && (x % y != 0); |
1140 __ Move(r11, Smi::FromInt(x)); | 1140 __ Move(r11, Smi::FromInt(x)); |
1141 __ Move(r14, Smi::FromInt(y)); | 1141 __ Move(r14, Smi::FromInt(y)); |
1142 if (!fraction && !overflow && !negative_zero && !division_by_zero) { | 1142 if (!fraction && !overflow && !negative_zero && !division_by_zero) { |
1143 // Division succeeds | 1143 // Division succeeds |
1144 __ movq(rcx, r11); | 1144 __ movq(rcx, r11); |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2513 CodeDesc desc; | 2513 CodeDesc desc; |
2514 masm->GetCode(&desc); | 2514 masm->GetCode(&desc); |
2515 // Call the function from C++. | 2515 // Call the function from C++. |
2516 int result = FUNCTION_CAST<F0>(buffer)(); | 2516 int result = FUNCTION_CAST<F0>(buffer)(); |
2517 CHECK_EQ(0, result); | 2517 CHECK_EQ(0, result); |
2518 } | 2518 } |
2519 | 2519 |
2520 | 2520 |
2521 | 2521 |
2522 #undef __ | 2522 #undef __ |
OLD | NEW |