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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 masm->GetCode(&desc); | 1064 masm->GetCode(&desc); |
1065 // Call the function from C++. | 1065 // Call the function from C++. |
1066 int result = FUNCTION_CAST<F0>(buffer)(); | 1066 int result = FUNCTION_CAST<F0>(buffer)(); |
1067 CHECK_EQ(0, result); | 1067 CHECK_EQ(0, result); |
1068 } | 1068 } |
1069 | 1069 |
1070 | 1070 |
1071 void TestSmiDiv(MacroAssembler* masm, Label* exit, int id, int x, int y) { | 1071 void TestSmiDiv(MacroAssembler* masm, Label* exit, int id, int x, int y) { |
1072 bool division_by_zero = (y == 0); | 1072 bool division_by_zero = (y == 0); |
1073 bool negative_zero = (x == 0 && y < 0); | 1073 bool negative_zero = (x == 0 && y < 0); |
1074 #ifdef V8_LONG_SMI | 1074 #ifdef V8_TARGET_ARCH_X64 |
1075 bool overflow = (x == Smi::kMinValue && y < 0); // Safe approx. used. | 1075 bool overflow = (x == Smi::kMinValue && y < 0); // Safe approx. used. |
1076 #else | 1076 #else |
1077 bool overflow = (x == Smi::kMinValue && y == -1); | 1077 bool overflow = (x == Smi::kMinValue && y == -1); |
1078 #endif | 1078 #endif |
1079 bool fraction = !division_by_zero && !overflow && (x % y != 0); | 1079 bool fraction = !division_by_zero && !overflow && (x % y != 0); |
1080 __ Move(r11, Smi::FromInt(x)); | 1080 __ Move(r11, Smi::FromInt(x)); |
1081 __ Move(r12, Smi::FromInt(y)); | 1081 __ Move(r12, Smi::FromInt(y)); |
1082 if (!fraction && !overflow && !negative_zero && !division_by_zero) { | 1082 if (!fraction && !overflow && !negative_zero && !division_by_zero) { |
1083 // Division succeeds | 1083 // Division succeeds |
1084 __ movq(rcx, r11); | 1084 __ movq(rcx, r11); |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 | 2087 |
2088 CodeDesc desc; | 2088 CodeDesc desc; |
2089 masm->GetCode(&desc); | 2089 masm->GetCode(&desc); |
2090 // Call the function from C++. | 2090 // Call the function from C++. |
2091 int result = FUNCTION_CAST<F0>(buffer)(); | 2091 int result = FUNCTION_CAST<F0>(buffer)(); |
2092 CHECK_EQ(0, result); | 2092 CHECK_EQ(0, result); |
2093 } | 2093 } |
2094 | 2094 |
2095 | 2095 |
2096 #undef __ | 2096 #undef __ |
OLD | NEW |