Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Unified Diff: src/arm64/assembler-arm64.h

Issue 2732273003: Disentangle assembler from isolate. (Closed)
Patch Set: Address feedback. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/arm64/assembler-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/assembler-arm64.h
diff --git a/src/arm64/assembler-arm64.h b/src/arm64/assembler-arm64.h
index 1072b76caec4ddb4b1c0df4e0e22b2cdc94c0ab9..ea1d94f62817f9db2d2d2aa15ad83430cb2188fa 100644
--- a/src/arm64/assembler-arm64.h
+++ b/src/arm64/assembler-arm64.h
@@ -717,7 +717,9 @@ class Assembler : public AssemblerBase {
// for code generation and assumes its size to be buffer_size. If the buffer
// is too small, a fatal error occurs. No deallocation of the buffer is done
// upon destruction of the assembler.
- Assembler(Isolate* arg_isolate, void* buffer, int buffer_size);
+ Assembler(Isolate* isolate, void* buffer, int buffer_size)
+ : Assembler(IsolateData(isolate), buffer, buffer_size) {}
+ Assembler(IsolateData isolate_data, void* buffer, int buffer_size);
virtual ~Assembler();
@@ -768,6 +770,7 @@ class Assembler : public AssemblerBase {
inline static Address target_pointer_address_at(Address pc);
// Read/Modify the code target address in the branch/call instruction at pc.
+ // The isolate argument is unused (and may be nullptr) when skipping flushing.
inline static Address target_address_at(Address pc, Address constant_pool);
inline static void set_target_address_at(
Isolate* isolate, Address pc, Address constant_pool, Address target,
@@ -2045,6 +2048,7 @@ class Assembler : public AssemblerBase {
// Each relocation is encoded as a variable size value
static constexpr int kMaxRelocSize = RelocInfoWriter::kMaxSize;
RelocInfoWriter reloc_info_writer;
+
// Internal reference positions, required for (potential) patching in
// GrowBuffer(); contains only those internal references whose labels
// are already bound.
@@ -2156,14 +2160,18 @@ 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.
- PatchingAssembler(Isolate* isolate, Instruction* start, unsigned count)
- : Assembler(isolate, reinterpret_cast<byte*>(start),
- count * kInstructionSize + kGap) {
- StartBlockPools();
- }
+ // This version will flush at destruction.
PatchingAssembler(Isolate* isolate, byte* start, unsigned count)
- : Assembler(isolate, start, count * kInstructionSize + kGap) {
+ : PatchingAssembler(IsolateData(isolate), start, count) {
+ CHECK_NOT_NULL(isolate);
+ isolate_ = isolate;
+ }
+
+ // This version will not flush.
+ PatchingAssembler(IsolateData isolate_data, byte* start, unsigned count)
+ : Assembler(isolate_data, start, count * kInstructionSize + kGap),
+ isolate_(nullptr) {
// Block constant pool emission.
StartBlockPools();
}
@@ -2178,13 +2186,16 @@ class PatchingAssembler : public Assembler {
DCHECK(IsConstPoolEmpty());
// Flush the Instruction cache.
size_t length = buffer_size_ - kGap;
- Assembler::FlushICache(isolate(), buffer_, length);
+ if (isolate_ != nullptr) Assembler::FlushICache(isolate_, 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_;
};
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/arm64/assembler-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698