OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 | 1381 |
1382 bool Decoder::IsConstantPoolAt(byte* instr_ptr) { | 1382 bool Decoder::IsConstantPoolAt(byte* instr_ptr) { |
1383 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); | 1383 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); |
1384 return (instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker; | 1384 return (instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker; |
1385 } | 1385 } |
1386 | 1386 |
1387 | 1387 |
1388 int Decoder::ConstantPoolSizeAt(byte* instr_ptr) { | 1388 int Decoder::ConstantPoolSizeAt(byte* instr_ptr) { |
1389 if (IsConstantPoolAt(instr_ptr)) { | 1389 if (IsConstantPoolAt(instr_ptr)) { |
1390 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); | 1390 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); |
1391 return instruction_bits & kConstantPoolLengthMask; | 1391 return DecodeConstantPoolLength(instruction_bits); |
1392 } else { | 1392 } else { |
1393 return -1; | 1393 return -1; |
1394 } | 1394 } |
1395 } | 1395 } |
1396 | 1396 |
1397 | 1397 |
1398 // Disassemble the instruction at *instr_ptr into the output buffer. | 1398 // Disassemble the instruction at *instr_ptr into the output buffer. |
1399 int Decoder::InstructionDecode(byte* instr_ptr) { | 1399 int Decoder::InstructionDecode(byte* instr_ptr) { |
1400 Instruction* instr = Instruction::At(instr_ptr); | 1400 Instruction* instr = Instruction::At(instr_ptr); |
1401 // Print raw instruction bytes. | 1401 // Print raw instruction bytes. |
1402 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, | 1402 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
1403 "%08x ", | 1403 "%08x ", |
1404 instr->InstructionBits()); | 1404 instr->InstructionBits()); |
1405 if (instr->ConditionField() == kSpecialCondition) { | 1405 if (instr->ConditionField() == kSpecialCondition) { |
1406 Unknown(instr); | 1406 Unknown(instr); |
1407 return Instruction::kInstrSize; | 1407 return Instruction::kInstrSize; |
1408 } | 1408 } |
1409 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); | 1409 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); |
1410 if ((instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker) { | 1410 if ((instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker) { |
1411 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, | 1411 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
1412 "constant pool begin (length %d)", | 1412 "constant pool begin (length %d)", |
1413 instruction_bits & | 1413 DecodeConstantPoolLength(instruction_bits)); |
1414 kConstantPoolLengthMask); | |
1415 return Instruction::kInstrSize; | 1414 return Instruction::kInstrSize; |
1416 } | 1415 } |
1417 switch (instr->TypeValue()) { | 1416 switch (instr->TypeValue()) { |
1418 case 0: | 1417 case 0: |
1419 case 1: { | 1418 case 1: { |
1420 DecodeType01(instr); | 1419 DecodeType01(instr); |
1421 break; | 1420 break; |
1422 } | 1421 } |
1423 case 2: { | 1422 case 2: { |
1424 DecodeType2(instr); | 1423 DecodeType2(instr); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 pc += d.InstructionDecode(buffer, pc); | 1527 pc += d.InstructionDecode(buffer, pc); |
1529 fprintf(f, "%p %08x %s\n", | 1528 fprintf(f, "%p %08x %s\n", |
1530 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1529 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
1531 } | 1530 } |
1532 } | 1531 } |
1533 | 1532 |
1534 | 1533 |
1535 } // namespace disasm | 1534 } // namespace disasm |
1536 | 1535 |
1537 #endif // V8_TARGET_ARCH_ARM | 1536 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |