| 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 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 bool overflow = (x == Smi::kMinValue && y < 0); // Safe approx. used. | 1113 bool overflow = (x == Smi::kMinValue && y < 0); // Safe approx. used. |
| 1114 #else | 1114 #else |
| 1115 bool overflow = (x == Smi::kMinValue && y == -1); | 1115 bool overflow = (x == Smi::kMinValue && y == -1); |
| 1116 #endif | 1116 #endif |
| 1117 bool fraction = !division_by_zero && !overflow && (x % y != 0); | 1117 bool fraction = !division_by_zero && !overflow && (x % y != 0); |
| 1118 __ Move(r11, Smi::FromInt(x)); | 1118 __ Move(r11, Smi::FromInt(x)); |
| 1119 __ Move(r14, Smi::FromInt(y)); | 1119 __ Move(r14, Smi::FromInt(y)); |
| 1120 if (!fraction && !overflow && !negative_zero && !division_by_zero) { | 1120 if (!fraction && !overflow && !negative_zero && !division_by_zero) { |
| 1121 // Division succeeds | 1121 // Division succeeds |
| 1122 __ movq(rcx, r11); | 1122 __ movq(rcx, r11); |
| 1123 __ movq(r12, Immediate(id)); | 1123 __ movq(r15, Immediate(id)); |
| 1124 int result = x / y; | 1124 int result = x / y; |
| 1125 __ Move(r8, Smi::FromInt(result)); | 1125 __ Move(r8, Smi::FromInt(result)); |
| 1126 __ SmiDiv(r9, rcx, r14, exit); | 1126 __ SmiDiv(r9, rcx, r14, exit); |
| 1127 // Might have destroyed rcx and r14. | 1127 // Might have destroyed rcx and r14. |
| 1128 __ incq(r12); | 1128 __ incq(r15); |
| 1129 __ SmiCompare(r9, r8); | 1129 __ SmiCompare(r9, r8); |
| 1130 __ j(not_equal, exit); | 1130 __ j(not_equal, exit); |
| 1131 | 1131 |
| 1132 __ incq(r12); | 1132 __ incq(r15); |
| 1133 __ movq(rcx, r11); | 1133 __ movq(rcx, r11); |
| 1134 __ Move(r14, Smi::FromInt(y)); | 1134 __ Move(r14, Smi::FromInt(y)); |
| 1135 __ SmiCompare(rcx, r11); | 1135 __ SmiCompare(rcx, r11); |
| 1136 __ j(not_equal, exit); | 1136 __ j(not_equal, exit); |
| 1137 | 1137 |
| 1138 __ incq(r12); | 1138 __ incq(r15); |
| 1139 __ SmiDiv(rcx, rcx, r14, exit); | 1139 __ SmiDiv(rcx, rcx, r14, exit); |
| 1140 | 1140 |
| 1141 __ incq(r12); | 1141 __ incq(r15); |
| 1142 __ SmiCompare(rcx, r8); | 1142 __ SmiCompare(rcx, r8); |
| 1143 __ j(not_equal, exit); | 1143 __ j(not_equal, exit); |
| 1144 } else { | 1144 } else { |
| 1145 // Division fails. | 1145 // Division fails. |
| 1146 __ movq(r12, Immediate(id + 8)); | 1146 __ movq(r15, Immediate(id + 8)); |
| 1147 | 1147 |
| 1148 Label fail_ok, fail_ok2; | 1148 Label fail_ok, fail_ok2; |
| 1149 __ movq(rcx, r11); | 1149 __ movq(rcx, r11); |
| 1150 __ SmiDiv(r9, rcx, r14, &fail_ok); | 1150 __ SmiDiv(r9, rcx, r14, &fail_ok); |
| 1151 __ jmp(exit); | 1151 __ jmp(exit); |
| 1152 __ bind(&fail_ok); | 1152 __ bind(&fail_ok); |
| 1153 | 1153 |
| 1154 __ incq(r12); | 1154 __ incq(r15); |
| 1155 __ SmiCompare(rcx, r11); | 1155 __ SmiCompare(rcx, r11); |
| 1156 __ j(not_equal, exit); | 1156 __ j(not_equal, exit); |
| 1157 | 1157 |
| 1158 __ incq(r12); | 1158 __ incq(r15); |
| 1159 __ SmiDiv(rcx, rcx, r14, &fail_ok2); | 1159 __ SmiDiv(rcx, rcx, r14, &fail_ok2); |
| 1160 __ jmp(exit); | 1160 __ jmp(exit); |
| 1161 __ bind(&fail_ok2); | 1161 __ bind(&fail_ok2); |
| 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 } | 1167 } |
| 1168 | 1168 |
| 1169 | 1169 |
| 1170 TEST(SmiDiv) { | 1170 TEST(SmiDiv) { |
| 1171 // Allocate an executable page of memory. | 1171 // Allocate an executable page of memory. |
| 1172 size_t actual_size; | 1172 size_t actual_size; |
| 1173 byte* buffer = | 1173 byte* buffer = |
| 1174 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1174 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
| 1175 &actual_size, | 1175 &actual_size, |
| 1176 true)); | 1176 true)); |
| 1177 CHECK(buffer); | 1177 CHECK(buffer); |
| 1178 HandleScope handles; | 1178 HandleScope handles; |
| 1179 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1179 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); |
| 1180 | 1180 |
| 1181 MacroAssembler* masm = &assembler; | 1181 MacroAssembler* masm = &assembler; |
| 1182 masm->set_allow_stub_calls(false); | 1182 masm->set_allow_stub_calls(false); |
| 1183 EntryCode(masm); | 1183 EntryCode(masm); |
| 1184 Label exit; | 1184 Label exit; |
| 1185 | 1185 |
| 1186 __ push(r14); | 1186 __ push(r14); |
| 1187 __ push(r12); | 1187 __ push(r15); |
| 1188 TestSmiDiv(masm, &exit, 0x10, 1, 1); | 1188 TestSmiDiv(masm, &exit, 0x10, 1, 1); |
| 1189 TestSmiDiv(masm, &exit, 0x20, 1, 0); | 1189 TestSmiDiv(masm, &exit, 0x20, 1, 0); |
| 1190 TestSmiDiv(masm, &exit, 0x30, -1, 0); | 1190 TestSmiDiv(masm, &exit, 0x30, -1, 0); |
| 1191 TestSmiDiv(masm, &exit, 0x40, 0, 1); | 1191 TestSmiDiv(masm, &exit, 0x40, 0, 1); |
| 1192 TestSmiDiv(masm, &exit, 0x50, 0, -1); | 1192 TestSmiDiv(masm, &exit, 0x50, 0, -1); |
| 1193 TestSmiDiv(masm, &exit, 0x60, 4, 2); | 1193 TestSmiDiv(masm, &exit, 0x60, 4, 2); |
| 1194 TestSmiDiv(masm, &exit, 0x70, -4, 2); | 1194 TestSmiDiv(masm, &exit, 0x70, -4, 2); |
| 1195 TestSmiDiv(masm, &exit, 0x80, 4, -2); | 1195 TestSmiDiv(masm, &exit, 0x80, 4, -2); |
| 1196 TestSmiDiv(masm, &exit, 0x90, -4, -2); | 1196 TestSmiDiv(masm, &exit, 0x90, -4, -2); |
| 1197 TestSmiDiv(masm, &exit, 0xa0, 3, 2); | 1197 TestSmiDiv(masm, &exit, 0xa0, 3, 2); |
| 1198 TestSmiDiv(masm, &exit, 0xb0, 3, 4); | 1198 TestSmiDiv(masm, &exit, 0xb0, 3, 4); |
| 1199 TestSmiDiv(masm, &exit, 0xc0, 1, Smi::kMaxValue); | 1199 TestSmiDiv(masm, &exit, 0xc0, 1, Smi::kMaxValue); |
| 1200 TestSmiDiv(masm, &exit, 0xd0, -1, Smi::kMaxValue); | 1200 TestSmiDiv(masm, &exit, 0xd0, -1, Smi::kMaxValue); |
| 1201 TestSmiDiv(masm, &exit, 0xe0, Smi::kMaxValue, 1); | 1201 TestSmiDiv(masm, &exit, 0xe0, Smi::kMaxValue, 1); |
| 1202 TestSmiDiv(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); | 1202 TestSmiDiv(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); |
| 1203 TestSmiDiv(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); | 1203 TestSmiDiv(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); |
| 1204 TestSmiDiv(masm, &exit, 0x110, Smi::kMaxValue, -1); | 1204 TestSmiDiv(masm, &exit, 0x110, Smi::kMaxValue, -1); |
| 1205 TestSmiDiv(masm, &exit, 0x120, Smi::kMinValue, 1); | 1205 TestSmiDiv(masm, &exit, 0x120, Smi::kMinValue, 1); |
| 1206 TestSmiDiv(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); | 1206 TestSmiDiv(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); |
| 1207 TestSmiDiv(masm, &exit, 0x140, Smi::kMinValue, -1); | 1207 TestSmiDiv(masm, &exit, 0x140, Smi::kMinValue, -1); |
| 1208 | 1208 |
| 1209 __ xor_(r12, r12); // Success. | 1209 __ xor_(r15, r15); // Success. |
| 1210 __ bind(&exit); | 1210 __ bind(&exit); |
| 1211 __ movq(rax, r12); | 1211 __ movq(rax, r15); |
| 1212 __ pop(r12); | 1212 __ pop(r15); |
| 1213 __ pop(r14); | 1213 __ pop(r14); |
| 1214 ExitCode(masm); | 1214 ExitCode(masm); |
| 1215 __ ret(0); | 1215 __ ret(0); |
| 1216 | 1216 |
| 1217 CodeDesc desc; | 1217 CodeDesc desc; |
| 1218 masm->GetCode(&desc); | 1218 masm->GetCode(&desc); |
| 1219 // Call the function from C++. | 1219 // Call the function from C++. |
| 1220 int result = FUNCTION_CAST<F0>(buffer)(); | 1220 int result = FUNCTION_CAST<F0>(buffer)(); |
| 1221 CHECK_EQ(0, result); | 1221 CHECK_EQ(0, result); |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 | 1224 |
| 1225 void TestSmiMod(MacroAssembler* masm, Label* exit, int id, int x, int y) { | 1225 void TestSmiMod(MacroAssembler* masm, Label* exit, int id, int x, int y) { |
| 1226 bool division_by_zero = (y == 0); | 1226 bool division_by_zero = (y == 0); |
| 1227 bool division_overflow = (x == Smi::kMinValue) && (y == -1); | 1227 bool division_overflow = (x == Smi::kMinValue) && (y == -1); |
| 1228 bool fraction = !division_by_zero && !division_overflow && ((x % y) != 0); | 1228 bool fraction = !division_by_zero && !division_overflow && ((x % y) != 0); |
| 1229 bool negative_zero = (!fraction && x < 0); | 1229 bool negative_zero = (!fraction && x < 0); |
| 1230 __ Move(rcx, Smi::FromInt(x)); | 1230 __ Move(rcx, Smi::FromInt(x)); |
| 1231 __ movq(r11, rcx); | 1231 __ movq(r11, rcx); |
| 1232 __ Move(r14, Smi::FromInt(y)); | 1232 __ Move(r14, Smi::FromInt(y)); |
| 1233 if (!division_overflow && !negative_zero && !division_by_zero) { | 1233 if (!division_overflow && !negative_zero && !division_by_zero) { |
| 1234 // Modulo succeeds | 1234 // Modulo succeeds |
| 1235 __ movq(r12, Immediate(id)); | 1235 __ movq(r15, Immediate(id)); |
| 1236 int result = x % y; | 1236 int result = x % y; |
| 1237 __ Move(r8, Smi::FromInt(result)); | 1237 __ Move(r8, Smi::FromInt(result)); |
| 1238 __ SmiMod(r9, rcx, r14, exit); | 1238 __ SmiMod(r9, rcx, r14, exit); |
| 1239 | 1239 |
| 1240 __ incq(r12); | 1240 __ incq(r15); |
| 1241 __ SmiCompare(r9, r8); | 1241 __ SmiCompare(r9, r8); |
| 1242 __ j(not_equal, exit); | 1242 __ j(not_equal, exit); |
| 1243 | 1243 |
| 1244 __ incq(r12); | 1244 __ incq(r15); |
| 1245 __ SmiCompare(rcx, r11); | 1245 __ SmiCompare(rcx, r11); |
| 1246 __ j(not_equal, exit); | 1246 __ j(not_equal, exit); |
| 1247 | 1247 |
| 1248 __ incq(r12); | 1248 __ incq(r15); |
| 1249 __ SmiMod(rcx, rcx, r14, exit); | 1249 __ SmiMod(rcx, rcx, r14, exit); |
| 1250 | 1250 |
| 1251 __ incq(r12); | 1251 __ incq(r15); |
| 1252 __ SmiCompare(rcx, r8); | 1252 __ SmiCompare(rcx, r8); |
| 1253 __ j(not_equal, exit); | 1253 __ j(not_equal, exit); |
| 1254 } else { | 1254 } else { |
| 1255 // Modulo fails. | 1255 // Modulo fails. |
| 1256 __ movq(r12, Immediate(id + 8)); | 1256 __ movq(r15, Immediate(id + 8)); |
| 1257 | 1257 |
| 1258 Label fail_ok, fail_ok2; | 1258 Label fail_ok, fail_ok2; |
| 1259 __ SmiMod(r9, rcx, r14, &fail_ok); | 1259 __ SmiMod(r9, rcx, r14, &fail_ok); |
| 1260 __ jmp(exit); | 1260 __ jmp(exit); |
| 1261 __ bind(&fail_ok); | 1261 __ bind(&fail_ok); |
| 1262 | 1262 |
| 1263 __ incq(r12); | 1263 __ incq(r15); |
| 1264 __ SmiCompare(rcx, r11); | 1264 __ SmiCompare(rcx, r11); |
| 1265 __ j(not_equal, exit); | 1265 __ j(not_equal, exit); |
| 1266 | 1266 |
| 1267 __ incq(r12); | 1267 __ incq(r15); |
| 1268 __ SmiMod(rcx, rcx, r14, &fail_ok2); | 1268 __ SmiMod(rcx, rcx, r14, &fail_ok2); |
| 1269 __ jmp(exit); | 1269 __ jmp(exit); |
| 1270 __ bind(&fail_ok2); | 1270 __ bind(&fail_ok2); |
| 1271 | 1271 |
| 1272 __ incq(r12); | 1272 __ incq(r15); |
| 1273 __ SmiCompare(rcx, r11); | 1273 __ SmiCompare(rcx, r11); |
| 1274 __ j(not_equal, exit); | 1274 __ j(not_equal, exit); |
| 1275 } | 1275 } |
| 1276 } | 1276 } |
| 1277 | 1277 |
| 1278 | 1278 |
| 1279 TEST(SmiMod) { | 1279 TEST(SmiMod) { |
| 1280 // Allocate an executable page of memory. | 1280 // Allocate an executable page of memory. |
| 1281 size_t actual_size; | 1281 size_t actual_size; |
| 1282 byte* buffer = | 1282 byte* buffer = |
| 1283 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1283 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
| 1284 &actual_size, | 1284 &actual_size, |
| 1285 true)); | 1285 true)); |
| 1286 CHECK(buffer); | 1286 CHECK(buffer); |
| 1287 HandleScope handles; | 1287 HandleScope handles; |
| 1288 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1288 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); |
| 1289 | 1289 |
| 1290 MacroAssembler* masm = &assembler; | 1290 MacroAssembler* masm = &assembler; |
| 1291 masm->set_allow_stub_calls(false); | 1291 masm->set_allow_stub_calls(false); |
| 1292 EntryCode(masm); | 1292 EntryCode(masm); |
| 1293 Label exit; | 1293 Label exit; |
| 1294 | 1294 |
| 1295 __ push(r14); | 1295 __ push(r14); |
| 1296 __ push(r12); | 1296 __ push(r15); |
| 1297 TestSmiMod(masm, &exit, 0x10, 1, 1); | 1297 TestSmiMod(masm, &exit, 0x10, 1, 1); |
| 1298 TestSmiMod(masm, &exit, 0x20, 1, 0); | 1298 TestSmiMod(masm, &exit, 0x20, 1, 0); |
| 1299 TestSmiMod(masm, &exit, 0x30, -1, 0); | 1299 TestSmiMod(masm, &exit, 0x30, -1, 0); |
| 1300 TestSmiMod(masm, &exit, 0x40, 0, 1); | 1300 TestSmiMod(masm, &exit, 0x40, 0, 1); |
| 1301 TestSmiMod(masm, &exit, 0x50, 0, -1); | 1301 TestSmiMod(masm, &exit, 0x50, 0, -1); |
| 1302 TestSmiMod(masm, &exit, 0x60, 4, 2); | 1302 TestSmiMod(masm, &exit, 0x60, 4, 2); |
| 1303 TestSmiMod(masm, &exit, 0x70, -4, 2); | 1303 TestSmiMod(masm, &exit, 0x70, -4, 2); |
| 1304 TestSmiMod(masm, &exit, 0x80, 4, -2); | 1304 TestSmiMod(masm, &exit, 0x80, 4, -2); |
| 1305 TestSmiMod(masm, &exit, 0x90, -4, -2); | 1305 TestSmiMod(masm, &exit, 0x90, -4, -2); |
| 1306 TestSmiMod(masm, &exit, 0xa0, 3, 2); | 1306 TestSmiMod(masm, &exit, 0xa0, 3, 2); |
| 1307 TestSmiMod(masm, &exit, 0xb0, 3, 4); | 1307 TestSmiMod(masm, &exit, 0xb0, 3, 4); |
| 1308 TestSmiMod(masm, &exit, 0xc0, 1, Smi::kMaxValue); | 1308 TestSmiMod(masm, &exit, 0xc0, 1, Smi::kMaxValue); |
| 1309 TestSmiMod(masm, &exit, 0xd0, -1, Smi::kMaxValue); | 1309 TestSmiMod(masm, &exit, 0xd0, -1, Smi::kMaxValue); |
| 1310 TestSmiMod(masm, &exit, 0xe0, Smi::kMaxValue, 1); | 1310 TestSmiMod(masm, &exit, 0xe0, Smi::kMaxValue, 1); |
| 1311 TestSmiMod(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); | 1311 TestSmiMod(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue); |
| 1312 TestSmiMod(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); | 1312 TestSmiMod(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue); |
| 1313 TestSmiMod(masm, &exit, 0x110, Smi::kMaxValue, -1); | 1313 TestSmiMod(masm, &exit, 0x110, Smi::kMaxValue, -1); |
| 1314 TestSmiMod(masm, &exit, 0x120, Smi::kMinValue, 1); | 1314 TestSmiMod(masm, &exit, 0x120, Smi::kMinValue, 1); |
| 1315 TestSmiMod(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); | 1315 TestSmiMod(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue); |
| 1316 TestSmiMod(masm, &exit, 0x140, Smi::kMinValue, -1); | 1316 TestSmiMod(masm, &exit, 0x140, Smi::kMinValue, -1); |
| 1317 | 1317 |
| 1318 __ xor_(r12, r12); // Success. | 1318 __ xor_(r15, r15); // Success. |
| 1319 __ bind(&exit); | 1319 __ bind(&exit); |
| 1320 __ movq(rax, r12); | 1320 __ movq(rax, r15); |
| 1321 __ pop(r12); | 1321 __ pop(r15); |
| 1322 __ pop(r14); | 1322 __ pop(r14); |
| 1323 ExitCode(masm); | 1323 ExitCode(masm); |
| 1324 __ ret(0); | 1324 __ ret(0); |
| 1325 | 1325 |
| 1326 CodeDesc desc; | 1326 CodeDesc desc; |
| 1327 masm->GetCode(&desc); | 1327 masm->GetCode(&desc); |
| 1328 // Call the function from C++. | 1328 // Call the function from C++. |
| 1329 int result = FUNCTION_CAST<F0>(buffer)(); | 1329 int result = FUNCTION_CAST<F0>(buffer)(); |
| 1330 CHECK_EQ(0, result); | 1330 CHECK_EQ(0, result); |
| 1331 } | 1331 } |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 __ push(Immediate(0x101)); | 2143 __ push(Immediate(0x101)); |
| 2144 __ push(Immediate(0x102)); | 2144 __ push(Immediate(0x102)); |
| 2145 __ push(Immediate(0x103)); | 2145 __ push(Immediate(0x103)); |
| 2146 __ push(Immediate(0x104)); | 2146 __ push(Immediate(0x104)); |
| 2147 __ push(Immediate(0x105)); // <-- rbx | 2147 __ push(Immediate(0x105)); // <-- rbx |
| 2148 __ push(Immediate(0x106)); | 2148 __ push(Immediate(0x106)); |
| 2149 __ push(Immediate(0x107)); | 2149 __ push(Immediate(0x107)); |
| 2150 __ push(Immediate(0x108)); | 2150 __ push(Immediate(0x108)); |
| 2151 __ push(Immediate(0x109)); // <-- rsp | 2151 __ push(Immediate(0x109)); // <-- rsp |
| 2152 // rbp = rsp[9] | 2152 // rbp = rsp[9] |
| 2153 // r12 = rsp[3] | 2153 // r15 = rsp[3] |
| 2154 // rbx = rsp[5] | 2154 // rbx = rsp[5] |
| 2155 // r13 = rsp[7] | 2155 // r13 = rsp[7] |
| 2156 __ lea(r14, Operand(rsp, 3 * kPointerSize)); | 2156 __ lea(r14, Operand(rsp, 3 * kPointerSize)); |
| 2157 __ lea(r13, Operand(rbp, -3 * kPointerSize)); | 2157 __ lea(r13, Operand(rbp, -3 * kPointerSize)); |
| 2158 __ lea(rbx, Operand(rbp, -5 * kPointerSize)); | 2158 __ lea(rbx, Operand(rbp, -5 * kPointerSize)); |
| 2159 __ movl(rcx, Immediate(2)); | 2159 __ movl(rcx, Immediate(2)); |
| 2160 __ movq(r8, reinterpret_cast<uintptr_t>(&data[128]), RelocInfo::NONE); | 2160 __ movq(r8, reinterpret_cast<uintptr_t>(&data[128]), RelocInfo::NONE); |
| 2161 __ movl(rax, Immediate(1)); | 2161 __ movl(rax, Immediate(1)); |
| 2162 | 2162 |
| 2163 Operand sp0 = Operand(rsp, 0); | 2163 Operand sp0 = Operand(rsp, 0); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2465 CodeDesc desc; | 2465 CodeDesc desc; |
| 2466 masm->GetCode(&desc); | 2466 masm->GetCode(&desc); |
| 2467 // Call the function from C++. | 2467 // Call the function from C++. |
| 2468 int result = FUNCTION_CAST<F0>(buffer)(); | 2468 int result = FUNCTION_CAST<F0>(buffer)(); |
| 2469 CHECK_EQ(0, result); | 2469 CHECK_EQ(0, result); |
| 2470 } | 2470 } |
| 2471 | 2471 |
| 2472 | 2472 |
| 2473 | 2473 |
| 2474 #undef __ | 2474 #undef __ |
| OLD | NEW |