[assembler] Simplify {PatchingAssembler} cache flushing.
R=clemensh@chromium.org Change-Id: Icfe73151ddc0d6a8afaed89004614e1a7c4e9416 Reviewed-on: https://chromium-review.googlesource.com/909531 Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#51221}
This commit is contained in:
parent
07511018d9
commit
2f91dbc8ac
@ -5479,10 +5479,6 @@ void PatchingAssembler::Emit(Address addr) {
|
|||||||
emit(reinterpret_cast<Instr>(addr));
|
emit(reinterpret_cast<Instr>(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PatchingAssembler::FlushICache(Isolate* isolate) {
|
|
||||||
Assembler::FlushICache(buffer_, buffer_size_ - kGap);
|
|
||||||
}
|
|
||||||
|
|
||||||
UseScratchRegisterScope::UseScratchRegisterScope(Assembler* assembler)
|
UseScratchRegisterScope::UseScratchRegisterScope(Assembler* assembler)
|
||||||
: assembler_(assembler),
|
: assembler_(assembler),
|
||||||
old_available_(*assembler->GetScratchRegisterList()),
|
old_available_(*assembler->GetScratchRegisterList()),
|
||||||
|
@ -1787,7 +1787,6 @@ class PatchingAssembler : public Assembler {
|
|||||||
~PatchingAssembler();
|
~PatchingAssembler();
|
||||||
|
|
||||||
void Emit(Address addr);
|
void Emit(Address addr);
|
||||||
void FlushICache(Isolate* isolate);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// This scope utility allows scratch registers to be managed safely. The
|
// This scope utility allows scratch registers to be managed safely. The
|
||||||
|
@ -3677,18 +3677,9 @@ class PatchingAssembler : public Assembler {
|
|||||||
// If more or fewer instructions than expected are generated or if some
|
// If more or fewer instructions than expected are generated or if some
|
||||||
// relocation information takes space in the buffer, the PatchingAssembler
|
// relocation information takes space in the buffer, the PatchingAssembler
|
||||||
// will crash trying to grow the buffer.
|
// will crash trying to grow the buffer.
|
||||||
|
// Note that the instruction cache will not be flushed.
|
||||||
// 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.
|
|
||||||
PatchingAssembler(IsolateData isolate_data, byte* start, unsigned count)
|
PatchingAssembler(IsolateData isolate_data, byte* start, unsigned count)
|
||||||
: Assembler(isolate_data, start, count * kInstructionSize + kGap),
|
: Assembler(isolate_data, start, count * kInstructionSize + kGap) {
|
||||||
isolate_(nullptr) {
|
|
||||||
// Block constant pool emission.
|
// Block constant pool emission.
|
||||||
StartBlockPools();
|
StartBlockPools();
|
||||||
}
|
}
|
||||||
@ -3701,18 +3692,12 @@ class PatchingAssembler : public Assembler {
|
|||||||
DCHECK((pc_offset() + kGap) == buffer_size_);
|
DCHECK((pc_offset() + kGap) == buffer_size_);
|
||||||
// Verify no relocation information has been emitted.
|
// Verify no relocation information has been emitted.
|
||||||
DCHECK(IsConstPoolEmpty());
|
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.
|
// See definition of PatchAdrFar() for details.
|
||||||
static constexpr int kAdrFarPatchableNNops = 2;
|
static constexpr int kAdrFarPatchableNNops = 2;
|
||||||
static constexpr int kAdrFarPatchableNInstrs = kAdrFarPatchableNNops + 2;
|
static constexpr int kAdrFarPatchableNInstrs = kAdrFarPatchableNNops + 2;
|
||||||
void PatchAdrFar(int64_t target_offset);
|
void PatchAdrFar(int64_t target_offset);
|
||||||
|
|
||||||
private:
|
|
||||||
Isolate* isolate_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2150,10 +2150,6 @@ PatchingAssembler::~PatchingAssembler() {
|
|||||||
DCHECK_EQ(reloc_info_writer.pos(), buffer_ + buffer_size_);
|
DCHECK_EQ(reloc_info_writer.pos(), buffer_ + buffer_size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PatchingAssembler::FlushICache(Isolate* isolate) {
|
|
||||||
Assembler::FlushICache(buffer_, buffer_size_ - kGap);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace v8
|
} // namespace v8
|
||||||
|
|
||||||
|
@ -1658,8 +1658,6 @@ class PatchingAssembler : public Assembler {
|
|||||||
public:
|
public:
|
||||||
PatchingAssembler(IsolateData isolate_data, byte* address, int instructions);
|
PatchingAssembler(IsolateData isolate_data, byte* address, int instructions);
|
||||||
~PatchingAssembler();
|
~PatchingAssembler();
|
||||||
|
|
||||||
void FlushICache(Isolate* isolate);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
Loading…
Reference in New Issue
Block a user