From 50d53886ed865fe2e45d0d7ec0617faada2ffe20 Mon Sep 17 00:00:00 2001 From: Ng Zhi An Date: Tue, 21 Apr 2020 11:27:48 -0700 Subject: [PATCH] [arm] Remove static Bit helpers on Instr These are almost unused, except for 1 case of Bit, which is probably incorrect. These static helpers can cause subtle error, e.g. instr->Bit(1, 3) does not get you bits 1 to 3, but rather calls the static method Bit(Instr, int). An example of this bug was fixed in https://crrev.com/c/2157799. Change-Id: I98c4464c4315af48b9d36472ffd6f16aa74aa18b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2158824 Reviewed-by: Jakob Kummerow Commit-Queue: Zhi An Ng Cr-Commit-Position: refs/heads/master@{#67315} --- src/codegen/arm/constants-arm.h | 17 ----------------- src/execution/arm/simulator-arm.cc | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/codegen/arm/constants-arm.h b/src/codegen/arm/constants-arm.h index 171de9e1d7..a7726a8f25 100644 --- a/src/codegen/arm/constants-arm.h +++ b/src/codegen/arm/constants-arm.h @@ -459,23 +459,6 @@ class Instruction { return InstructionBits() & (((2 << (hi - lo)) - 1) << lo); } - // Static support. - - // Extract a single bit from the instruction bits and return it as bit 0 in - // the result. - static inline int Bit(Instr instr, int nr) { return (instr >> nr) & 1; } - - // Extract a bit field from the instruction bits and return it in the - // least-significant bits of the result. - static inline int Bits(Instr instr, int hi, int lo) { - return (instr >> lo) & ((2 << (hi - lo)) - 1); - } - - // Read a bit field , leaving its position unchanged in the result. - static inline int BitField(Instr instr, int hi, int lo) { - return instr & (((2 << (hi - lo)) - 1) << lo); - } - // Accessors for the different named fields used in the ARM encoding. // The naming of these accessor corresponds to figure A3-1. // diff --git a/src/execution/arm/simulator-arm.cc b/src/execution/arm/simulator-arm.cc index 4aac7dc960..019542b12d 100644 --- a/src/execution/arm/simulator-arm.cc +++ b/src/execution/arm/simulator-arm.cc @@ -4589,7 +4589,7 @@ void Simulator::DecodeSpecialCondition(Instruction* instr) { case 0: { // vmov.i32 Qd, # int vd = instr->VFPDRegValue(kSimd128Precision); - uint64_t imm = instr->Bit(24, 24) << 7; // i + uint64_t imm = instr->Bit(24) << 7; // i imm |= instr->Bits(18, 16) << 4; // imm3 imm |= instr->Bits(3, 0); // imm4 imm |= imm << 32;