Commit 73996210 authored by Georg Neis's avatar Georg Neis Committed by V8 LUCI CQ

[compiler] Clean up Ref construction

Make code more readable, mainly by using MakeRef & co. and their
overloads.

Bug: v8:7790
Change-Id: Id45a69857a1be106c152615ac6dbc2f8a42fb7e8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2874398Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74401}
parent 30d886dd
...@@ -482,8 +482,7 @@ base::Optional<ObjectRef> GetOwnElementFromHeap(JSHeapBroker* broker, ...@@ -482,8 +482,7 @@ base::Optional<ObjectRef> GetOwnElementFromHeap(JSHeapBroker* broker,
LookupIterator it(broker->isolate(), receiver, index, LookupIterator::OWN); LookupIterator it(broker->isolate(), receiver, index, LookupIterator::OWN);
if (it.state() == LookupIterator::DATA && if (it.state() == LookupIterator::DATA &&
(!constant_only || (it.IsReadOnly() && !it.IsConfigurable()))) { (!constant_only || (it.IsReadOnly() && !it.IsConfigurable()))) {
return ObjectRef(broker, return MakeRef(broker, it.GetDataValue());
broker->CanonicalPersistentHandle(it.GetDataValue()));
} }
return base::nullopt; return base::nullopt;
} }
...@@ -2491,7 +2490,7 @@ ContextRef ContextRef::previous(size_t* depth, ...@@ -2491,7 +2490,7 @@ ContextRef ContextRef::previous(size_t* depth,
current = Context::cast(current.unchecked_previous()); current = Context::cast(current.unchecked_previous());
(*depth)--; (*depth)--;
} }
return MakeRef(broker(), broker()->CanonicalPersistentHandle(current)); return MakeRef(broker(), current);
} }
if (*depth == 0) return *this; if (*depth == 0) return *this;
...@@ -2998,13 +2997,9 @@ OddballType MapRef::oddball_type() const { ...@@ -2998,13 +2997,9 @@ OddballType MapRef::oddball_type() const {
FeedbackCellRef FeedbackVectorRef::GetClosureFeedbackCell(int index) const { FeedbackCellRef FeedbackVectorRef::GetClosureFeedbackCell(int index) const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
FeedbackCell cell = object()->closure_feedback_cell(index);
Handle<FeedbackCell> cell_handle =
broker()->CanonicalPersistentHandle(cell);
// These should all be available because we request the cell for each // These should all be available because we request the cell for each
// CreateClosure bytecode. // CreateClosure bytecode.
ObjectData* cell_data = broker()->GetOrCreateData(cell_handle); return MakeRef(broker(), object()->closure_feedback_cell(index));
return FeedbackCellRef(broker(), cell_data);
} }
return FeedbackCellRef( return FeedbackCellRef(
...@@ -3015,8 +3010,7 @@ FeedbackCellRef FeedbackVectorRef::GetClosureFeedbackCell(int index) const { ...@@ -3015,8 +3010,7 @@ FeedbackCellRef FeedbackVectorRef::GetClosureFeedbackCell(int index) const {
ObjectRef JSObjectRef::RawFastPropertyAt(FieldIndex index) const { ObjectRef JSObjectRef::RawFastPropertyAt(FieldIndex index) const {
CHECK(index.is_inobject()); CHECK(index.is_inobject());
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
return ObjectRef(broker(), broker()->CanonicalPersistentHandle( return MakeRef(broker(), object()->RawFastPropertyAt(index));
object()->RawFastPropertyAt(index)));
} }
JSObjectData* object_data = data()->AsJSObject(); JSObjectData* object_data = data()->AsJSObject();
return ObjectRef(broker(), return ObjectRef(broker(),
...@@ -3198,8 +3192,7 @@ int ArrayBoilerplateDescriptionRef::constants_elements_length() const { ...@@ -3198,8 +3192,7 @@ int ArrayBoilerplateDescriptionRef::constants_elements_length() const {
ObjectRef FixedArrayRef::get(int i) const { return TryGet(i).value(); } ObjectRef FixedArrayRef::get(int i) const { return TryGet(i).value(); }
base::Optional<ObjectRef> FixedArrayRef::TryGet(int i) const { base::Optional<ObjectRef> FixedArrayRef::TryGet(int i) const {
return TryMakeRef(broker(), broker()->CanonicalPersistentHandle( return TryMakeRef(broker(), object()->get(i, kRelaxedLoad));
object()->get(i, kRelaxedLoad)));
} }
Float64 FixedDoubleArrayRef::GetFromImmutableFixedDoubleArray(int i) const { Float64 FixedDoubleArrayRef::GetFromImmutableFixedDoubleArray(int i) const {
...@@ -3226,11 +3219,9 @@ int BytecodeArrayRef::handler_table_size() const { ...@@ -3226,11 +3219,9 @@ int BytecodeArrayRef::handler_table_size() const {
return object()->name(); \ return object()->name(); \
} }
#define IF_ACCESS_FROM_HEAP(result, name) \ #define IF_ACCESS_FROM_HEAP(result, name) \
if (data_->should_access_heap()) { \ if (data_->should_access_heap()) { \
return MakeRef( \ return MakeRef(broker(), result::cast(object()->name())); \
broker(), Handle<result>::cast( \
broker()->CanonicalPersistentHandle(object()->name()))); \
} }
// Macros for definining a const getter that, depending on the data kind, // Macros for definining a const getter that, depending on the data kind,
...@@ -3257,11 +3248,9 @@ int BytecodeArrayRef::handler_table_size() const { ...@@ -3257,11 +3248,9 @@ int BytecodeArrayRef::handler_table_size() const {
// Like IF_ACCESS_FROM_HEAP[_C] but we also allow direct heap access for // Like IF_ACCESS_FROM_HEAP[_C] but we also allow direct heap access for
// kSerialized only for methods that we identified to be safe. // kSerialized only for methods that we identified to be safe.
#define IF_ACCESS_FROM_HEAP_WITH_FLAG(result, name) \ #define IF_ACCESS_FROM_HEAP_WITH_FLAG(result, name) \
if (data_->should_access_heap() || broker()->is_concurrent_inlining()) { \ if (data_->should_access_heap() || broker()->is_concurrent_inlining()) { \
return MakeRef( \ return MakeRef(broker(), result::cast(object()->name())); \
broker(), Handle<result>::cast( \
broker()->CanonicalPersistentHandle(object()->name()))); \
} }
#define IF_ACCESS_FROM_HEAP_WITH_FLAG_C(name) \ #define IF_ACCESS_FROM_HEAP_WITH_FLAG_C(name) \
if (data_->should_access_heap() || broker()->is_concurrent_inlining()) { \ if (data_->should_access_heap() || broker()->is_concurrent_inlining()) { \
...@@ -3379,9 +3368,7 @@ base::Optional<CallHandlerInfoRef> FunctionTemplateInfoRef::call_code() const { ...@@ -3379,9 +3368,7 @@ base::Optional<CallHandlerInfoRef> FunctionTemplateInfoRef::call_code() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
HeapObject call_code = object()->call_code(kAcquireLoad); HeapObject call_code = object()->call_code(kAcquireLoad);
if (call_code.IsUndefined()) return base::nullopt; if (call_code.IsUndefined()) return base::nullopt;
return MakeRef(broker(), return MakeRef(broker(), CallHandlerInfo::cast(call_code));
Handle<CallHandlerInfo>::cast(
broker()->CanonicalPersistentHandle(call_code)));
} }
ObjectData* call_code = data()->AsFunctionTemplateInfo()->call_code(); ObjectData* call_code = data()->AsFunctionTemplateInfo()->call_code();
if (!call_code) return base::nullopt; if (!call_code) return base::nullopt;
...@@ -3513,8 +3500,7 @@ BytecodeArrayRef SharedFunctionInfoRef::GetBytecodeArray() const { ...@@ -3513,8 +3500,7 @@ BytecodeArrayRef SharedFunctionInfoRef::GetBytecodeArray() const {
} else { } else {
bytecode_array = object()->GetBytecodeArray(broker()->isolate()); bytecode_array = object()->GetBytecodeArray(broker()->isolate());
} }
return MakeRef(broker(), return MakeRef(broker(), bytecode_array);
broker()->CanonicalPersistentHandle(bytecode_array));
} }
return BytecodeArrayRef( return BytecodeArrayRef(
broker(), ObjectRef ::data()->AsSharedFunctionInfo()->GetBytecodeArray()); broker(), ObjectRef ::data()->AsSharedFunctionInfo()->GetBytecodeArray());
...@@ -3540,15 +3526,7 @@ base::Optional<FeedbackVectorRef> FeedbackCellRef::value() const { ...@@ -3540,15 +3526,7 @@ base::Optional<FeedbackVectorRef> FeedbackCellRef::value() const {
// Note that we use the synchronized accessor. // Note that we use the synchronized accessor.
Object value = object()->value(kAcquireLoad); Object value = object()->value(kAcquireLoad);
if (!value.IsFeedbackVector()) return base::nullopt; if (!value.IsFeedbackVector()) return base::nullopt;
base::Optional<FeedbackVectorRef> vector_ref = TryMakeRef( return TryMakeRef(broker(), FeedbackVector::cast(value));
broker(),
broker()->CanonicalPersistentHandle(FeedbackVector::cast(value)));
if (!vector_ref.has_value()) {
TRACE_BROKER_MISSING(
broker(),
"Unable to retrieve FeedbackVector from FeedbackCellRef " << *this);
}
return vector_ref;
} }
ObjectData* vector = ObjectRef::data()->AsFeedbackCell()->value(); ObjectData* vector = ObjectRef::data()->AsFeedbackCell()->value();
return FeedbackVectorRef(broker(), vector->AsFeedbackVector()); return FeedbackVectorRef(broker(), vector->AsFeedbackVector());
...@@ -3562,9 +3540,8 @@ base::Optional<ObjectRef> MapRef::GetStrongValue( ...@@ -3562,9 +3540,8 @@ base::Optional<ObjectRef> MapRef::GetStrongValue(
DescriptorArrayRef MapRef::instance_descriptors() const { DescriptorArrayRef MapRef::instance_descriptors() const {
if (data_->should_access_heap() || broker()->is_concurrent_inlining()) { if (data_->should_access_heap() || broker()->is_concurrent_inlining()) {
return MakeRef(broker(), broker()->CanonicalPersistentHandle( return MakeRef(broker(), object()->instance_descriptors(broker()->isolate(),
object()->instance_descriptors( kRelaxedLoad));
broker()->isolate(), kRelaxedLoad)));
} }
return DescriptorArrayRef(broker(), data()->AsMap()->instance_descriptors()); return DescriptorArrayRef(broker(), data()->AsMap()->instance_descriptors());
...@@ -3593,13 +3570,7 @@ base::Optional<MapRef> MapRef::FindRootMap() const { ...@@ -3593,13 +3570,7 @@ base::Optional<MapRef> MapRef::FindRootMap() const {
// TODO(solanes): Change TryMakeRef to MakeRef when Map is moved to // TODO(solanes): Change TryMakeRef to MakeRef when Map is moved to
// kNeverSerialized. // kNeverSerialized.
// TODO(solanes, v8:7790): Consider caching the result of the root map. // TODO(solanes, v8:7790): Consider caching the result of the root map.
base::Optional<MapRef> root_map = return TryMakeRef(broker(), object()->FindRootMap(broker()->isolate()));
TryMakeRef(broker(), broker()->CanonicalPersistentHandle(
object()->FindRootMap(broker()->isolate())));
if (!root_map.has_value()) {
TRACE_BROKER_MISSING(broker(), "root map for object " << *this);
}
return root_map;
} }
ObjectData* map_data = data()->AsMap()->FindRootMap(); ObjectData* map_data = data()->AsMap()->FindRootMap();
if (map_data != nullptr) { if (map_data != nullptr) {
...@@ -3637,9 +3608,7 @@ HeapObjectRef JSTypedArrayRef::buffer() const { ...@@ -3637,9 +3608,7 @@ HeapObjectRef JSTypedArrayRef::buffer() const {
// Safe to read concurrently because: // Safe to read concurrently because:
// - immutable after initialization. // - immutable after initialization.
// - host object seen by serializer. // - host object seen by serializer.
Handle<HeapObject> value = return MakeRef<HeapObject>(broker(), object()->buffer());
broker()->CanonicalPersistentHandle(object()->buffer());
return MakeRef(broker(), value);
} }
return HeapObjectRef{broker(), data()->AsJSTypedArray()->buffer()}; return HeapObjectRef{broker(), data()->AsJSTypedArray()->buffer()};
} }
...@@ -3740,16 +3709,14 @@ bool NativeContextRef::is_unserialized_heap_object() const { ...@@ -3740,16 +3709,14 @@ bool NativeContextRef::is_unserialized_heap_object() const {
ScopeInfoRef NativeContextRef::scope_info() const { ScopeInfoRef NativeContextRef::scope_info() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
return MakeRef(broker(), return MakeRef(broker(), object()->scope_info());
broker()->CanonicalPersistentHandle(object()->scope_info()));
} }
return ScopeInfoRef(broker(), data()->AsNativeContext()->scope_info()); return ScopeInfoRef(broker(), data()->AsNativeContext()->scope_info());
} }
SharedFunctionInfoRef FeedbackVectorRef::shared_function_info() const { SharedFunctionInfoRef FeedbackVectorRef::shared_function_info() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
return MakeRef(broker(), broker()->CanonicalPersistentHandle( return MakeRef(broker(), object()->shared_function_info());
object()->shared_function_info()));
} }
return SharedFunctionInfoRef( return SharedFunctionInfoRef(
...@@ -3887,8 +3854,7 @@ base::Optional<ObjectRef> JSObjectRef::GetOwnConstantElement( ...@@ -3887,8 +3854,7 @@ base::Optional<ObjectRef> JSObjectRef::GetOwnConstantElement(
} }
DCHECK_EQ(result, ConcurrentLookupIterator::kPresent); DCHECK_EQ(result, ConcurrentLookupIterator::kPresent);
return ObjectRef{broker(), return MakeRef(broker(), maybe_element);
broker()->CanonicalPersistentHandle(maybe_element)};
} else { } else {
ObjectData* element = ObjectData* element =
data()->AsJSObject()->GetOwnConstantElement(broker(), index, policy); data()->AsJSObject()->GetOwnConstantElement(broker(), index, policy);
...@@ -3933,8 +3899,8 @@ ObjectRef JSArrayRef::GetBoilerplateLength() const { ...@@ -3933,8 +3899,8 @@ ObjectRef JSArrayRef::GetBoilerplateLength() const {
ObjectRef JSArrayRef::length_unsafe() const { ObjectRef JSArrayRef::length_unsafe() const {
if (data_->should_access_heap() || broker()->is_concurrent_inlining()) { if (data_->should_access_heap() || broker()->is_concurrent_inlining()) {
Object o = object()->length(broker()->isolate(), kRelaxedLoad); return MakeRef(broker(),
return ObjectRef{broker(), broker()->CanonicalPersistentHandle(o)}; object()->length(broker()->isolate(), kRelaxedLoad));
} else { } else {
return ObjectRef{broker(), data()->AsJSArray()->length()}; return ObjectRef{broker(), data()->AsJSArray()->length()};
} }
...@@ -3979,11 +3945,9 @@ base::Optional<ObjectRef> JSArrayRef::GetOwnCowElement( ...@@ -3979,11 +3945,9 @@ base::Optional<ObjectRef> JSArrayRef::GetOwnCowElement(
ConcurrentLookupIterator::TryGetOwnCowElement( ConcurrentLookupIterator::TryGetOwnCowElement(
broker()->isolate(), *elements_ref.AsFixedArray().object(), broker()->isolate(), *elements_ref.AsFixedArray().object(),
elements_kind, length_ref.AsSmi(), index); elements_kind, length_ref.AsSmi(), index);
if (!result.has_value()) return {}; if (!result.has_value()) return {};
return ObjectRef{broker(), return MakeRef(broker(), result.value());
broker()->CanonicalPersistentHandle(result.value())};
} else { } else {
DCHECK(!data_->should_access_heap()); DCHECK(!data_->should_access_heap());
DCHECK(!broker()->is_concurrent_inlining()); DCHECK(!broker()->is_concurrent_inlining());
...@@ -4003,8 +3967,7 @@ base::Optional<ObjectRef> JSArrayRef::GetOwnCowElement( ...@@ -4003,8 +3967,7 @@ base::Optional<ObjectRef> JSArrayRef::GetOwnCowElement(
base::Optional<CellRef> SourceTextModuleRef::GetCell(int cell_index) const { base::Optional<CellRef> SourceTextModuleRef::GetCell(int cell_index) const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
return MakeRef(broker(), broker()->CanonicalPersistentHandle( return MakeRef(broker(), object()->GetCell(cell_index));
object()->GetCell(cell_index)));
} }
ObjectData* cell = ObjectData* cell =
data()->AsSourceTextModule()->GetCell(broker(), cell_index); data()->AsSourceTextModule()->GetCell(broker(), cell_index);
...@@ -4014,8 +3977,7 @@ base::Optional<CellRef> SourceTextModuleRef::GetCell(int cell_index) const { ...@@ -4014,8 +3977,7 @@ base::Optional<CellRef> SourceTextModuleRef::GetCell(int cell_index) const {
base::Optional<ObjectRef> SourceTextModuleRef::import_meta() const { base::Optional<ObjectRef> SourceTextModuleRef::import_meta() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
return TryMakeRef( return TryMakeRef(broker(), object()->import_meta());
broker(), broker()->CanonicalPersistentHandle(object()->import_meta()));
} }
return ObjectRef(broker(), return ObjectRef(broker(),
data()->AsSourceTextModule()->GetImportMeta(broker())); data()->AsSourceTextModule()->GetImportMeta(broker()));
...@@ -4080,8 +4042,7 @@ HeapObjectType HeapObjectRef::GetHeapObjectType() const { ...@@ -4080,8 +4042,7 @@ HeapObjectType HeapObjectRef::GetHeapObjectType() const {
} }
base::Optional<JSObjectRef> AllocationSiteRef::boilerplate() const { base::Optional<JSObjectRef> AllocationSiteRef::boilerplate() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
return MakeRef(broker(), broker()->CanonicalPersistentHandle( return MakeRef(broker(), object()->boilerplate(kAcquireLoad));
object()->boilerplate(kAcquireLoad)));
} }
ObjectData* boilerplate = data()->AsAllocationSite()->boilerplate(); ObjectData* boilerplate = data()->AsAllocationSite()->boilerplate();
if (boilerplate) { if (boilerplate) {
...@@ -4097,8 +4058,7 @@ ElementsKind JSObjectRef::GetElementsKind() const { ...@@ -4097,8 +4058,7 @@ ElementsKind JSObjectRef::GetElementsKind() const {
base::Optional<FixedArrayBaseRef> JSObjectRef::elements() const { base::Optional<FixedArrayBaseRef> JSObjectRef::elements() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
return MakeRef(broker(), return MakeRef(broker(), object()->elements());
broker()->CanonicalPersistentHandle(object()->elements()));
} }
const JSObjectData* d = data()->AsJSObject(); const JSObjectData* d = data()->AsJSObject();
if (!d->serialized_elements()) { if (!d->serialized_elements()) {
...@@ -4124,8 +4084,7 @@ PropertyDetails DescriptorArrayRef::GetPropertyDetails( ...@@ -4124,8 +4084,7 @@ PropertyDetails DescriptorArrayRef::GetPropertyDetails(
NameRef DescriptorArrayRef::GetPropertyKey( NameRef DescriptorArrayRef::GetPropertyKey(
InternalIndex descriptor_index) const { InternalIndex descriptor_index) const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
NameRef result = MakeRef(broker(), broker()->CanonicalPersistentHandle( NameRef result = MakeRef(broker(), object()->GetKey(descriptor_index));
object()->GetKey(descriptor_index)));
CHECK(result.IsUniqueName()); CHECK(result.IsUniqueName());
return result; return result;
} }
...@@ -4136,8 +4095,7 @@ NameRef DescriptorArrayRef::GetPropertyKey( ...@@ -4136,8 +4095,7 @@ NameRef DescriptorArrayRef::GetPropertyKey(
ObjectRef DescriptorArrayRef::GetFieldType( ObjectRef DescriptorArrayRef::GetFieldType(
InternalIndex descriptor_index) const { InternalIndex descriptor_index) const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
return ObjectRef(broker(), broker()->CanonicalPersistentHandle( return MakeRef<Object>(broker(), object()->GetFieldType(descriptor_index));
object()->GetFieldType(descriptor_index)));
} }
return ObjectRef(broker(), return ObjectRef(broker(),
data()->AsDescriptorArray()->GetFieldType(descriptor_index)); data()->AsDescriptorArray()->GetFieldType(descriptor_index));
...@@ -4155,14 +4113,7 @@ base::Optional<ObjectRef> DescriptorArrayRef::GetStrongValue( ...@@ -4155,14 +4113,7 @@ base::Optional<ObjectRef> DescriptorArrayRef::GetStrongValue(
// Since the descriptors in the descriptor array can be changed in-place // Since the descriptors in the descriptor array can be changed in-place
// via DescriptorArray::Replace, we might get a value that we haven't seen // via DescriptorArray::Replace, we might get a value that we haven't seen
// before. // before.
base::Optional<ObjectRef> ref = return TryMakeRef(broker(), heap_object);
TryMakeRef(broker(), broker()->CanonicalPersistentHandle(heap_object));
if (!ref.has_value()) {
TRACE_BROKER_MISSING(broker(), "strong value for descriptor array "
<< *this << " at index "
<< descriptor_index.as_int());
}
return ref;
} }
ObjectData* value = ObjectData* value =
data()->AsDescriptorArray()->GetStrongValue(descriptor_index); data()->AsDescriptorArray()->GetStrongValue(descriptor_index);
...@@ -4366,8 +4317,7 @@ bool JSFunctionRef::serialized_code_and_feedback() const { ...@@ -4366,8 +4317,7 @@ bool JSFunctionRef::serialized_code_and_feedback() const {
CodeRef JSFunctionRef::code() const { CodeRef JSFunctionRef::code() const {
if (data_->should_access_heap() || broker()->is_concurrent_inlining()) { if (data_->should_access_heap() || broker()->is_concurrent_inlining()) {
return MakeRef(broker(), broker()->CanonicalPersistentHandle( return MakeRef(broker(), object()->code(kAcquireLoad));
object()->code(kAcquireLoad)));
} }
return CodeRef(broker(), ObjectRef::data()->AsJSFunction()->code()); return CodeRef(broker(), ObjectRef::data()->AsJSFunction()->code());
...@@ -4389,10 +4339,8 @@ base::Optional<FunctionTemplateInfoRef> ...@@ -4389,10 +4339,8 @@ base::Optional<FunctionTemplateInfoRef>
SharedFunctionInfoRef::function_template_info() const { SharedFunctionInfoRef::function_template_info() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
if (!object()->IsApiFunction()) return {}; if (!object()->IsApiFunction()) return {};
return TryMakeRef( return TryMakeRef(broker(), FunctionTemplateInfo::cast(
broker(), object()->function_data(kAcquireLoad)));
broker()->CanonicalPersistentHandle(
FunctionTemplateInfo::cast(object()->function_data(kAcquireLoad))));
} }
ObjectData* function_template_info = ObjectData* function_template_info =
data()->AsSharedFunctionInfo()->function_template_info(); data()->AsSharedFunctionInfo()->function_template_info();
...@@ -4407,8 +4355,7 @@ int SharedFunctionInfoRef::context_header_size() const { ...@@ -4407,8 +4355,7 @@ int SharedFunctionInfoRef::context_header_size() const {
ScopeInfoRef SharedFunctionInfoRef::scope_info() const { ScopeInfoRef SharedFunctionInfoRef::scope_info() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
return MakeRef(broker(), return MakeRef(broker(), object()->scope_info());
broker()->CanonicalPersistentHandle(object()->scope_info()));
} }
return ScopeInfoRef(broker(), data()->AsSharedFunctionInfo()->scope_info()); return ScopeInfoRef(broker(), data()->AsSharedFunctionInfo()->scope_info());
} }
...@@ -4487,9 +4434,7 @@ void JSTypedArrayRef::Serialize() { ...@@ -4487,9 +4434,7 @@ void JSTypedArrayRef::Serialize() {
static_assert( static_assert(
std::is_base_of<JSObject, decltype(object()->buffer())>::value, ""); std::is_base_of<JSObject, decltype(object()->buffer())>::value, "");
STATIC_ASSERT(IsSerializedRef<JSObject>()); STATIC_ASSERT(IsSerializedRef<JSObject>());
MakeRef(broker(), MakeRef<JSObject>(broker(), object()->buffer());
Handle<JSObject>::cast(
broker()->CanonicalPersistentHandle(object()->buffer())));
} else { } else {
CHECK_EQ(broker()->mode(), JSHeapBroker::kSerializing); CHECK_EQ(broker()->mode(), JSHeapBroker::kSerializing);
data()->AsJSTypedArray()->Serialize(broker()); data()->AsJSTypedArray()->Serialize(broker());
......
...@@ -142,8 +142,7 @@ void JSHeapBroker::SetTargetNativeContextRef( ...@@ -142,8 +142,7 @@ void JSHeapBroker::SetTargetNativeContextRef(
(mode() == kSerializing && (mode() == kSerializing &&
target_native_context_->object().equals(native_context) && target_native_context_->object().equals(native_context) &&
target_native_context_->is_unserialized_heap_object())); target_native_context_->is_unserialized_heap_object()));
target_native_context_ = target_native_context_ = MakeRef(this, *native_context);
MakeRef(this, CanonicalPersistentHandle(*native_context));
} }
void JSHeapBroker::CollectArrayAndObjectPrototypes() { void JSHeapBroker::CollectArrayAndObjectPrototypes() {
...@@ -712,8 +711,7 @@ ProcessedFeedback const& JSHeapBroker::ReadFeedbackForGlobalAccess( ...@@ -712,8 +711,7 @@ ProcessedFeedback const& JSHeapBroker::ReadFeedbackForGlobalAccess(
PropertyCellRef cell = PropertyCellRef cell =
MakeRef(this, Handle<PropertyCell>::cast(feedback_value)); MakeRef(this, Handle<PropertyCell>::cast(feedback_value));
MakeRef(this, MakeRef(this,
CanonicalPersistentHandle( Handle<PropertyCell>::cast(feedback_value)->value(kAcquireLoad));
Handle<PropertyCell>::cast(feedback_value)->value(kAcquireLoad)));
return *zone()->New<GlobalAccessFeedback>(cell, nexus.kind()); return *zone()->New<GlobalAccessFeedback>(cell, nexus.kind());
} }
......
...@@ -2270,10 +2270,9 @@ void SerializerForBackgroundCompilation::ProcessApiCall( ...@@ -2270,10 +2270,9 @@ void SerializerForBackgroundCompilation::ProcessApiCall(
Builtins::kCallFunctionTemplate_CheckAccessAndCompatibleReceiver}) { Builtins::kCallFunctionTemplate_CheckAccessAndCompatibleReceiver}) {
ObjectRef(broker(), broker()->isolate()->builtins()->builtin_handle(b)); ObjectRef(broker(), broker()->isolate()->builtins()->builtin_handle(b));
} }
FunctionTemplateInfoRef target_template_info = MakeRef( FunctionTemplateInfoRef target_template_info =
broker(), MakeRef(broker(),
Handle<FunctionTemplateInfo>::cast(broker()->CanonicalPersistentHandle( FunctionTemplateInfo::cast(target->function_data(kAcquireLoad)));
target->function_data(kAcquireLoad))));
if (!target_template_info.has_call_code()) return; if (!target_template_info.has_call_code()) return;
target_template_info.SerializeCallCode(); target_template_info.SerializeCallCode();
...@@ -3039,9 +3038,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess( ...@@ -3039,9 +3038,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess(
// For JSCallReducer::ReduceCallApiFunction. // For JSCallReducer::ReduceCallApiFunction.
Handle<SharedFunctionInfo> sfi = function.shared().object(); Handle<SharedFunctionInfo> sfi = function.shared().object();
if (sfi->IsApiFunction()) { if (sfi->IsApiFunction()) {
FunctionTemplateInfoRef fti_ref = MakeRef( FunctionTemplateInfoRef fti_ref =
broker(), MakeRef(broker(), sfi->get_api_func_data());
broker()->CanonicalPersistentHandle(sfi->get_api_func_data()));
if (fti_ref.has_call_code()) { if (fti_ref.has_call_code()) {
fti_ref.SerializeCallCode(); fti_ref.SerializeCallCode();
ProcessReceiverMapForApiCall(fti_ref, receiver_map->object()); ProcessReceiverMapForApiCall(fti_ref, receiver_map->object());
...@@ -3055,9 +3053,7 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess( ...@@ -3055,9 +3053,7 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess(
function.Serialize(); function.Serialize();
} else { } else {
FunctionTemplateInfoRef fti = MakeRef( FunctionTemplateInfoRef fti = MakeRef(
broker(), broker(), FunctionTemplateInfo::cast(*access_info.constant()));
Handle<FunctionTemplateInfo>::cast(
broker()->CanonicalPersistentHandle(access_info.constant())));
if (fti.has_call_code()) fti.SerializeCallCode(); if (fti.has_call_code()) fti.SerializeCallCode();
} }
} else if (access_info.IsModuleExport()) { } else if (access_info.IsModuleExport()) {
......
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