From c6bb56302ceef89ea20ad2941910c292e84d3fce Mon Sep 17 00:00:00 2001 From: Clemens Backes Date: Mon, 13 Sep 2021 15:33:43 +0200 Subject: [PATCH] [liftoff] Fix declaration order in some classes This fixes the order of declaring class members for LiftoffCompiler, LiftoffAssembler, LiftoffRegister, and LiftoffRegList. The recommended order according to the style guide is: types, constants, constructors, other members, data members. R=thibaudm@chromium.org Bug: v8:11879 Change-Id: I5c550ed11ed0169f07477b6a1723053316374707 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3157960 Commit-Queue: Clemens Backes Reviewed-by: Thibaud Michaud Cr-Commit-Position: refs/heads/main@{#76798} --- src/wasm/baseline/liftoff-assembler.h | 8 +-- src/wasm/baseline/liftoff-compiler.cc | 80 +++++++++++++-------------- src/wasm/baseline/liftoff-register.h | 8 +-- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/wasm/baseline/liftoff-assembler.h b/src/wasm/baseline/liftoff-assembler.h index c94c7ece9e..a7f4f3b612 100644 --- a/src/wasm/baseline/liftoff-assembler.h +++ b/src/wasm/baseline/liftoff-assembler.h @@ -1506,6 +1506,10 @@ class LiftoffAssembler : public TurboAssembler { private: LiftoffRegister LoadI64HalfIntoRegister(VarState slot, RegPairHalf half); + V8_NOINLINE LiftoffRegister SpillOneRegister(LiftoffRegList candidates); + // Spill one or two fp registers to get a pair of adjacent fp registers. + LiftoffRegister SpillAdjacentFpRegisters(LiftoffRegList pinned); + uint32_t num_locals_ = 0; static constexpr uint32_t kInlineLocalKinds = 16; union { @@ -1521,10 +1525,6 @@ class LiftoffAssembler : public TurboAssembler { int ool_spill_space_size_ = 0; LiftoffBailoutReason bailout_reason_ = kSuccess; const char* bailout_detail_ = nullptr; - - V8_NOINLINE LiftoffRegister SpillOneRegister(LiftoffRegList candidates); - // Spill one or two fp registers to get a pair of adjacent fp registers. - LiftoffRegister SpillAdjacentFpRegisters(LiftoffRegList pinned); }; std::ostream& operator<<(std::ostream& os, LiftoffAssembler::VarState); diff --git a/src/wasm/baseline/liftoff-compiler.cc b/src/wasm/baseline/liftoff-compiler.cc index 16d4b6f95b..d3a414f32d 100644 --- a/src/wasm/baseline/liftoff-compiler.cc +++ b/src/wasm/baseline/liftoff-compiler.cc @@ -6107,6 +6107,46 @@ class LiftoffCompiler { tmp_s128, lane_kind); } + bool has_outstanding_op() const { + return outstanding_op_ != kNoOutstandingOp; + } + + void TraceCacheState(FullDecoder* decoder) const { + if (!FLAG_trace_liftoff) return; + StdoutStream os; + for (int control_depth = decoder->control_depth() - 1; control_depth >= -1; + --control_depth) { + auto* cache_state = + control_depth == -1 ? __ cache_state() + : &decoder->control_at(control_depth) + ->label_state; + os << PrintCollection(cache_state->stack_state); + if (control_depth != -1) PrintF("; "); + } + os << "\n"; + } + + void DefineSafepoint() { + Safepoint safepoint = safepoint_table_builder_.DefineSafepoint(&asm_); + __ cache_state()->DefineSafepoint(safepoint); + } + + void DefineSafepointWithCalleeSavedRegisters() { + Safepoint safepoint = safepoint_table_builder_.DefineSafepoint(&asm_); + __ cache_state()->DefineSafepointWithCalleeSavedRegisters(safepoint); + } + + Register LoadInstanceIntoRegister(LiftoffRegList pinned, Register fallback) { + Register instance = __ cache_state()->cached_instance; + if (instance == no_reg) { + instance = __ cache_state()->TrySetCachedInstanceRegister( + pinned | LiftoffRegList::ForRegs(fallback)); + if (instance == no_reg) instance = fallback; + __ LoadInstanceFromFrame(instance); + } + return instance; + } + static constexpr WasmOpcode kNoOutstandingOp = kExprUnreachable; static constexpr base::EnumSet kUnconditionallySupported{ // MVP: @@ -6169,46 +6209,6 @@ class LiftoffCompiler { int32_t* max_steps_; int32_t* nondeterminism_; - bool has_outstanding_op() const { - return outstanding_op_ != kNoOutstandingOp; - } - - void TraceCacheState(FullDecoder* decoder) const { - if (!FLAG_trace_liftoff) return; - StdoutStream os; - for (int control_depth = decoder->control_depth() - 1; control_depth >= -1; - --control_depth) { - auto* cache_state = - control_depth == -1 ? __ cache_state() - : &decoder->control_at(control_depth) - ->label_state; - os << PrintCollection(cache_state->stack_state); - if (control_depth != -1) PrintF("; "); - } - os << "\n"; - } - - void DefineSafepoint() { - Safepoint safepoint = safepoint_table_builder_.DefineSafepoint(&asm_); - __ cache_state()->DefineSafepoint(safepoint); - } - - void DefineSafepointWithCalleeSavedRegisters() { - Safepoint safepoint = safepoint_table_builder_.DefineSafepoint(&asm_); - __ cache_state()->DefineSafepointWithCalleeSavedRegisters(safepoint); - } - - Register LoadInstanceIntoRegister(LiftoffRegList pinned, Register fallback) { - Register instance = __ cache_state()->cached_instance; - if (instance == no_reg) { - instance = __ cache_state()->TrySetCachedInstanceRegister( - pinned | LiftoffRegList::ForRegs(fallback)); - if (instance == no_reg) instance = fallback; - __ LoadInstanceFromFrame(instance); - } - return instance; - } - DISALLOW_IMPLICIT_CONSTRUCTORS(LiftoffCompiler); }; diff --git a/src/wasm/baseline/liftoff-register.h b/src/wasm/baseline/liftoff-register.h index 63ac2acf8b..74eb10ca34 100644 --- a/src/wasm/baseline/liftoff-register.h +++ b/src/wasm/baseline/liftoff-register.h @@ -313,9 +313,9 @@ class LiftoffRegister { } private: - storage_t code_; - explicit constexpr LiftoffRegister(storage_t code) : code_(code) {} + + storage_t code_; }; ASSERT_TRIVIALLY_COPYABLE(LiftoffRegister); @@ -467,10 +467,10 @@ class LiftoffRegList { } private: - storage_t regs_ = 0; - // Unchecked constructor. Only use for valid bits. explicit constexpr LiftoffRegList(storage_t bits) : regs_(bits) {} + + storage_t regs_ = 0; }; ASSERT_TRIVIALLY_COPYABLE(LiftoffRegList);