[assembler] Remove GetHeap from set_target_object
Pass heap directly into RelocInfo::set_target_object and its calling functions to avoid HeapObject::GetHeap(). Bug: v8:7786 Change-Id: I516b8b2d80a86ba5aba70160290e78354bb9a7b8 Reviewed-on: https://chromium-review.googlesource.com/1080548 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#53469}
This commit is contained in:
parent
f8787c1188
commit
e69f85bf8d
@ -106,7 +106,7 @@ Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
|
||||
Assembler::target_address_at(pc_, constant_pool_)));
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_object(HeapObject* target,
|
||||
void RelocInfo::set_target_object(Heap* heap, HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
@ -114,9 +114,8 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
|
||||
target);
|
||||
host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->incremental_marking()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->RecordWriteIntoCode(host(), this, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -708,7 +708,7 @@ Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_object(HeapObject* target,
|
||||
void RelocInfo::set_target_object(Heap* heap, HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
@ -716,9 +716,8 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
|
||||
target);
|
||||
host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->incremental_marking()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->RecordWriteIntoCode(host(), this, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ class RelocInfo {
|
||||
INLINE(HeapObject* target_object());
|
||||
INLINE(Handle<HeapObject> target_object_handle(Assembler* origin));
|
||||
INLINE(void set_target_object(
|
||||
HeapObject* target,
|
||||
Heap* heap, HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode = UPDATE_WRITE_BARRIER,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
|
||||
INLINE(Address target_runtime_entry(Assembler* origin));
|
||||
|
@ -201,8 +201,8 @@ void SetupIsolateDelegate::ReplacePlaceholders(Isolate* isolate) {
|
||||
if (!target->is_builtin()) continue;
|
||||
Code* new_target =
|
||||
Code::cast(builtins->builtins_[target->builtin_index()]);
|
||||
rinfo->set_target_object(new_target, UPDATE_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
rinfo->set_target_object(isolate->heap(), new_target,
|
||||
UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
flush_icache = true;
|
||||
}
|
||||
|
@ -1052,13 +1052,10 @@ Handle<Object> LiveEdit::ChangeScriptSource(Handle<Script> original_script,
|
||||
return old_script_object;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LiveEdit::ReplaceRefToNestedFunction(
|
||||
Handle<JSValue> parent_function_wrapper,
|
||||
Heap* heap, Handle<JSValue> parent_function_wrapper,
|
||||
Handle<JSValue> orig_function_wrapper,
|
||||
Handle<JSValue> subst_function_wrapper) {
|
||||
|
||||
Handle<SharedFunctionInfo> parent_shared =
|
||||
UnwrapSharedFunctionInfoFromJSValue(parent_function_wrapper);
|
||||
Handle<SharedFunctionInfo> orig_shared =
|
||||
@ -1069,7 +1066,7 @@ void LiveEdit::ReplaceRefToNestedFunction(
|
||||
for (RelocIterator it(parent_shared->GetCode()); !it.done(); it.next()) {
|
||||
if (it.rinfo()->rmode() == RelocInfo::EMBEDDED_OBJECT) {
|
||||
if (it.rinfo()->target_object() == *orig_shared) {
|
||||
it.rinfo()->set_target_object(*subst_shared);
|
||||
it.rinfo()->set_target_object(heap, *subst_shared);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,8 @@ class LiveEdit : AllStatic {
|
||||
|
||||
// In a code of a parent function replaces original function as embedded
|
||||
// object with a substitution one.
|
||||
static void ReplaceRefToNestedFunction(Handle<JSValue> parent_function_shared,
|
||||
static void ReplaceRefToNestedFunction(Heap* heap,
|
||||
Handle<JSValue> parent_function_shared,
|
||||
Handle<JSValue> orig_function_shared,
|
||||
Handle<JSValue> subst_function_shared);
|
||||
|
||||
|
@ -50,9 +50,9 @@ int ComputeCodeObjectSize(const CodeDesc& desc) {
|
||||
return object_size;
|
||||
}
|
||||
|
||||
void InitializeCode(Handle<Code> code, int object_size, const CodeDesc& desc,
|
||||
Code::Kind kind, Handle<Object> self_ref,
|
||||
int32_t builtin_index,
|
||||
void InitializeCode(Heap* heap, Handle<Code> code, int object_size,
|
||||
const CodeDesc& desc, Code::Kind kind,
|
||||
Handle<Object> self_ref, int32_t builtin_index,
|
||||
Handle<ByteArray> source_position_table,
|
||||
Handle<DeoptimizationData> deopt_data,
|
||||
Handle<ByteArray> reloc_info,
|
||||
@ -97,7 +97,7 @@ void InitializeCode(Handle<Code> code, int object_size, const CodeDesc& desc,
|
||||
// that are dereferenced during the copy to point directly to the actual heap
|
||||
// objects. These pointers can include references to the code object itself,
|
||||
// through the self_reference parameter.
|
||||
code->CopyFromNoFlush(desc);
|
||||
code->CopyFromNoFlush(heap, desc);
|
||||
|
||||
code->clear_padding();
|
||||
|
||||
@ -2494,7 +2494,7 @@ MaybeHandle<Code> Factory::TryNewCode(
|
||||
result->set_map_after_allocation(*code_map(), SKIP_WRITE_BARRIER);
|
||||
code = handle(Code::cast(result), isolate());
|
||||
|
||||
InitializeCode(code, object_size, desc, kind, self_ref, builtin_index,
|
||||
InitializeCode(heap, code, object_size, desc, kind, self_ref, builtin_index,
|
||||
source_position_table, deopt_data, reloc_info,
|
||||
data_container, stub_key, is_turbofanned, stack_slots,
|
||||
safepoint_table_offset, handler_table_offset);
|
||||
@ -2542,7 +2542,7 @@ Handle<Code> Factory::NewCode(
|
||||
result->set_map_after_allocation(*code_map(), SKIP_WRITE_BARRIER);
|
||||
code = handle(Code::cast(result), isolate());
|
||||
|
||||
InitializeCode(code, object_size, desc, kind, self_ref, builtin_index,
|
||||
InitializeCode(heap, code, object_size, desc, kind, self_ref, builtin_index,
|
||||
source_position_table, deopt_data, reloc_info,
|
||||
data_container, stub_key, is_turbofanned, stack_slots,
|
||||
safepoint_table_offset, handler_table_offset);
|
||||
|
@ -888,7 +888,7 @@ void Heap::ProcessPretenuringFeedback() {
|
||||
void Heap::InvalidateCodeEmbeddedObjects(Code* code) {
|
||||
MemoryChunk* chunk = MemoryChunk::FromAddress(code->address());
|
||||
CodePageMemoryModificationScope modification_scope(chunk);
|
||||
code->InvalidateEmbeddedObjects();
|
||||
code->InvalidateEmbeddedObjects(this);
|
||||
}
|
||||
|
||||
void Heap::InvalidateCodeDeoptimizationData(Code* code) {
|
||||
|
@ -1695,7 +1695,7 @@ void MarkCompactCollector::MarkDependentCodeForDeoptimization() {
|
||||
if (!non_atomic_marking_state()->IsBlackOrGrey(object) &&
|
||||
!code->marked_for_deoptimization()) {
|
||||
code->SetMarkedForDeoptimization("weak objects");
|
||||
code->InvalidateEmbeddedObjects();
|
||||
code->InvalidateEmbeddedObjects(heap_);
|
||||
have_code_to_deoptimize_ = true;
|
||||
}
|
||||
}
|
||||
@ -2068,6 +2068,8 @@ static inline SlotCallbackResult UpdateStrongSlot(MaybeObject** maybe_slot) {
|
||||
// nevers visits code objects.
|
||||
class PointersUpdatingVisitor : public ObjectVisitor, public RootVisitor {
|
||||
public:
|
||||
explicit PointersUpdatingVisitor(Heap* heap) : heap_(heap) {}
|
||||
|
||||
void VisitPointer(HeapObject* host, Object** p) override {
|
||||
UpdateStrongSlotInternal(p);
|
||||
}
|
||||
@ -2101,7 +2103,7 @@ class PointersUpdatingVisitor : public ObjectVisitor, public RootVisitor {
|
||||
|
||||
void VisitEmbeddedPointer(Code* host, RelocInfo* rinfo) override {
|
||||
UpdateTypedSlotHelper::UpdateEmbeddedPointer(
|
||||
rinfo, UpdateStrongMaybeObjectSlotInternal);
|
||||
heap_, rinfo, UpdateStrongMaybeObjectSlotInternal);
|
||||
}
|
||||
|
||||
void VisitCodeTarget(Code* host, RelocInfo* rinfo) override {
|
||||
@ -2126,6 +2128,8 @@ class PointersUpdatingVisitor : public ObjectVisitor, public RootVisitor {
|
||||
static inline SlotCallbackResult UpdateSlotInternal(MaybeObject** slot) {
|
||||
return UpdateSlot<AccessMode::NON_ATOMIC>(slot);
|
||||
}
|
||||
|
||||
Heap* heap_;
|
||||
};
|
||||
|
||||
static String* UpdateReferenceInExternalStringTableEntry(Heap* heap,
|
||||
@ -2723,7 +2727,7 @@ class ToSpaceUpdatingItem : public UpdatingItem {
|
||||
void ProcessVisitAll() {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"),
|
||||
"ToSpaceUpdatingItem::ProcessVisitAll");
|
||||
PointersUpdatingVisitor visitor;
|
||||
PointersUpdatingVisitor visitor(chunk_->heap());
|
||||
for (Address cur = start_; cur < end_;) {
|
||||
HeapObject* object = HeapObject::FromAddress(cur);
|
||||
Map* map = object->map();
|
||||
@ -2738,7 +2742,7 @@ class ToSpaceUpdatingItem : public UpdatingItem {
|
||||
"ToSpaceUpdatingItem::ProcessVisitLive");
|
||||
// For young generation evacuations we want to visit grey objects, for
|
||||
// full MC, we need to visit black objects.
|
||||
PointersUpdatingVisitor visitor;
|
||||
PointersUpdatingVisitor visitor(chunk_->heap());
|
||||
for (auto object_and_size : LiveObjectRange<kAllLiveObjects>(
|
||||
chunk_, marking_state_->bitmap(chunk_))) {
|
||||
object_and_size.first->IterateBodyFast(&visitor);
|
||||
@ -2861,7 +2865,7 @@ class RememberedSetUpdatingItem : public UpdatingItem {
|
||||
RememberedSet<OLD_TO_NEW>::IterateTyped(
|
||||
chunk_, [this](SlotType slot_type, Address host_addr, Address slot) {
|
||||
return UpdateTypedSlotHelper::UpdateTypedSlot(
|
||||
slot_type, slot, [this](MaybeObject** slot) {
|
||||
heap_, slot_type, slot, [this](MaybeObject** slot) {
|
||||
return CheckAndUpdateOldToNewSlot(
|
||||
reinterpret_cast<Address>(slot));
|
||||
});
|
||||
@ -2872,11 +2876,12 @@ class RememberedSetUpdatingItem : public UpdatingItem {
|
||||
nullptr)) {
|
||||
CHECK_NE(chunk_->owner(), heap_->map_space());
|
||||
RememberedSet<OLD_TO_OLD>::IterateTyped(
|
||||
chunk_, [](SlotType slot_type, Address host_addr, Address slot) {
|
||||
chunk_, [this](SlotType slot_type, Address host_addr, Address slot) {
|
||||
// Using UpdateStrongSlot is OK here, because there are no weak
|
||||
// typed slots.
|
||||
return UpdateTypedSlotHelper::UpdateTypedSlot(
|
||||
slot_type, slot, UpdateStrongSlot<AccessMode::NON_ATOMIC>);
|
||||
heap_, slot_type, slot,
|
||||
UpdateStrongSlot<AccessMode::NON_ATOMIC>);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -2901,19 +2906,23 @@ UpdatingItem* MarkCompactCollector::CreateRememberedSetUpdatingItem(
|
||||
|
||||
class GlobalHandlesUpdatingItem : public UpdatingItem {
|
||||
public:
|
||||
GlobalHandlesUpdatingItem(GlobalHandles* global_handles, size_t start,
|
||||
size_t end)
|
||||
: global_handles_(global_handles), start_(start), end_(end) {}
|
||||
GlobalHandlesUpdatingItem(Heap* heap, GlobalHandles* global_handles,
|
||||
size_t start, size_t end)
|
||||
: heap_(heap),
|
||||
global_handles_(global_handles),
|
||||
start_(start),
|
||||
end_(end) {}
|
||||
virtual ~GlobalHandlesUpdatingItem() {}
|
||||
|
||||
void Process() override {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"),
|
||||
"GlobalHandlesUpdatingItem::Process");
|
||||
PointersUpdatingVisitor updating_visitor;
|
||||
PointersUpdatingVisitor updating_visitor(heap_);
|
||||
global_handles_->IterateNewSpaceRoots(&updating_visitor, start_, end_);
|
||||
}
|
||||
|
||||
private:
|
||||
Heap* heap_;
|
||||
GlobalHandles* global_handles_;
|
||||
size_t start_;
|
||||
size_t end_;
|
||||
@ -3038,7 +3047,7 @@ int MarkCompactCollector::CollectOldSpaceArrayBufferTrackerItems(
|
||||
void MarkCompactCollector::UpdatePointersAfterEvacuation() {
|
||||
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_UPDATE_POINTERS);
|
||||
|
||||
PointersUpdatingVisitor updating_visitor;
|
||||
PointersUpdatingVisitor updating_visitor(heap());
|
||||
|
||||
{
|
||||
TRACE_GC(heap()->tracer(),
|
||||
@ -3383,7 +3392,8 @@ class YoungGenerationEvacuationVerifier : public EvacuationVerifier {
|
||||
#endif // VERIFY_HEAP
|
||||
|
||||
template <class ParallelItem>
|
||||
void SeedGlobalHandles(GlobalHandles* global_handles, ItemParallelJob* job) {
|
||||
void SeedGlobalHandles(Heap* heap, GlobalHandles* global_handles,
|
||||
ItemParallelJob* job) {
|
||||
// Create batches of global handles.
|
||||
const size_t kGlobalHandlesBufferSize = 1000;
|
||||
const size_t new_space_nodes = global_handles->NumberOfNewSpaceNodes();
|
||||
@ -3391,7 +3401,7 @@ void SeedGlobalHandles(GlobalHandles* global_handles, ItemParallelJob* job) {
|
||||
start += kGlobalHandlesBufferSize) {
|
||||
size_t end = start + kGlobalHandlesBufferSize;
|
||||
if (end > new_space_nodes) end = new_space_nodes;
|
||||
job->AddItem(new ParallelItem(global_handles, start, end));
|
||||
job->AddItem(new ParallelItem(heap, global_handles, start, end));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3565,14 +3575,14 @@ void MinorMarkCompactCollector::UpdatePointersAfterEvacuation() {
|
||||
TRACE_GC(heap()->tracer(),
|
||||
GCTracer::Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS);
|
||||
|
||||
PointersUpdatingVisitor updating_visitor;
|
||||
PointersUpdatingVisitor updating_visitor(heap());
|
||||
ItemParallelJob updating_job(isolate()->cancelable_task_manager(),
|
||||
&page_parallel_job_semaphore_);
|
||||
|
||||
CollectNewSpaceArrayBufferTrackerItems(&updating_job);
|
||||
// Create batches of global handles.
|
||||
SeedGlobalHandles<GlobalHandlesUpdatingItem>(isolate()->global_handles(),
|
||||
&updating_job);
|
||||
SeedGlobalHandles<GlobalHandlesUpdatingItem>(
|
||||
heap(), isolate()->global_handles(), &updating_job);
|
||||
const int to_space_tasks = CollectToSpaceUpdatingItems(&updating_job);
|
||||
int remembered_set_pages = 0;
|
||||
remembered_set_pages += CollectRememberedSetUpdatingItems(
|
||||
@ -3989,7 +3999,7 @@ class PageMarkingItem : public MarkingItem {
|
||||
chunk_,
|
||||
[this, task](SlotType slot_type, Address host_addr, Address slot) {
|
||||
return UpdateTypedSlotHelper::UpdateTypedSlot(
|
||||
slot_type, slot, [this, task](MaybeObject** slot) {
|
||||
heap(), slot_type, slot, [this, task](MaybeObject** slot) {
|
||||
return CheckAndMarkObject(task,
|
||||
reinterpret_cast<Address>(slot));
|
||||
});
|
||||
@ -4021,8 +4031,8 @@ class PageMarkingItem : public MarkingItem {
|
||||
|
||||
class GlobalHandlesMarkingItem : public MarkingItem {
|
||||
public:
|
||||
GlobalHandlesMarkingItem(GlobalHandles* global_handles, size_t start,
|
||||
size_t end)
|
||||
GlobalHandlesMarkingItem(Heap* heap, GlobalHandles* global_handles,
|
||||
size_t start, size_t end)
|
||||
: global_handles_(global_handles), start_(start), end_(end) {}
|
||||
virtual ~GlobalHandlesMarkingItem() {}
|
||||
|
||||
@ -4076,8 +4086,8 @@ void MinorMarkCompactCollector::MarkRootSetInParallel(
|
||||
TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_MARK_SEED);
|
||||
heap()->IterateRoots(root_visitor, VISIT_ALL_IN_MINOR_MC_MARK);
|
||||
// Create batches of global handles.
|
||||
SeedGlobalHandles<GlobalHandlesMarkingItem>(isolate()->global_handles(),
|
||||
&job);
|
||||
SeedGlobalHandles<GlobalHandlesMarkingItem>(
|
||||
heap(), isolate()->global_handles(), &job);
|
||||
// Create items for each page.
|
||||
RememberedSet<OLD_TO_NEW>::IterateMemoryChunks(
|
||||
heap(), [&job, &slots](MemoryChunk* chunk) {
|
||||
|
@ -311,7 +311,7 @@ class UpdateTypedSlotHelper {
|
||||
// Updates an embedded pointer slot using an untyped slot callback.
|
||||
// The callback accepts Object** and returns SlotCallbackResult.
|
||||
template <typename Callback>
|
||||
static SlotCallbackResult UpdateEmbeddedPointer(RelocInfo* rinfo,
|
||||
static SlotCallbackResult UpdateEmbeddedPointer(Heap* heap, RelocInfo* rinfo,
|
||||
Callback callback) {
|
||||
DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT);
|
||||
HeapObject* old_target = rinfo->target_object();
|
||||
@ -320,7 +320,7 @@ class UpdateTypedSlotHelper {
|
||||
callback(reinterpret_cast<MaybeObject**>(&new_target));
|
||||
DCHECK(!HasWeakHeapObjectTag(new_target));
|
||||
if (new_target != old_target) {
|
||||
rinfo->set_target_object(HeapObject::cast(new_target));
|
||||
rinfo->set_target_object(heap, HeapObject::cast(new_target));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -328,8 +328,8 @@ class UpdateTypedSlotHelper {
|
||||
// Updates a typed slot using an untyped slot callback.
|
||||
// The callback accepts MaybeObject** and returns SlotCallbackResult.
|
||||
template <typename Callback>
|
||||
static SlotCallbackResult UpdateTypedSlot(SlotType slot_type, Address addr,
|
||||
Callback callback) {
|
||||
static SlotCallbackResult UpdateTypedSlot(Heap* heap, SlotType slot_type,
|
||||
Address addr, Callback callback) {
|
||||
switch (slot_type) {
|
||||
case CODE_TARGET_SLOT: {
|
||||
RelocInfo rinfo(addr, RelocInfo::CODE_TARGET, 0, nullptr);
|
||||
@ -340,7 +340,7 @@ class UpdateTypedSlotHelper {
|
||||
}
|
||||
case EMBEDDED_OBJECT_SLOT: {
|
||||
RelocInfo rinfo(addr, RelocInfo::EMBEDDED_OBJECT, 0, nullptr);
|
||||
return UpdateEmbeddedPointer(&rinfo, callback);
|
||||
return UpdateEmbeddedPointer(heap, &rinfo, callback);
|
||||
}
|
||||
case OBJECT_SLOT: {
|
||||
return callback(reinterpret_cast<MaybeObject**>(addr));
|
||||
|
@ -125,7 +125,7 @@ void Scavenger::ScavengePage(MemoryChunk* page) {
|
||||
RememberedSet<OLD_TO_NEW>::IterateTyped(
|
||||
page, [this](SlotType type, Address host_addr, Address addr) {
|
||||
return UpdateTypedSlotHelper::UpdateTypedSlot(
|
||||
type, addr, [this](MaybeObject** addr) {
|
||||
heap_, type, addr, [this](MaybeObject** addr) {
|
||||
return CheckAndScavengeObject(heap(),
|
||||
reinterpret_cast<Address>(addr));
|
||||
});
|
||||
|
@ -97,7 +97,7 @@ Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
|
||||
return Handle<HeapObject>::cast(Memory::Object_Handle_at(pc_));
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_object(HeapObject* target,
|
||||
void RelocInfo::set_target_object(Heap* heap, HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
@ -106,9 +106,8 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
Assembler::FlushICache(pc_, sizeof(Address));
|
||||
}
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
|
||||
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
|
||||
target);
|
||||
heap->RecordWriteIntoCode(host(), this, target);
|
||||
heap->incremental_marking()->RecordWriteIntoCode(host(), this, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
|
||||
Assembler::target_address_at(pc_, constant_pool_)));
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_object(HeapObject* target,
|
||||
void RelocInfo::set_target_object(Heap* heap, HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
@ -204,9 +204,9 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
|
||||
host(), this, HeapObject::cast(target));
|
||||
host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->incremental_marking()->RecordWriteIntoCode(host(), this,
|
||||
HeapObject::cast(target));
|
||||
heap->RecordWriteIntoCode(host(), this, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
|
||||
Assembler::target_address_at(pc_, constant_pool_)));
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_object(HeapObject* target,
|
||||
void RelocInfo::set_target_object(Heap* heap, HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
@ -173,9 +173,9 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr &&
|
||||
target->IsHeapObject()) {
|
||||
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
|
||||
host(), this, HeapObject::cast(target));
|
||||
host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->incremental_marking()->RecordWriteIntoCode(host(), this,
|
||||
HeapObject::cast(target));
|
||||
heap->RecordWriteIntoCode(host(), this, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14002,13 +14002,13 @@ void ObjectVisitor::VisitRelocInfo(RelocIterator* it) {
|
||||
}
|
||||
}
|
||||
|
||||
void Code::InvalidateEmbeddedObjects() {
|
||||
HeapObject* undefined = GetHeap()->undefined_value();
|
||||
void Code::InvalidateEmbeddedObjects(Heap* heap) {
|
||||
HeapObject* undefined = heap->undefined_value();
|
||||
int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
|
||||
for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
|
||||
RelocInfo::Mode mode = it.rinfo()->rmode();
|
||||
if (mode == RelocInfo::EMBEDDED_OBJECT) {
|
||||
it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER);
|
||||
it.rinfo()->set_target_object(heap, undefined, SKIP_WRITE_BARRIER);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14025,12 +14025,12 @@ void Code::FlushICache() const {
|
||||
Assembler::FlushICache(raw_instruction_start(), raw_instruction_size());
|
||||
}
|
||||
|
||||
void Code::CopyFrom(const CodeDesc& desc) {
|
||||
CopyFromNoFlush(desc);
|
||||
void Code::CopyFrom(Heap* heap, const CodeDesc& desc) {
|
||||
CopyFromNoFlush(heap, desc);
|
||||
FlushICache();
|
||||
}
|
||||
|
||||
void Code::CopyFromNoFlush(const CodeDesc& desc) {
|
||||
void Code::CopyFromNoFlush(Heap* heap, const CodeDesc& desc) {
|
||||
// copy code
|
||||
CopyBytes(reinterpret_cast<byte*>(raw_instruction_start()), desc.buffer,
|
||||
static_cast<size_t>(desc.instr_size));
|
||||
@ -14061,7 +14061,7 @@ void Code::CopyFromNoFlush(const CodeDesc& desc) {
|
||||
RelocInfo::Mode mode = it.rinfo()->rmode();
|
||||
if (mode == RelocInfo::EMBEDDED_OBJECT) {
|
||||
Handle<HeapObject> p = it.rinfo()->target_object_handle(origin);
|
||||
it.rinfo()->set_target_object(*p, UPDATE_WRITE_BARRIER,
|
||||
it.rinfo()->set_target_object(heap, *p, UPDATE_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
} else if (RelocInfo::IsCodeTarget(mode)) {
|
||||
// rewrite code handles to direct pointers to the first instruction in the
|
||||
|
@ -73,7 +73,7 @@ class Code : public HeapObject {
|
||||
|
||||
// [relocation_info]: Code relocation information
|
||||
DECL_ACCESSORS(relocation_info, ByteArray)
|
||||
void InvalidateEmbeddedObjects();
|
||||
void InvalidateEmbeddedObjects(Heap* heap);
|
||||
|
||||
// [deoptimization_data]: Array containing data for deopt.
|
||||
DECL_ACCESSORS(deoptimization_data, FixedArray)
|
||||
@ -304,10 +304,10 @@ class Code : public HeapObject {
|
||||
void Relocate(intptr_t delta);
|
||||
|
||||
// Migrate code described by desc.
|
||||
void CopyFrom(const CodeDesc& desc);
|
||||
void CopyFrom(Heap* heap, const CodeDesc& desc);
|
||||
|
||||
// Migrate code from desc without flushing the instruction cache.
|
||||
void CopyFromNoFlush(const CodeDesc& desc);
|
||||
void CopyFromNoFlush(Heap* heap, const CodeDesc& desc);
|
||||
|
||||
// Flushes the instruction cache for the executable instructions of this code
|
||||
// object.
|
||||
|
@ -173,7 +173,7 @@ Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
|
||||
Assembler::target_address_at(pc_, constant_pool_)));
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_object(HeapObject* target,
|
||||
void RelocInfo::set_target_object(Heap* heap, HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
@ -181,9 +181,8 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
|
||||
target);
|
||||
host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->incremental_marking()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->RecordWriteIntoCode(host(), this, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,8 +184,8 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceRefToNestedFunction) {
|
||||
CHECK(orig_wrapper->value()->IsSharedFunctionInfo());
|
||||
CHECK(subst_wrapper->value()->IsSharedFunctionInfo());
|
||||
|
||||
LiveEdit::ReplaceRefToNestedFunction(parent_wrapper, orig_wrapper,
|
||||
subst_wrapper);
|
||||
LiveEdit::ReplaceRefToNestedFunction(isolate->heap(), parent_wrapper,
|
||||
orig_wrapper, subst_wrapper);
|
||||
return isolate->heap()->undefined_value();
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_object(HeapObject* target,
|
||||
void RelocInfo::set_target_object(Heap* heap, HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
@ -164,9 +164,8 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
|
||||
target);
|
||||
host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->incremental_marking()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->RecordWriteIntoCode(host(), this, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ Address RelocInfo::target_internal_reference_address() {
|
||||
return pc_;
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_object(HeapObject* target,
|
||||
void RelocInfo::set_target_object(Heap* heap, HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
@ -382,9 +382,8 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
Assembler::FlushICache(pc_, sizeof(Address));
|
||||
}
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
|
||||
target);
|
||||
host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->incremental_marking()->RecordWriteIntoCode(host(), this, target);
|
||||
heap->RecordWriteIntoCode(host(), this, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user