From 2f91dbc8acb4716fca2ec7d12b6154b617c79756 Mon Sep 17 00:00:00 2001 From: Michael Starzinger Date: Fri, 9 Feb 2018 10:27:55 -0800 Subject: [PATCH] [assembler] Simplify {PatchingAssembler} cache flushing. R=clemensh@chromium.org Change-Id: Icfe73151ddc0d6a8afaed89004614e1a7c4e9416 Reviewed-on: https://chromium-review.googlesource.com/909531 Commit-Queue: Michael Starzinger Reviewed-by: Clemens Hammacher Cr-Commit-Position: refs/heads/master@{#51221} --- src/arm/assembler-arm.cc | 4 ---- src/arm/assembler-arm.h | 1 - src/arm64/assembler-arm64.h | 19 ++----------------- src/ppc/assembler-ppc.cc | 4 ---- src/ppc/assembler-ppc.h | 2 -- 5 files changed, 2 insertions(+), 28 deletions(-) diff --git a/src/arm/assembler-arm.cc b/src/arm/assembler-arm.cc index 8cd511d557..5b2a16ec0e 100644 --- a/src/arm/assembler-arm.cc +++ b/src/arm/assembler-arm.cc @@ -5479,10 +5479,6 @@ void PatchingAssembler::Emit(Address addr) { emit(reinterpret_cast(addr)); } -void PatchingAssembler::FlushICache(Isolate* isolate) { - Assembler::FlushICache(buffer_, buffer_size_ - kGap); -} - UseScratchRegisterScope::UseScratchRegisterScope(Assembler* assembler) : assembler_(assembler), old_available_(*assembler->GetScratchRegisterList()), diff --git a/src/arm/assembler-arm.h b/src/arm/assembler-arm.h index b70eb8f92e..089e58e0c7 100644 --- a/src/arm/assembler-arm.h +++ b/src/arm/assembler-arm.h @@ -1787,7 +1787,6 @@ class PatchingAssembler : public Assembler { ~PatchingAssembler(); void Emit(Address addr); - void FlushICache(Isolate* isolate); }; // This scope utility allows scratch registers to be managed safely. The diff --git a/src/arm64/assembler-arm64.h b/src/arm64/assembler-arm64.h index f523205e89..e0b1ac09c2 100644 --- a/src/arm64/assembler-arm64.h +++ b/src/arm64/assembler-arm64.h @@ -3677,18 +3677,9 @@ class PatchingAssembler : public Assembler { // If more or fewer instructions than expected are generated or if some // relocation information takes space in the buffer, the PatchingAssembler // will crash trying to grow the buffer. - - // This version will flush at destruction. - PatchingAssembler(Isolate* isolate, byte* start, unsigned count) - : PatchingAssembler(IsolateData(isolate), start, count) { - CHECK_NOT_NULL(isolate); - isolate_ = isolate; - } - - // This version will not flush. + // Note that the instruction cache will not be flushed. PatchingAssembler(IsolateData isolate_data, byte* start, unsigned count) - : Assembler(isolate_data, start, count * kInstructionSize + kGap), - isolate_(nullptr) { + : Assembler(isolate_data, start, count * kInstructionSize + kGap) { // Block constant pool emission. StartBlockPools(); } @@ -3701,18 +3692,12 @@ class PatchingAssembler : public Assembler { DCHECK((pc_offset() + kGap) == buffer_size_); // Verify no relocation information has been emitted. DCHECK(IsConstPoolEmpty()); - // Flush the Instruction cache. - size_t length = buffer_size_ - kGap; - if (isolate_ != nullptr) Assembler::FlushICache(buffer_, length); } // See definition of PatchAdrFar() for details. static constexpr int kAdrFarPatchableNNops = 2; static constexpr int kAdrFarPatchableNInstrs = kAdrFarPatchableNNops + 2; void PatchAdrFar(int64_t target_offset); - - private: - Isolate* isolate_; }; diff --git a/src/ppc/assembler-ppc.cc b/src/ppc/assembler-ppc.cc index cfd9754caf..788097d3cd 100644 --- a/src/ppc/assembler-ppc.cc +++ b/src/ppc/assembler-ppc.cc @@ -2150,10 +2150,6 @@ PatchingAssembler::~PatchingAssembler() { DCHECK_EQ(reloc_info_writer.pos(), buffer_ + buffer_size_); } -void PatchingAssembler::FlushICache(Isolate* isolate) { - Assembler::FlushICache(buffer_, buffer_size_ - kGap); -} - } // namespace internal } // namespace v8 diff --git a/src/ppc/assembler-ppc.h b/src/ppc/assembler-ppc.h index 9282d54ad6..f5ad96f379 100644 --- a/src/ppc/assembler-ppc.h +++ b/src/ppc/assembler-ppc.h @@ -1658,8 +1658,6 @@ class PatchingAssembler : public Assembler { public: PatchingAssembler(IsolateData isolate_data, byte* address, int instructions); ~PatchingAssembler(); - - void FlushICache(Isolate* isolate); }; } // namespace internal