Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
|
Karl Klose
2011/04/06 06:52:56
2011
Søren Thygesen Gjesse
2011/04/06 08:00:09
Done.
| |
| 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->NValue())); | 376 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->NValue())); |
| 377 if (format[0] == 'D') PrintDRegister(reg); | 377 if (format[0] == 'D') PrintDRegister(reg); |
| 378 return 2; | 378 return 2; |
| 379 } else if (format[1] == 'm') { | 379 } else if (format[1] == 'm') { |
| 380 int reg = instr->VmValue(); | 380 int reg = instr->VmValue(); |
| 381 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->MValue())); | 381 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->MValue())); |
| 382 if (format[0] == 'D') PrintDRegister(reg); | 382 if (format[0] == 'D') PrintDRegister(reg); |
| 383 return 2; | 383 return 2; |
| 384 } else if (format[1] == 'd') { | 384 } else if (format[1] == 'd') { |
| 385 int reg = instr->VdValue(); | 385 int reg = instr->VdValue(); |
| 386 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->DValue())); | 386 if (format[0] == 'S') reg = reg << 1 | instr->DValue(); |
|
Rodolph Perfetta
2011/04/05 18:16:39
Using instr->VFPDRegValue(kSinglePrecision) would
Søren Thygesen Gjesse
2011/04/06 08:00:09
Changed to use instr->VFPXRegValue (X=M|M|D) in al
| |
| 387 if (format[2] == '+') { | |
| 388 int immed8 = instr->Immed8Value(); | |
| 389 if (format[0] == 'S') reg += immed8 - 1; | |
| 390 if (format[0] == 'D') reg += (immed8 / 2 - 1); | |
| 391 } | |
| 392 if (format[0] == 'S') PrintSRegister(reg); | |
| 387 if (format[0] == 'D') PrintDRegister(reg); | 393 if (format[0] == 'D') PrintDRegister(reg); |
| 388 return 2; | 394 return format[2] == '+' ? 3 : 2; |
| 389 } | 395 } |
| 390 | 396 |
| 391 UNREACHABLE(); | 397 UNREACHABLE(); |
| 392 return -1; | 398 return -1; |
| 393 } | 399 } |
| 394 | 400 |
| 395 | 401 |
| 396 int Decoder::FormatVFPinstruction(Instruction* instr, const char* format) { | 402 int Decoder::FormatVFPinstruction(Instruction* instr, const char* format) { |
| 397 Print(format); | 403 Print(format); |
| 398 return 0; | 404 return 0; |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1266 } | 1272 } |
| 1267 break; | 1273 break; |
| 1268 case 0xC: | 1274 case 0xC: |
| 1269 case 0xE: | 1275 case 0xE: |
| 1270 if (instr->HasL()) { | 1276 if (instr->HasL()) { |
| 1271 Format(instr, "vldr'cond 'Sd, ['rn + 4*'imm08@00]"); | 1277 Format(instr, "vldr'cond 'Sd, ['rn + 4*'imm08@00]"); |
| 1272 } else { | 1278 } else { |
| 1273 Format(instr, "vstr'cond 'Sd, ['rn + 4*'imm08@00]"); | 1279 Format(instr, "vstr'cond 'Sd, ['rn + 4*'imm08@00]"); |
| 1274 } | 1280 } |
| 1275 break; | 1281 break; |
| 1276 default: | 1282 default: { |
|
Rodolph Perfetta
2011/04/05 18:16:39
VLDM/VSTM covers cases 0x4-0x7, 0x9, 0xB for singl
Søren Thygesen Gjesse
2011/04/06 08:00:09
Changed to use 6 explicit case values and default
| |
| 1277 Unknown(instr); // Not used by V8. | 1283 BlockAddrMode am = |
| 1284 static_cast<BlockAddrMode>( | |
| 1285 instr->BitField(24, 21) & kBlockAddrModeMask); | |
| 1286 if (am == ia || am == ia_w || am == db_w) { | |
| 1287 bool to_arm_register = (instr->VLValue() == 0x1); | |
|
Rodolph Perfetta
2011/04/05 18:16:39
This variable has a confusing name. It sounds like
Søren Thygesen Gjesse
2011/04/06 08:00:09
Changed to to_vfp_regsiter.
| |
| 1288 if (to_arm_register) { | |
| 1289 Format(instr, "vldm'cond'pu 'rn'w, {'Sd-'Sd+}"); | |
| 1290 } else { | |
| 1291 Format(instr, "vstm'cond'pu 'rn'w, {'Sd-'Sd+}"); | |
| 1292 } | |
| 1293 } else { | |
| 1294 Unknown(instr); // Not used by V8. | |
| 1295 } | |
| 1278 break; | 1296 break; |
| 1297 } | |
| 1279 } | 1298 } |
| 1280 } else if (instr->CoprocessorValue() == 0xB) { | 1299 } else if (instr->CoprocessorValue() == 0xB) { |
| 1281 switch (instr->OpcodeValue()) { | 1300 switch (instr->OpcodeValue()) { |
| 1282 case 0x2: | 1301 case 0x2: |
| 1283 // Load and store double to two GP registers | 1302 // Load and store double to two GP registers |
| 1284 if (instr->Bits(7, 4) != 0x1) { | 1303 if (instr->Bits(7, 4) != 0x1) { |
| 1285 Unknown(instr); // Not used by V8. | 1304 Unknown(instr); // Not used by V8. |
| 1286 } else if (instr->HasL()) { | 1305 } else if (instr->HasL()) { |
| 1287 Format(instr, "vmov'cond 'rt, 'rn, 'Dm"); | 1306 Format(instr, "vmov'cond 'rt, 'rn, 'Dm"); |
| 1288 } else { | 1307 } else { |
| 1289 Format(instr, "vmov'cond 'Dm, 'rt, 'rn"); | 1308 Format(instr, "vmov'cond 'Dm, 'rt, 'rn"); |
| 1290 } | 1309 } |
| 1291 break; | 1310 break; |
| 1292 case 0x8: | 1311 case 0x8: |
| 1293 if (instr->HasL()) { | 1312 if (instr->HasL()) { |
| 1294 Format(instr, "vldr'cond 'Dd, ['rn - 4*'imm08@00]"); | 1313 Format(instr, "vldr'cond 'Dd, ['rn - 4*'imm08@00]"); |
| 1295 } else { | 1314 } else { |
| 1296 Format(instr, "vstr'cond 'Dd, ['rn - 4*'imm08@00]"); | 1315 Format(instr, "vstr'cond 'Dd, ['rn - 4*'imm08@00]"); |
| 1297 } | 1316 } |
| 1298 break; | 1317 break; |
| 1299 case 0xC: | 1318 case 0xC: |
| 1300 if (instr->HasL()) { | 1319 if (instr->HasL()) { |
| 1301 Format(instr, "vldr'cond 'Dd, ['rn + 4*'imm08@00]"); | 1320 Format(instr, "vldr'cond 'Dd, ['rn + 4*'imm08@00]"); |
| 1302 } else { | 1321 } else { |
| 1303 Format(instr, "vstr'cond 'Dd, ['rn + 4*'imm08@00]"); | 1322 Format(instr, "vstr'cond 'Dd, ['rn + 4*'imm08@00]"); |
| 1304 } | 1323 } |
| 1305 break; | 1324 break; |
| 1306 default: | 1325 default: { |
|
Rodolph Perfetta
2011/04/05 18:16:39
VLDM/VSTM covers cases 0x4, 0x5, 0x9 for double pr
Søren Thygesen Gjesse
2011/04/06 08:00:09
Changed to use 3 explicit case values and default
| |
| 1307 Unknown(instr); // Not used by V8. | 1326 BlockAddrMode am = |
| 1327 static_cast<BlockAddrMode>( | |
| 1328 instr->BitField(24, 21) & kBlockAddrModeMask); | |
| 1329 if (am == ia || am == ia_w || am == db_w) { | |
| 1330 bool to_arm_register = (instr->VLValue() == 0x1); | |
| 1331 if (to_arm_register) { | |
| 1332 Format(instr, "vldm'cond'pu 'rn'w, {'Dd-'Dd+}"); | |
| 1333 } else { | |
| 1334 Format(instr, "vstm'cond'pu 'rn'w, {'Dd-'Dd+}"); | |
| 1335 } | |
| 1336 } else { | |
| 1337 Unknown(instr); // Not used by V8. | |
| 1338 } | |
| 1308 break; | 1339 break; |
| 1340 } | |
| 1309 } | 1341 } |
| 1310 } else { | 1342 } else { |
| 1311 Unknown(instr); // Not used by V8. | 1343 Unknown(instr); // Not used by V8. |
| 1312 } | 1344 } |
| 1313 } | 1345 } |
| 1314 | 1346 |
| 1315 | 1347 |
| 1316 bool Decoder::IsConstantPoolAt(byte* instr_ptr) { | 1348 bool Decoder::IsConstantPoolAt(byte* instr_ptr) { |
| 1317 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); | 1349 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); |
| 1318 return (instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker; | 1350 return (instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1462 pc += d.InstructionDecode(buffer, pc); | 1494 pc += d.InstructionDecode(buffer, pc); |
| 1463 fprintf(f, "%p %08x %s\n", | 1495 fprintf(f, "%p %08x %s\n", |
| 1464 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1496 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
| 1465 } | 1497 } |
| 1466 } | 1498 } |
| 1467 | 1499 |
| 1468 | 1500 |
| 1469 } // namespace disasm | 1501 } // namespace disasm |
| 1470 | 1502 |
| 1471 #endif // V8_TARGET_ARCH_ARM | 1503 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |