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

Unified Diff: src/x64/assembler-x64-inl.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/x64/assembler-x64.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/assembler-x64-inl.h
diff --git a/src/x64/assembler-x64-inl.h b/src/x64/assembler-x64-inl.h
index 6001dc5e0e3cc3a745f2db1b95f459c7abe54a2b..7deaf23635643e406d15b588dcb54fdd32de5f2f 100644
--- a/src/x64/assembler-x64-inl.h
+++ b/src/x64/assembler-x64-inl.h
@@ -78,8 +78,7 @@ void Assembler::emit_code_target(Handle<Code> target,
void Assembler::emit_runtime_entry(Address entry, RelocInfo::Mode rmode) {
DCHECK(RelocInfo::IsRuntimeEntry(rmode));
RecordRelocInfo(rmode);
- emitl(static_cast<uint32_t>(
- entry - isolate()->heap()->memory_allocator()->code_range()->start()));
+ emitl(static_cast<uint32_t>(entry - isolate_data().code_range_start_));
}
void Assembler::emit(Immediate x) {
@@ -280,6 +279,7 @@ Address Assembler::target_address_at(Address pc, Address constant_pool) {
void Assembler::set_target_address_at(Isolate* isolate, Address pc,
Address constant_pool, Address target,
ICacheFlushMode icache_flush_mode) {
+ DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH);
Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4);
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
Assembler::FlushICache(isolate, pc, sizeof(int32_t));
@@ -319,8 +319,7 @@ Handle<Code> Assembler::code_target_object_handle_at(Address pc) {
Address Assembler::runtime_entry_at(Address pc) {
- return Memory::int32_at(pc) +
- isolate()->heap()->memory_allocator()->code_range()->start();
+ return Memory::int32_at(pc) + isolate_data().code_range_start_;
}
// -----------------------------------------------------------------------------
@@ -407,7 +406,7 @@ void RelocInfo::set_target_object(HeapObject* target,
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
Memory::Object_at(pc_) = target;
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
- Assembler::FlushICache(isolate_, pc_, sizeof(Address));
+ Assembler::FlushICache(target->GetIsolate(), pc_, sizeof(Address));
}
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL) {
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
@@ -422,13 +421,12 @@ Address RelocInfo::target_runtime_entry(Assembler* origin) {
return origin->runtime_entry_at(pc_);
}
-
-void RelocInfo::set_target_runtime_entry(Address target,
+void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
WriteBarrierMode write_barrier_mode,
ICacheFlushMode icache_flush_mode) {
DCHECK(IsRuntimeEntry(rmode_));
if (target_address() != target) {
- set_target_address(target, write_barrier_mode, icache_flush_mode);
+ set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
}
}
@@ -453,7 +451,7 @@ void RelocInfo::set_target_cell(Cell* cell,
Address address = cell->address() + Cell::kValueOffset;
Memory::Address_at(pc_) = address;
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
- Assembler::FlushICache(isolate_, pc_, sizeof(Address));
+ Assembler::FlushICache(cell->GetIsolate(), pc_, sizeof(Address));
}
if (write_barrier_mode == UPDATE_WRITE_BARRIER &&
host() != NULL) {
@@ -462,14 +460,13 @@ void RelocInfo::set_target_cell(Cell* cell,
}
}
-
-void RelocInfo::WipeOut() {
+void RelocInfo::WipeOut(Isolate* isolate) {
if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) ||
IsInternalReference(rmode_)) {
Memory::Address_at(pc_) = NULL;
} else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
// Effectively write zero into the relocation.
- Assembler::set_target_address_at(isolate_, pc_, host_,
+ Assembler::set_target_address_at(isolate, pc_, host_,
pc_ + sizeof(int32_t));
} else {
UNREACHABLE();
@@ -495,8 +492,9 @@ void RelocInfo::set_code_age_stub(Code* stub,
ICacheFlushMode icache_flush_mode) {
DCHECK(*pc_ == kCallOpcode);
DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
- Assembler::set_target_address_at(
- isolate_, pc_ + 1, host_, stub->instruction_start(), icache_flush_mode);
+ Assembler::set_target_address_at(stub->GetIsolate(), pc_ + 1, host_,
+ stub->instruction_start(),
+ icache_flush_mode);
}
@@ -505,12 +503,11 @@ Address RelocInfo::debug_call_address() {
return Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset);
}
-
-void RelocInfo::set_debug_call_address(Address target) {
+void RelocInfo::set_debug_call_address(Isolate* isolate, Address target) {
DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset) =
target;
- Assembler::FlushICache(isolate_,
+ Assembler::FlushICache(isolate,
pc_ + Assembler::kPatchDebugBreakSlotAddressOffset,
sizeof(Address));
if (host() != NULL) {
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698