| 27 | class DexSwitchTable : public ValueObject { |
| 28 | public: |
| 29 | DexSwitchTable(const Instruction& instruction, uint32_t dex_pc) |
| 30 | : instruction_(instruction), |
| 31 | dex_pc_(dex_pc), |
| 32 | sparse_(instruction.Opcode() == Instruction::SPARSE_SWITCH) { |
| 33 | int32_t table_offset = instruction.VRegB_31t(); |
| 34 | const uint16_t* table = reinterpret_cast<const uint16_t*>(&instruction) + table_offset; |
| 35 | DCHECK_EQ(table[0], sparse_ ? static_cast<uint16_t>(Instruction::kSparseSwitchSignature) |
| 36 | : static_cast<uint16_t>(Instruction::kPackedSwitchSignature)); |
| 37 | num_entries_ = table[1]; |
| 38 | values_ = reinterpret_cast<const int32_t*>(&table[2]); |
| 39 | } |
| 40 | |
| 41 | uint16_t GetNumEntries() const { |
| 42 | return num_entries_; |