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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 using v8::internal::rbx; | 50 using v8::internal::rbx; |
51 using v8::internal::rsi; | 51 using v8::internal::rsi; |
52 using v8::internal::rdi; | 52 using v8::internal::rdi; |
53 using v8::internal::rcx; | 53 using v8::internal::rcx; |
54 using v8::internal::rdx; | 54 using v8::internal::rdx; |
55 using v8::internal::rbp; | 55 using v8::internal::rbp; |
56 using v8::internal::rsp; | 56 using v8::internal::rsp; |
57 using v8::internal::r8; | 57 using v8::internal::r8; |
58 using v8::internal::r9; | 58 using v8::internal::r9; |
59 using v8::internal::r11; | 59 using v8::internal::r11; |
60 using v8::internal::r12; | 60 using v8::internal::r12; // Remember: r12..r15 are callee save! |
61 using v8::internal::r13; | 61 using v8::internal::r13; |
62 using v8::internal::r14; | 62 using v8::internal::r14; |
63 using v8::internal::r15; | 63 using v8::internal::r15; |
64 using v8::internal::FUNCTION_CAST; | 64 using v8::internal::FUNCTION_CAST; |
65 using v8::internal::CodeDesc; | 65 using v8::internal::CodeDesc; |
66 using v8::internal::less_equal; | 66 using v8::internal::less_equal; |
67 using v8::internal::not_equal; | 67 using v8::internal::not_equal; |
68 using v8::internal::not_zero; | 68 using v8::internal::not_zero; |
69 using v8::internal::greater; | 69 using v8::internal::greater; |
70 using v8::internal::greater_equal; | 70 using v8::internal::greater_equal; |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 &actual_size, | 1137 &actual_size, |
1138 true)); | 1138 true)); |
1139 CHECK(buffer); | 1139 CHECK(buffer); |
1140 HandleScope handles; | 1140 HandleScope handles; |
1141 MacroAssembler assembler(buffer, actual_size); | 1141 MacroAssembler assembler(buffer, actual_size); |
1142 | 1142 |
1143 MacroAssembler* masm = &assembler; | 1143 MacroAssembler* masm = &assembler; |
1144 masm->set_allow_stub_calls(false); | 1144 masm->set_allow_stub_calls(false); |
1145 Label exit; | 1145 Label exit; |
1146 | 1146 |
| 1147 __ push(r12); |
| 1148 __ push(r15); |
1147 TestSmiDiv(masm, &exit, 0x10, 1, 1); | 1149 TestSmiDiv(masm, &exit, 0x10, 1, 1); |
1148 TestSmiDiv(masm, &exit, 0x20, 1, 0); | 1150 TestSmiDiv(masm, &exit, 0x20, 1, 0); |
1149 TestSmiDiv(masm, &exit, 0x30, -1, 0); | 1151 TestSmiDiv(masm, &exit, 0x30, -1, 0); |
1150 TestSmiDiv(masm, &exit, 0x40, 0, 1); | 1152 TestSmiDiv(masm, &exit, 0x40, 0, 1); |
1151 TestSmiDiv(masm, &exit, 0x50, 0, -1); | 1153 TestSmiDiv(masm, &exit, 0x50, 0, -1); |
1152 TestSmiDiv(masm, &exit, 0x60, 4, 2); | 1154 TestSmiDiv(masm, &exit, 0x60, 4, 2); |
1153 TestSmiDiv(masm, &exit, 0x70, -4, 2); | 1155 TestSmiDiv(masm, &exit, 0x70, -4, 2); |
1154 TestSmiDiv(masm, &exit, 0x80, 4, -2); | 1156 TestSmiDiv(masm, &exit, 0x80, 4, -2); |
1155 TestSmiDiv(masm, &exit, 0x90, -4, -2); | 1157 TestSmiDiv(masm, &exit, 0x90, -4, -2); |
1156 TestSmiDiv(masm, &exit, 0xa0, 3, 2); | 1158 TestSmiDiv(masm, &exit, 0xa0, 3, 2); |
1157 TestSmiDiv(masm, &exit, 0xb0, 3, 4); | 1159 TestSmiDiv(masm, &exit, 0xb0, 3, 4); |
1158 TestSmiDiv(masm, &exit, 0xc0, 1, Smi::kMaxValue); | 1160 TestSmiDiv(masm, &exit, 0xc0, 1, Smi::kMaxValue); |
1159 TestSmiDiv(masm, &exit, 0xd0, -1, Smi::kMaxValue); | 1161 TestSmiDiv(masm, &exit, 0xd0, -1, Smi::kMaxValue); |
1160 TestSmiDiv(masm, &exit, 0xe0, Smi::kMaxValue, 1); | 1162 TestSmiDiv(masm, &exit, 0xe0, Smi::kMaxValue, 1); |
1161 TestSmiDiv(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); | 1163 TestSmiDiv(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); |
1162 TestSmiDiv(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); | 1164 TestSmiDiv(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); |
1163 TestSmiDiv(masm, &exit, 0x110, Smi::kMaxValue, -1); | 1165 TestSmiDiv(masm, &exit, 0x110, Smi::kMaxValue, -1); |
1164 TestSmiDiv(masm, &exit, 0x120, Smi::kMinValue, 1); | 1166 TestSmiDiv(masm, &exit, 0x120, Smi::kMinValue, 1); |
1165 TestSmiDiv(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); | 1167 TestSmiDiv(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); |
1166 TestSmiDiv(masm, &exit, 0x140, Smi::kMinValue, -1); | 1168 TestSmiDiv(masm, &exit, 0x140, Smi::kMinValue, -1); |
1167 | 1169 |
1168 __ xor_(r15, r15); // Success. | 1170 __ xor_(r15, r15); // Success. |
1169 __ bind(&exit); | 1171 __ bind(&exit); |
1170 __ movq(rax, r15); | 1172 __ movq(rax, r15); |
| 1173 __ pop(r15); |
| 1174 __ pop(r12); |
1171 __ ret(0); | 1175 __ ret(0); |
1172 | 1176 |
1173 CodeDesc desc; | 1177 CodeDesc desc; |
1174 masm->GetCode(&desc); | 1178 masm->GetCode(&desc); |
1175 // Call the function from C++. | 1179 // Call the function from C++. |
1176 int result = FUNCTION_CAST<F0>(buffer)(); | 1180 int result = FUNCTION_CAST<F0>(buffer)(); |
1177 CHECK_EQ(0, result); | 1181 CHECK_EQ(0, result); |
1178 } | 1182 } |
1179 | 1183 |
1180 | 1184 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 &actual_size, | 1244 &actual_size, |
1241 true)); | 1245 true)); |
1242 CHECK(buffer); | 1246 CHECK(buffer); |
1243 HandleScope handles; | 1247 HandleScope handles; |
1244 MacroAssembler assembler(buffer, actual_size); | 1248 MacroAssembler assembler(buffer, actual_size); |
1245 | 1249 |
1246 MacroAssembler* masm = &assembler; | 1250 MacroAssembler* masm = &assembler; |
1247 masm->set_allow_stub_calls(false); | 1251 masm->set_allow_stub_calls(false); |
1248 Label exit; | 1252 Label exit; |
1249 | 1253 |
| 1254 __ push(r12); |
| 1255 __ push(r15); |
1250 TestSmiMod(masm, &exit, 0x10, 1, 1); | 1256 TestSmiMod(masm, &exit, 0x10, 1, 1); |
1251 TestSmiMod(masm, &exit, 0x20, 1, 0); | 1257 TestSmiMod(masm, &exit, 0x20, 1, 0); |
1252 TestSmiMod(masm, &exit, 0x30, -1, 0); | 1258 TestSmiMod(masm, &exit, 0x30, -1, 0); |
1253 TestSmiMod(masm, &exit, 0x40, 0, 1); | 1259 TestSmiMod(masm, &exit, 0x40, 0, 1); |
1254 TestSmiMod(masm, &exit, 0x50, 0, -1); | 1260 TestSmiMod(masm, &exit, 0x50, 0, -1); |
1255 TestSmiMod(masm, &exit, 0x60, 4, 2); | 1261 TestSmiMod(masm, &exit, 0x60, 4, 2); |
1256 TestSmiMod(masm, &exit, 0x70, -4, 2); | 1262 TestSmiMod(masm, &exit, 0x70, -4, 2); |
1257 TestSmiMod(masm, &exit, 0x80, 4, -2); | 1263 TestSmiMod(masm, &exit, 0x80, 4, -2); |
1258 TestSmiMod(masm, &exit, 0x90, -4, -2); | 1264 TestSmiMod(masm, &exit, 0x90, -4, -2); |
1259 TestSmiMod(masm, &exit, 0xa0, 3, 2); | 1265 TestSmiMod(masm, &exit, 0xa0, 3, 2); |
1260 TestSmiMod(masm, &exit, 0xb0, 3, 4); | 1266 TestSmiMod(masm, &exit, 0xb0, 3, 4); |
1261 TestSmiMod(masm, &exit, 0xc0, 1, Smi::kMaxValue); | 1267 TestSmiMod(masm, &exit, 0xc0, 1, Smi::kMaxValue); |
1262 TestSmiMod(masm, &exit, 0xd0, -1, Smi::kMaxValue); | 1268 TestSmiMod(masm, &exit, 0xd0, -1, Smi::kMaxValue); |
1263 TestSmiMod(masm, &exit, 0xe0, Smi::kMaxValue, 1); | 1269 TestSmiMod(masm, &exit, 0xe0, Smi::kMaxValue, 1); |
1264 TestSmiMod(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); | 1270 TestSmiMod(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); |
1265 TestSmiMod(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); | 1271 TestSmiMod(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); |
1266 TestSmiMod(masm, &exit, 0x110, Smi::kMaxValue, -1); | 1272 TestSmiMod(masm, &exit, 0x110, Smi::kMaxValue, -1); |
1267 TestSmiMod(masm, &exit, 0x120, Smi::kMinValue, 1); | 1273 TestSmiMod(masm, &exit, 0x120, Smi::kMinValue, 1); |
1268 TestSmiMod(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); | 1274 TestSmiMod(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); |
1269 TestSmiMod(masm, &exit, 0x140, Smi::kMinValue, -1); | 1275 TestSmiMod(masm, &exit, 0x140, Smi::kMinValue, -1); |
1270 | 1276 |
1271 __ xor_(r15, r15); // Success. | 1277 __ xor_(r15, r15); // Success. |
1272 __ bind(&exit); | 1278 __ bind(&exit); |
1273 __ movq(rax, r15); | 1279 __ movq(rax, r15); |
| 1280 __ pop(r15); |
| 1281 __ pop(r12); |
1274 __ ret(0); | 1282 __ ret(0); |
1275 | 1283 |
1276 CodeDesc desc; | 1284 CodeDesc desc; |
1277 masm->GetCode(&desc); | 1285 masm->GetCode(&desc); |
1278 // Call the function from C++. | 1286 // Call the function from C++. |
1279 int result = FUNCTION_CAST<F0>(buffer)(); | 1287 int result = FUNCTION_CAST<F0>(buffer)(); |
1280 CHECK_EQ(0, result); | 1288 CHECK_EQ(0, result); |
1281 } | 1289 } |
1282 | 1290 |
1283 | 1291 |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 | 2095 |
2088 CodeDesc desc; | 2096 CodeDesc desc; |
2089 masm->GetCode(&desc); | 2097 masm->GetCode(&desc); |
2090 // Call the function from C++. | 2098 // Call the function from C++. |
2091 int result = FUNCTION_CAST<F0>(buffer)(); | 2099 int result = FUNCTION_CAST<F0>(buffer)(); |
2092 CHECK_EQ(0, result); | 2100 CHECK_EQ(0, result); |
2093 } | 2101 } |
2094 | 2102 |
2095 | 2103 |
2096 #undef __ | 2104 #undef __ |
OLD | NEW |