Commit e12ffa65 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[compiler] Simplify JSHeapBroker::TryGetOrCreateData uses

Make the crash_on_error parameter false by default, so that the typical
use is easier to read:
Use GetOrCreateData(obj) if you expect the object to be known already.
Use TryGetOrCreateData(obj) if you don't.

Bug: v8:7790
Change-Id: I5732ad13ec582c2a1112032f88be54c833906a6a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2658327
Auto-Submit: Georg Neis <neis@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72461}
parent 0215b572
...@@ -3627,7 +3627,7 @@ base::Optional<FeedbackVectorRef> FeedbackCellRef::value() const { ...@@ -3627,7 +3627,7 @@ base::Optional<FeedbackVectorRef> FeedbackCellRef::value() const {
Object value = object()->value(kAcquireLoad); Object value = object()->value(kAcquireLoad);
if (!value.IsFeedbackVector()) return base::nullopt; if (!value.IsFeedbackVector()) return base::nullopt;
auto vector_handle = broker()->CanonicalPersistentHandle(value); auto vector_handle = broker()->CanonicalPersistentHandle(value);
ObjectData* vector = broker()->TryGetOrCreateData(vector_handle, false); ObjectData* vector = broker()->TryGetOrCreateData(vector_handle);
if (vector) { if (vector) {
return FeedbackVectorRef(broker(), vector); return FeedbackVectorRef(broker(), vector);
} }
...@@ -4299,10 +4299,9 @@ base::Optional<FunctionTemplateInfoRef> ...@@ -4299,10 +4299,9 @@ 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()) { if (object()->IsApiFunction()) {
ObjectData* data = broker()->TryGetOrCreateData( ObjectData* data =
broker()->CanonicalPersistentHandle( broker()->TryGetOrCreateData(broker()->CanonicalPersistentHandle(
object()->function_data(kAcquireLoad)), object()->function_data(kAcquireLoad)));
false);
if (data == nullptr) return base::nullopt; if (data == nullptr) return base::nullopt;
return FunctionTemplateInfoRef(broker(), data, true); return FunctionTemplateInfoRef(broker(), data, true);
} }
......
...@@ -161,7 +161,7 @@ class V8_EXPORT_PRIVATE JSHeapBroker { ...@@ -161,7 +161,7 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
// Gets data only if we have it. However, thin wrappers will be created for // Gets data only if we have it. However, thin wrappers will be created for
// smis, read-only objects and never-serialized objects. // smis, read-only objects and never-serialized objects.
ObjectData* TryGetOrCreateData( ObjectData* TryGetOrCreateData(
Handle<Object>, bool crash_on_error, Handle<Object>, bool crash_on_error = false,
ObjectRef::BackgroundSerialization background_serialization = ObjectRef::BackgroundSerialization background_serialization =
ObjectRef::BackgroundSerialization::kDisallowed); ObjectRef::BackgroundSerialization::kDisallowed);
......
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