Commit af010cfb authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

Update manual write barrier calls for new entry point

The initial CL only re-wired the macro but did not convert the remaining
manual uses.

Change-Id: Ia4c6dea006d7c026d2376affee0b7027f5aa7895
Reviewed-on: https://chromium-review.googlesource.com/1152907Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54753}
parent 72d5ad3e
...@@ -12,6 +12,7 @@ include_rules = [ ...@@ -12,6 +12,7 @@ include_rules = [
"+src/heap/factory-inl.h", "+src/heap/factory-inl.h",
"+src/heap/heap.h", "+src/heap/heap.h",
"+src/heap/heap-inl.h", "+src/heap/heap-inl.h",
"+src/heap/heap-write-barrier-inl.h",
"-src/inspector", "-src/inspector",
"-src/interpreter", "-src/interpreter",
"+src/interpreter/bytecode-array-accessor.h", "+src/interpreter/bytecode-array-accessor.h",
......
...@@ -429,21 +429,6 @@ bool Heap::ShouldBePromoted(Address old_address) { ...@@ -429,21 +429,6 @@ bool Heap::ShouldBePromoted(Address old_address) {
(!page->ContainsLimit(age_mark) || old_address < age_mark); (!page->ContainsLimit(age_mark) || old_address < age_mark);
} }
void Heap::RecordWrite(Object* object, Object** slot, Object* value) {
DCHECK(!HasWeakHeapObjectTag(*slot));
DCHECK(!HasWeakHeapObjectTag(value));
DCHECK(object->IsHeapObject()); // Can't write to slots of a Smi.
if (!InNewSpace(value) || InNewSpace(HeapObject::cast(object))) return;
store_buffer()->InsertEntry(reinterpret_cast<Address>(slot));
}
void Heap::RecordWrite(Object* object, MaybeObject** slot, MaybeObject* value) {
if (!InNewSpace(value) || !object->IsHeapObject() || InNewSpace(object)) {
return;
}
store_buffer()->InsertEntry(reinterpret_cast<Address>(slot));
}
void Heap::RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value) { void Heap::RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value) {
if (InNewSpace(value)) { if (InNewSpace(value)) {
RecordWriteIntoCodeSlow(host, rinfo, value); RecordWriteIntoCodeSlow(host, rinfo, value);
......
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
#ifndef V8_HEAP_HEAP_WRITE_BARRIER_INL_H_ #ifndef V8_HEAP_HEAP_WRITE_BARRIER_INL_H_
#define V8_HEAP_HEAP_WRITE_BARRIER_INL_H_ #define V8_HEAP_HEAP_WRITE_BARRIER_INL_H_
// Clients of this interface shouldn't depend on lots of heap internals.
// Do not include anything from src/heap here!
#include "src/heap/heap-write-barrier.h" #include "src/heap/heap-write-barrier.h"
#include "src/globals.h" #include "src/globals.h"
#include "src/heap/heap.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "src/objects/maybe-object-inl.h" #include "src/objects/maybe-object-inl.h"
......
...@@ -983,9 +983,7 @@ class Heap { ...@@ -983,9 +983,7 @@ class Heap {
// =========================================================================== // ===========================================================================
// Write barrier support for object[offset] = o; // Write barrier support for object[offset] = o;
inline void RecordWrite(Object* object, MaybeObject** slot, // See heap/heap-write-barrier-inl.h for stand-alone methods.
MaybeObject* value);
inline void RecordWrite(Object* object, Object** slot, Object* value);
inline void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* target); inline void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* target);
void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* target); void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* target);
void RecordWritesIntoCode(Code* code); void RecordWritesIntoCode(Code* code);
......
...@@ -1035,8 +1035,7 @@ void HeapObject::set_map(Map* value) { ...@@ -1035,8 +1035,7 @@ void HeapObject::set_map(Map* value) {
if (value != nullptr) { if (value != nullptr) {
// TODO(1600) We are passing nullptr as a slot because maps can never be on // TODO(1600) We are passing nullptr as a slot because maps can never be on
// evacuation candidate. // evacuation candidate.
Heap::FromWritableHeapObject(this)->incremental_marking()->RecordWrite( MarkingBarrier(this, nullptr, value);
this, nullptr, value);
} }
} }
...@@ -1055,8 +1054,7 @@ void HeapObject::synchronized_set_map(Map* value) { ...@@ -1055,8 +1054,7 @@ void HeapObject::synchronized_set_map(Map* value) {
if (value != nullptr) { if (value != nullptr) {
// TODO(1600) We are passing nullptr as a slot because maps can never be on // TODO(1600) We are passing nullptr as a slot because maps can never be on
// evacuation candidate. // evacuation candidate.
Heap::FromWritableHeapObject(this)->incremental_marking()->RecordWrite( MarkingBarrier(this, nullptr, value);
this, nullptr, value);
} }
} }
...@@ -1077,8 +1075,7 @@ void HeapObject::set_map_after_allocation(Map* value, WriteBarrierMode mode) { ...@@ -1077,8 +1075,7 @@ void HeapObject::set_map_after_allocation(Map* value, WriteBarrierMode mode) {
DCHECK_NOT_NULL(value); DCHECK_NOT_NULL(value);
// TODO(1600) We are passing nullptr as a slot because maps can never be on // TODO(1600) We are passing nullptr as a slot because maps can never be on
// evacuation candidate. // evacuation candidate.
Heap::FromWritableHeapObject(this)->incremental_marking()->RecordWrite( MarkingBarrier(this, nullptr, value);
this, nullptr, value);
} }
} }
...@@ -2526,8 +2523,7 @@ Code* JSFunction::code() { return Code::cast(READ_FIELD(this, kCodeOffset)); } ...@@ -2526,8 +2523,7 @@ Code* JSFunction::code() { return Code::cast(READ_FIELD(this, kCodeOffset)); }
void JSFunction::set_code(Code* value) { void JSFunction::set_code(Code* value) {
DCHECK(!Heap::InNewSpace(value)); DCHECK(!Heap::InNewSpace(value));
WRITE_FIELD(this, kCodeOffset, value); WRITE_FIELD(this, kCodeOffset, value);
GetHeap()->incremental_marking()->RecordWrite( MarkingBarrier(this, HeapObject::RawField(this, kCodeOffset), value);
this, HeapObject::RawField(this, kCodeOffset), value);
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "src/snapshot/deserializer.h" #include "src/snapshot/deserializer.h"
#include "src/assembler-inl.h" #include "src/assembler-inl.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/objects/api-callbacks.h" #include "src/objects/api-callbacks.h"
#include "src/objects/hash-table.h" #include "src/objects/hash-table.h"
...@@ -713,8 +714,7 @@ bool Deserializer<AllocatorT>::ReadData(MaybeObject** current, ...@@ -713,8 +714,7 @@ bool Deserializer<AllocatorT>::ReadData(MaybeObject** current,
UnalignedCopy(current, &hot_maybe_object); UnalignedCopy(current, &hot_maybe_object);
if (write_barrier_needed && Heap::InNewSpace(hot_object)) { if (write_barrier_needed && Heap::InNewSpace(hot_object)) {
Address current_address = reinterpret_cast<Address>(current); Address current_address = reinterpret_cast<Address>(current);
isolate->heap()->RecordWrite( GenerationalBarrier(HeapObject::FromAddress(current_object_address),
HeapObject::FromAddress(current_object_address),
reinterpret_cast<MaybeObject**>(current_address), reinterpret_cast<MaybeObject**>(current_address),
hot_maybe_object); hot_maybe_object);
} }
...@@ -874,8 +874,7 @@ MaybeObject** Deserializer<AllocatorT>::ReadDataCase( ...@@ -874,8 +874,7 @@ MaybeObject** Deserializer<AllocatorT>::ReadDataCase(
if (emit_write_barrier && write_barrier_needed) { if (emit_write_barrier && write_barrier_needed) {
Address current_address = reinterpret_cast<Address>(current); Address current_address = reinterpret_cast<Address>(current);
SLOW_DCHECK(isolate->heap()->ContainsSlow(current_object_address)); SLOW_DCHECK(isolate->heap()->ContainsSlow(current_object_address));
isolate->heap()->RecordWrite( GenerationalBarrier(HeapObject::FromAddress(current_object_address),
HeapObject::FromAddress(current_object_address),
reinterpret_cast<MaybeObject**>(current_address), reinterpret_cast<MaybeObject**>(current_address),
*reinterpret_cast<MaybeObject**>(current_address)); *reinterpret_cast<MaybeObject**>(current_address));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment