| 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; | |
| 61 using v8::internal::r13; | 60 using v8::internal::r13; |
| 62 using v8::internal::r14; | 61 using v8::internal::r14; |
| 62 using v8::internal::r15; |
| 63 using v8::internal::times_pointer_size; | 63 using v8::internal::times_pointer_size; |
| 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; |
| 71 using v8::internal::carry; | 71 using v8::internal::carry; |
| 72 using v8::internal::not_carry; | 72 using v8::internal::not_carry; |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 bool overflow = (x == Smi::kMinValue && y < 0); // Safe approx. used. | 1122 bool overflow = (x == Smi::kMinValue && y < 0); // Safe approx. used. |
| 1123 #else | 1123 #else |
| 1124 bool overflow = (x == Smi::kMinValue && y == -1); | 1124 bool overflow = (x == Smi::kMinValue && y == -1); |
| 1125 #endif | 1125 #endif |
| 1126 bool fraction = !division_by_zero && !overflow && (x % y != 0); | 1126 bool fraction = !division_by_zero && !overflow && (x % y != 0); |
| 1127 __ Move(r11, Smi::FromInt(x)); | 1127 __ Move(r11, Smi::FromInt(x)); |
| 1128 __ Move(r14, Smi::FromInt(y)); | 1128 __ Move(r14, Smi::FromInt(y)); |
| 1129 if (!fraction && !overflow && !negative_zero && !division_by_zero) { | 1129 if (!fraction && !overflow && !negative_zero && !division_by_zero) { |
| 1130 // Division succeeds | 1130 // Division succeeds |
| 1131 __ movq(rcx, r11); | 1131 __ movq(rcx, r11); |
| 1132 __ movq(r12, Immediate(id)); | 1132 __ movq(r15, Immediate(id)); |
| 1133 int result = x / y; | 1133 int result = x / y; |
| 1134 __ Move(r8, Smi::FromInt(result)); | 1134 __ Move(r8, Smi::FromInt(result)); |
| 1135 __ SmiDiv(r9, rcx, r14, exit); | 1135 __ SmiDiv(r9, rcx, r14, exit); |
| 1136 // Might have destroyed rcx and r14. | 1136 // Might have destroyed rcx and r14. |
| 1137 __ incq(r12); | 1137 __ incq(r15); |
| 1138 __ SmiCompare(r9, r8); | 1138 __ SmiCompare(r9, r8); |
| 1139 __ j(not_equal, exit); | 1139 __ j(not_equal, exit); |
| 1140 | 1140 |
| 1141 __ incq(r12); | 1141 __ incq(r15); |
| 1142 __ movq(rcx, r11); | 1142 __ movq(rcx, r11); |
| 1143 __ Move(r14, Smi::FromInt(y)); | 1143 __ Move(r14, Smi::FromInt(y)); |
| 1144 __ SmiCompare(rcx, r11); | 1144 __ SmiCompare(rcx, r11); |
| 1145 __ j(not_equal, exit); | 1145 __ j(not_equal, exit); |
| 1146 | 1146 |
| 1147 __ incq(r12); | 1147 __ incq(r15); |
| 1148 __ SmiDiv(rcx, rcx, r14, exit); | 1148 __ SmiDiv(rcx, rcx, r14, exit); |
| 1149 | 1149 |
| 1150 __ incq(r12); | 1150 __ incq(r15); |
| 1151 __ SmiCompare(rcx, r8); | 1151 __ SmiCompare(rcx, r8); |
| 1152 __ j(not_equal, exit); | 1152 __ j(not_equal, exit); |
| 1153 } else { | 1153 } else { |
| 1154 // Division fails. | 1154 // Division fails. |
| 1155 __ movq(r12, Immediate(id + 8)); | 1155 __ movq(r15, Immediate(id + 8)); |
| 1156 | 1156 |
| 1157 Label fail_ok, fail_ok2; | 1157 Label fail_ok, fail_ok2; |
| 1158 __ movq(rcx, r11); | 1158 __ movq(rcx, r11); |
| 1159 __ SmiDiv(r9, rcx, r14, &fail_ok); | 1159 __ SmiDiv(r9, rcx, r14, &fail_ok); |
| 1160 __ jmp(exit); | 1160 __ jmp(exit); |
| 1161 __ bind(&fail_ok); | 1161 __ bind(&fail_ok); |
| 1162 | 1162 |
| 1163 __ incq(r12); | 1163 __ incq(r15); |
| 1164 __ SmiCompare(rcx, r11); | 1164 __ SmiCompare(rcx, r11); |
| 1165 __ j(not_equal, exit); | 1165 __ j(not_equal, exit); |
| 1166 | 1166 |
| 1167 __ incq(r12); | 1167 __ incq(r15); |
| 1168 __ SmiDiv(rcx, rcx, r14, &fail_ok2); | 1168 __ SmiDiv(rcx, rcx, r14, &fail_ok2); |
| 1169 __ jmp(exit); | 1169 __ jmp(exit); |
| 1170 __ bind(&fail_ok2); | 1170 __ bind(&fail_ok2); |
| 1171 | 1171 |
| 1172 __ incq(r12); | 1172 __ incq(r15); |
| 1173 __ SmiCompare(rcx, r11); | 1173 __ SmiCompare(rcx, r11); |
| 1174 __ j(not_equal, exit); | 1174 __ j(not_equal, exit); |
| 1175 } | 1175 } |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 | 1178 |
| 1179 TEST(SmiDiv) { | 1179 TEST(SmiDiv) { |
| 1180 v8::internal::V8::Initialize(NULL); | 1180 v8::internal::V8::Initialize(NULL); |
| 1181 // Allocate an executable page of memory. | 1181 // Allocate an executable page of memory. |
| 1182 size_t actual_size; | 1182 size_t actual_size; |
| 1183 byte* buffer = | 1183 byte* buffer = |
| 1184 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1184 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
| 1185 &actual_size, | 1185 &actual_size, |
| 1186 true)); | 1186 true)); |
| 1187 CHECK(buffer); | 1187 CHECK(buffer); |
| 1188 HandleScope handles; | 1188 HandleScope handles; |
| 1189 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1189 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); |
| 1190 | 1190 |
| 1191 MacroAssembler* masm = &assembler; | 1191 MacroAssembler* masm = &assembler; |
| 1192 masm->set_allow_stub_calls(false); | 1192 masm->set_allow_stub_calls(false); |
| 1193 EntryCode(masm); | 1193 EntryCode(masm); |
| 1194 Label exit; | 1194 Label exit; |
| 1195 | 1195 |
| 1196 __ push(r14); | 1196 __ push(r14); |
| 1197 __ push(r12); | 1197 __ push(r15); |
| 1198 TestSmiDiv(masm, &exit, 0x10, 1, 1); | 1198 TestSmiDiv(masm, &exit, 0x10, 1, 1); |
| 1199 TestSmiDiv(masm, &exit, 0x20, 1, 0); | 1199 TestSmiDiv(masm, &exit, 0x20, 1, 0); |
| 1200 TestSmiDiv(masm, &exit, 0x30, -1, 0); | 1200 TestSmiDiv(masm, &exit, 0x30, -1, 0); |
| 1201 TestSmiDiv(masm, &exit, 0x40, 0, 1); | 1201 TestSmiDiv(masm, &exit, 0x40, 0, 1); |
| 1202 TestSmiDiv(masm, &exit, 0x50, 0, -1); | 1202 TestSmiDiv(masm, &exit, 0x50, 0, -1); |
| 1203 TestSmiDiv(masm, &exit, 0x60, 4, 2); | 1203 TestSmiDiv(masm, &exit, 0x60, 4, 2); |
| 1204 TestSmiDiv(masm, &exit, 0x70, -4, 2); | 1204 TestSmiDiv(masm, &exit, 0x70, -4, 2); |
| 1205 TestSmiDiv(masm, &exit, 0x80, 4, -2); | 1205 TestSmiDiv(masm, &exit, 0x80, 4, -2); |
| 1206 TestSmiDiv(masm, &exit, 0x90, -4, -2); | 1206 TestSmiDiv(masm, &exit, 0x90, -4, -2); |
| 1207 TestSmiDiv(masm, &exit, 0xa0, 3, 2); | 1207 TestSmiDiv(masm, &exit, 0xa0, 3, 2); |
| 1208 TestSmiDiv(masm, &exit, 0xb0, 3, 4); | 1208 TestSmiDiv(masm, &exit, 0xb0, 3, 4); |
| 1209 TestSmiDiv(masm, &exit, 0xc0, 1, Smi::kMaxValue); | 1209 TestSmiDiv(masm, &exit, 0xc0, 1, Smi::kMaxValue); |
| 1210 TestSmiDiv(masm, &exit, 0xd0, -1, Smi::kMaxValue); | 1210 TestSmiDiv(masm, &exit, 0xd0, -1, Smi::kMaxValue); |
| 1211 TestSmiDiv(masm, &exit, 0xe0, Smi::kMaxValue, 1); | 1211 TestSmiDiv(masm, &exit, 0xe0, Smi::kMaxValue, 1); |
| 1212 TestSmiDiv(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); | 1212 TestSmiDiv(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); |
| 1213 TestSmiDiv(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); | 1213 TestSmiDiv(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); |
| 1214 TestSmiDiv(masm, &exit, 0x110, Smi::kMaxValue, -1); | 1214 TestSmiDiv(masm, &exit, 0x110, Smi::kMaxValue, -1); |
| 1215 TestSmiDiv(masm, &exit, 0x120, Smi::kMinValue, 1); | 1215 TestSmiDiv(masm, &exit, 0x120, Smi::kMinValue, 1); |
| 1216 TestSmiDiv(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); | 1216 TestSmiDiv(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); |
| 1217 TestSmiDiv(masm, &exit, 0x140, Smi::kMinValue, -1); | 1217 TestSmiDiv(masm, &exit, 0x140, Smi::kMinValue, -1); |
| 1218 | 1218 |
| 1219 __ xor_(r12, r12); // Success. | 1219 __ xor_(r15, r15); // Success. |
| 1220 __ bind(&exit); | 1220 __ bind(&exit); |
| 1221 __ movq(rax, r12); | 1221 __ movq(rax, r15); |
| 1222 __ pop(r12); | 1222 __ pop(r15); |
| 1223 __ pop(r14); | 1223 __ pop(r14); |
| 1224 ExitCode(masm); | 1224 ExitCode(masm); |
| 1225 __ ret(0); | 1225 __ ret(0); |
| 1226 | 1226 |
| 1227 CodeDesc desc; | 1227 CodeDesc desc; |
| 1228 masm->GetCode(&desc); | 1228 masm->GetCode(&desc); |
| 1229 // Call the function from C++. | 1229 // Call the function from C++. |
| 1230 int result = FUNCTION_CAST<F0>(buffer)(); | 1230 int result = FUNCTION_CAST<F0>(buffer)(); |
| 1231 CHECK_EQ(0, result); | 1231 CHECK_EQ(0, result); |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 | 1234 |
| 1235 void TestSmiMod(MacroAssembler* masm, Label* exit, int id, int x, int y) { | 1235 void TestSmiMod(MacroAssembler* masm, Label* exit, int id, int x, int y) { |
| 1236 bool division_by_zero = (y == 0); | 1236 bool division_by_zero = (y == 0); |
| 1237 bool division_overflow = (x == Smi::kMinValue) && (y == -1); | 1237 bool division_overflow = (x == Smi::kMinValue) && (y == -1); |
| 1238 bool fraction = !division_by_zero && !division_overflow && ((x % y) != 0); | 1238 bool fraction = !division_by_zero && !division_overflow && ((x % y) != 0); |
| 1239 bool negative_zero = (!fraction && x < 0); | 1239 bool negative_zero = (!fraction && x < 0); |
| 1240 __ Move(rcx, Smi::FromInt(x)); | 1240 __ Move(rcx, Smi::FromInt(x)); |
| 1241 __ movq(r11, rcx); | 1241 __ movq(r11, rcx); |
| 1242 __ Move(r14, Smi::FromInt(y)); | 1242 __ Move(r14, Smi::FromInt(y)); |
| 1243 if (!division_overflow && !negative_zero && !division_by_zero) { | 1243 if (!division_overflow && !negative_zero && !division_by_zero) { |
| 1244 // Modulo succeeds | 1244 // Modulo succeeds |
| 1245 __ movq(r12, Immediate(id)); | 1245 __ movq(r15, Immediate(id)); |
| 1246 int result = x % y; | 1246 int result = x % y; |
| 1247 __ Move(r8, Smi::FromInt(result)); | 1247 __ Move(r8, Smi::FromInt(result)); |
| 1248 __ SmiMod(r9, rcx, r14, exit); | 1248 __ SmiMod(r9, rcx, r14, exit); |
| 1249 | 1249 |
| 1250 __ incq(r12); | 1250 __ incq(r15); |
| 1251 __ SmiCompare(r9, r8); | 1251 __ SmiCompare(r9, r8); |
| 1252 __ j(not_equal, exit); | 1252 __ j(not_equal, exit); |
| 1253 | 1253 |
| 1254 __ incq(r12); | 1254 __ incq(r15); |
| 1255 __ SmiCompare(rcx, r11); | 1255 __ SmiCompare(rcx, r11); |
| 1256 __ j(not_equal, exit); | 1256 __ j(not_equal, exit); |
| 1257 | 1257 |
| 1258 __ incq(r12); | 1258 __ incq(r15); |
| 1259 __ SmiMod(rcx, rcx, r14, exit); | 1259 __ SmiMod(rcx, rcx, r14, exit); |
| 1260 | 1260 |
| 1261 __ incq(r12); | 1261 __ incq(r15); |
| 1262 __ SmiCompare(rcx, r8); | 1262 __ SmiCompare(rcx, r8); |
| 1263 __ j(not_equal, exit); | 1263 __ j(not_equal, exit); |
| 1264 } else { | 1264 } else { |
| 1265 // Modulo fails. | 1265 // Modulo fails. |
| 1266 __ movq(r12, Immediate(id + 8)); | 1266 __ movq(r15, Immediate(id + 8)); |
| 1267 | 1267 |
| 1268 Label fail_ok, fail_ok2; | 1268 Label fail_ok, fail_ok2; |
| 1269 __ SmiMod(r9, rcx, r14, &fail_ok); | 1269 __ SmiMod(r9, rcx, r14, &fail_ok); |
| 1270 __ jmp(exit); | 1270 __ jmp(exit); |
| 1271 __ bind(&fail_ok); | 1271 __ bind(&fail_ok); |
| 1272 | 1272 |
| 1273 __ incq(r12); | 1273 __ incq(r15); |
| 1274 __ SmiCompare(rcx, r11); | 1274 __ SmiCompare(rcx, r11); |
| 1275 __ j(not_equal, exit); | 1275 __ j(not_equal, exit); |
| 1276 | 1276 |
| 1277 __ incq(r12); | 1277 __ incq(r15); |
| 1278 __ SmiMod(rcx, rcx, r14, &fail_ok2); | 1278 __ SmiMod(rcx, rcx, r14, &fail_ok2); |
| 1279 __ jmp(exit); | 1279 __ jmp(exit); |
| 1280 __ bind(&fail_ok2); | 1280 __ bind(&fail_ok2); |
| 1281 | 1281 |
| 1282 __ incq(r12); | 1282 __ incq(r15); |
| 1283 __ SmiCompare(rcx, r11); | 1283 __ SmiCompare(rcx, r11); |
| 1284 __ j(not_equal, exit); | 1284 __ j(not_equal, exit); |
| 1285 } | 1285 } |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 | 1288 |
| 1289 TEST(SmiMod) { | 1289 TEST(SmiMod) { |
| 1290 v8::internal::V8::Initialize(NULL); | 1290 v8::internal::V8::Initialize(NULL); |
| 1291 // Allocate an executable page of memory. | 1291 // Allocate an executable page of memory. |
| 1292 size_t actual_size; | 1292 size_t actual_size; |
| 1293 byte* buffer = | 1293 byte* buffer = |
| 1294 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1294 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
| 1295 &actual_size, | 1295 &actual_size, |
| 1296 true)); | 1296 true)); |
| 1297 CHECK(buffer); | 1297 CHECK(buffer); |
| 1298 HandleScope handles; | 1298 HandleScope handles; |
| 1299 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1299 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); |
| 1300 | 1300 |
| 1301 MacroAssembler* masm = &assembler; | 1301 MacroAssembler* masm = &assembler; |
| 1302 masm->set_allow_stub_calls(false); | 1302 masm->set_allow_stub_calls(false); |
| 1303 EntryCode(masm); | 1303 EntryCode(masm); |
| 1304 Label exit; | 1304 Label exit; |
| 1305 | 1305 |
| 1306 __ push(r14); | 1306 __ push(r14); |
| 1307 __ push(r12); | 1307 __ push(r15); |
| 1308 TestSmiMod(masm, &exit, 0x10, 1, 1); | 1308 TestSmiMod(masm, &exit, 0x10, 1, 1); |
| 1309 TestSmiMod(masm, &exit, 0x20, 1, 0); | 1309 TestSmiMod(masm, &exit, 0x20, 1, 0); |
| 1310 TestSmiMod(masm, &exit, 0x30, -1, 0); | 1310 TestSmiMod(masm, &exit, 0x30, -1, 0); |
| 1311 TestSmiMod(masm, &exit, 0x40, 0, 1); | 1311 TestSmiMod(masm, &exit, 0x40, 0, 1); |
| 1312 TestSmiMod(masm, &exit, 0x50, 0, -1); | 1312 TestSmiMod(masm, &exit, 0x50, 0, -1); |
| 1313 TestSmiMod(masm, &exit, 0x60, 4, 2); | 1313 TestSmiMod(masm, &exit, 0x60, 4, 2); |
| 1314 TestSmiMod(masm, &exit, 0x70, -4, 2); | 1314 TestSmiMod(masm, &exit, 0x70, -4, 2); |
| 1315 TestSmiMod(masm, &exit, 0x80, 4, -2); | 1315 TestSmiMod(masm, &exit, 0x80, 4, -2); |
| 1316 TestSmiMod(masm, &exit, 0x90, -4, -2); | 1316 TestSmiMod(masm, &exit, 0x90, -4, -2); |
| 1317 TestSmiMod(masm, &exit, 0xa0, 3, 2); | 1317 TestSmiMod(masm, &exit, 0xa0, 3, 2); |
| 1318 TestSmiMod(masm, &exit, 0xb0, 3, 4); | 1318 TestSmiMod(masm, &exit, 0xb0, 3, 4); |
| 1319 TestSmiMod(masm, &exit, 0xc0, 1, Smi::kMaxValue); | 1319 TestSmiMod(masm, &exit, 0xc0, 1, Smi::kMaxValue); |
| 1320 TestSmiMod(masm, &exit, 0xd0, -1, Smi::kMaxValue); | 1320 TestSmiMod(masm, &exit, 0xd0, -1, Smi::kMaxValue); |
| 1321 TestSmiMod(masm, &exit, 0xe0, Smi::kMaxValue, 1); | 1321 TestSmiMod(masm, &exit, 0xe0, Smi::kMaxValue, 1); |
| 1322 TestSmiMod(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); | 1322 TestSmiMod(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); |
| 1323 TestSmiMod(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); | 1323 TestSmiMod(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); |
| 1324 TestSmiMod(masm, &exit, 0x110, Smi::kMaxValue, -1); | 1324 TestSmiMod(masm, &exit, 0x110, Smi::kMaxValue, -1); |
| 1325 TestSmiMod(masm, &exit, 0x120, Smi::kMinValue, 1); | 1325 TestSmiMod(masm, &exit, 0x120, Smi::kMinValue, 1); |
| 1326 TestSmiMod(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); | 1326 TestSmiMod(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); |
| 1327 TestSmiMod(masm, &exit, 0x140, Smi::kMinValue, -1); | 1327 TestSmiMod(masm, &exit, 0x140, Smi::kMinValue, -1); |
| 1328 | 1328 |
| 1329 __ xor_(r12, r12); // Success. | 1329 __ xor_(r15, r15); // Success. |
| 1330 __ bind(&exit); | 1330 __ bind(&exit); |
| 1331 __ movq(rax, r12); | 1331 __ movq(rax, r15); |
| 1332 __ pop(r12); | 1332 __ pop(r15); |
| 1333 __ pop(r14); | 1333 __ pop(r14); |
| 1334 ExitCode(masm); | 1334 ExitCode(masm); |
| 1335 __ ret(0); | 1335 __ ret(0); |
| 1336 | 1336 |
| 1337 CodeDesc desc; | 1337 CodeDesc desc; |
| 1338 masm->GetCode(&desc); | 1338 masm->GetCode(&desc); |
| 1339 // Call the function from C++. | 1339 // Call the function from C++. |
| 1340 int result = FUNCTION_CAST<F0>(buffer)(); | 1340 int result = FUNCTION_CAST<F0>(buffer)(); |
| 1341 CHECK_EQ(0, result); | 1341 CHECK_EQ(0, result); |
| 1342 } | 1342 } |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2165 __ push(Immediate(0x101)); | 2165 __ push(Immediate(0x101)); |
| 2166 __ push(Immediate(0x102)); | 2166 __ push(Immediate(0x102)); |
| 2167 __ push(Immediate(0x103)); | 2167 __ push(Immediate(0x103)); |
| 2168 __ push(Immediate(0x104)); | 2168 __ push(Immediate(0x104)); |
| 2169 __ push(Immediate(0x105)); // <-- rbx | 2169 __ push(Immediate(0x105)); // <-- rbx |
| 2170 __ push(Immediate(0x106)); | 2170 __ push(Immediate(0x106)); |
| 2171 __ push(Immediate(0x107)); | 2171 __ push(Immediate(0x107)); |
| 2172 __ push(Immediate(0x108)); | 2172 __ push(Immediate(0x108)); |
| 2173 __ push(Immediate(0x109)); // <-- rsp | 2173 __ push(Immediate(0x109)); // <-- rsp |
| 2174 // rbp = rsp[9] | 2174 // rbp = rsp[9] |
| 2175 // r12 = rsp[3] | 2175 // r15 = rsp[3] |
| 2176 // rbx = rsp[5] | 2176 // rbx = rsp[5] |
| 2177 // r13 = rsp[7] | 2177 // r13 = rsp[7] |
| 2178 __ lea(r14, Operand(rsp, 3 * kPointerSize)); | 2178 __ lea(r14, Operand(rsp, 3 * kPointerSize)); |
| 2179 __ lea(r13, Operand(rbp, -3 * kPointerSize)); | 2179 __ lea(r13, Operand(rbp, -3 * kPointerSize)); |
| 2180 __ lea(rbx, Operand(rbp, -5 * kPointerSize)); | 2180 __ lea(rbx, Operand(rbp, -5 * kPointerSize)); |
| 2181 __ movl(rcx, Immediate(2)); | 2181 __ movl(rcx, Immediate(2)); |
| 2182 __ movq(r8, reinterpret_cast<uintptr_t>(&data[128]), RelocInfo::NONE); | 2182 __ movq(r8, reinterpret_cast<uintptr_t>(&data[128]), RelocInfo::NONE); |
| 2183 __ movl(rax, Immediate(1)); | 2183 __ movl(rax, Immediate(1)); |
| 2184 | 2184 |
| 2185 Operand sp0 = Operand(rsp, 0); | 2185 Operand sp0 = Operand(rsp, 0); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 CodeDesc desc; | 2487 CodeDesc desc; |
| 2488 masm->GetCode(&desc); | 2488 masm->GetCode(&desc); |
| 2489 // Call the function from C++. | 2489 // Call the function from C++. |
| 2490 int result = FUNCTION_CAST<F0>(buffer)(); | 2490 int result = FUNCTION_CAST<F0>(buffer)(); |
| 2491 CHECK_EQ(0, result); | 2491 CHECK_EQ(0, result); |
| 2492 } | 2492 } |
| 2493 | 2493 |
| 2494 | 2494 |
| 2495 | 2495 |
| 2496 #undef __ | 2496 #undef __ |
| OLD | NEW |