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

[compiler] Get rid of ShouldHaveBeenSerialized()

This is a simplification and cleanup.

Bug: v8:7790
Change-Id: I93a3ed2c9ddce4e300f25032be2085aef915ed8d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2874655
Auto-Submit: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74396}
parent c66b2d14
...@@ -2479,12 +2479,6 @@ bool ObjectRef::equals(const ObjectRef& other) const { ...@@ -2479,12 +2479,6 @@ bool ObjectRef::equals(const ObjectRef& other) const {
return data_->object().is_identical_to(other.data_->object()); return data_->object().is_identical_to(other.data_->object());
} }
bool ObjectRef::ShouldHaveBeenSerialized() const {
return broker()->mode() == JSHeapBroker::kSerialized &&
(data()->kind() == kSerializedHeapObject ||
data()->kind() == kBackgroundSerializedHeapObject);
}
Isolate* ObjectRef::isolate() const { return broker()->isolate(); } Isolate* ObjectRef::isolate() const { return broker()->isolate(); }
ContextRef ContextRef::previous(size_t* depth, ContextRef ContextRef::previous(size_t* depth,
...@@ -4353,12 +4347,16 @@ void JSFunctionRef::SerializeCodeAndFeedback() { ...@@ -4353,12 +4347,16 @@ void JSFunctionRef::SerializeCodeAndFeedback() {
bool JSBoundFunctionRef::serialized() const { bool JSBoundFunctionRef::serialized() const {
if (data_->should_access_heap()) return true; if (data_->should_access_heap()) return true;
return data()->AsJSBoundFunction()->serialized(); if (data_->AsJSBoundFunction()->serialized()) return true;
TRACE_BROKER_MISSING(broker(), "data for JSBoundFunction " << this);
return false;
} }
bool JSFunctionRef::serialized() const { bool JSFunctionRef::serialized() const {
if (data_->should_access_heap()) return true; if (data_->should_access_heap()) return true;
return data()->AsJSFunction()->serialized(); if (data_->AsJSFunction()->serialized()) return true;
TRACE_BROKER_MISSING(broker(), "data for JSFunction " << this);
return false;
} }
bool JSFunctionRef::serialized_code_and_feedback() const { bool JSFunctionRef::serialized_code_and_feedback() const {
...@@ -4499,13 +4497,11 @@ void JSTypedArrayRef::Serialize() { ...@@ -4499,13 +4497,11 @@ void JSTypedArrayRef::Serialize() {
} }
bool JSTypedArrayRef::serialized() const { bool JSTypedArrayRef::serialized() const {
CHECK_NE(broker()->mode(), JSHeapBroker::kDisabled); if (data_->should_access_heap()) return true;
return data()->AsJSTypedArray()->serialized(); if (broker()->is_concurrent_inlining()) return true;
} if (data_->AsJSTypedArray()->serialized()) return true;
TRACE_BROKER_MISSING(broker(), "data for JSTypedArray " << this);
bool JSTypedArrayRef::ShouldHaveBeenSerialized() const { return false;
if (broker()->is_concurrent_inlining()) return false;
return ObjectRef::ShouldHaveBeenSerialized();
} }
bool JSBoundFunctionRef::Serialize() { bool JSBoundFunctionRef::Serialize() {
......
...@@ -2715,10 +2715,7 @@ Reduction JSCallReducer::ReduceFunctionPrototypeCall(Node* node) { ...@@ -2715,10 +2715,7 @@ Reduction JSCallReducer::ReduceFunctionPrototypeCall(Node* node) {
HeapObjectMatcher m(target); HeapObjectMatcher m(target);
if (m.HasResolvedValue() && m.Ref(broker()).IsJSFunction()) { if (m.HasResolvedValue() && m.Ref(broker()).IsJSFunction()) {
JSFunctionRef function = m.Ref(broker()).AsJSFunction(); JSFunctionRef function = m.Ref(broker()).AsJSFunction();
if (function.ShouldHaveBeenSerialized() && !function.serialized()) { if (!function.serialized()) return NoChange();
TRACE_BROKER_MISSING(broker(), "Serialize call on function " << function);
return NoChange();
}
context = jsgraph()->Constant(function.context()); context = jsgraph()->Constant(function.context());
} else { } else {
context = effect = graph()->NewNode( context = effect = graph()->NewNode(
...@@ -4063,11 +4060,7 @@ bool ShouldUseCallICFeedback(Node* node) { ...@@ -4063,11 +4060,7 @@ bool ShouldUseCallICFeedback(Node* node) {
} // namespace } // namespace
bool JSCallReducer::IsBuiltinOrApiFunction(JSFunctionRef function) const { bool JSCallReducer::IsBuiltinOrApiFunction(JSFunctionRef function) const {
if (function.ShouldHaveBeenSerialized() && !function.serialized()) { if (!function.serialized()) return false;
TRACE_BROKER_MISSING(broker(), "data for function " << function);
return false;
}
// TODO(neis): Add a way to check if function template info isn't serialized // TODO(neis): Add a way to check if function template info isn't serialized
// and add a warning in such cases. Currently we can't tell if function // and add a warning in such cases. Currently we can't tell if function
// template info doesn't exist or wasn't serialized. // template info doesn't exist or wasn't serialized.
...@@ -4091,10 +4084,7 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) { ...@@ -4091,10 +4084,7 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) {
ObjectRef target_ref = m.Ref(broker()); ObjectRef target_ref = m.Ref(broker());
if (target_ref.IsJSFunction()) { if (target_ref.IsJSFunction()) {
JSFunctionRef function = target_ref.AsJSFunction(); JSFunctionRef function = target_ref.AsJSFunction();
if (function.ShouldHaveBeenSerialized() && !function.serialized()) { if (!function.serialized()) return NoChange();
TRACE_BROKER_MISSING(broker(), "data for function " << function);
return NoChange();
}
// Don't inline cross native context. // Don't inline cross native context.
if (!function.native_context().equals(native_context())) { if (!function.native_context().equals(native_context())) {
...@@ -4104,10 +4094,7 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) { ...@@ -4104,10 +4094,7 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) {
return ReduceJSCall(node, function.shared()); return ReduceJSCall(node, function.shared());
} else if (target_ref.IsJSBoundFunction()) { } else if (target_ref.IsJSBoundFunction()) {
JSBoundFunctionRef function = target_ref.AsJSBoundFunction(); JSBoundFunctionRef function = target_ref.AsJSBoundFunction();
if (function.ShouldHaveBeenSerialized() && !function.serialized()) { if (!function.serialized()) return NoChange();
TRACE_BROKER_MISSING(broker(), "data for function " << function);
return NoChange();
}
ObjectRef bound_this = function.bound_this(); ObjectRef bound_this = function.bound_this();
ConvertReceiverMode const convert_mode = ConvertReceiverMode const convert_mode =
...@@ -4752,11 +4739,7 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) { ...@@ -4752,11 +4739,7 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) {
if (target_ref.IsJSFunction()) { if (target_ref.IsJSFunction()) {
JSFunctionRef function = target_ref.AsJSFunction(); JSFunctionRef function = target_ref.AsJSFunction();
if (function.ShouldHaveBeenSerialized() && !function.serialized()) { if (!function.serialized()) return NoChange();
TRACE_BROKER_MISSING(broker(),
"function, not serialized: " << function);
return NoChange();
}
// Do not reduce constructors with break points. // Do not reduce constructors with break points.
// If this state changes during background compilation, the compilation // If this state changes during background compilation, the compilation
...@@ -4818,12 +4801,7 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) { ...@@ -4818,12 +4801,7 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) {
} }
} else if (target_ref.IsJSBoundFunction()) { } else if (target_ref.IsJSBoundFunction()) {
JSBoundFunctionRef function = target_ref.AsJSBoundFunction(); JSBoundFunctionRef function = target_ref.AsJSBoundFunction();
if (function.ShouldHaveBeenSerialized() && !function.serialized()) { if (!function.serialized()) return NoChange();
TRACE_BROKER_MISSING(broker(),
"function, not serialized: " << function);
return NoChange();
}
ObjectRef bound_target_function = function.bound_target_function(); ObjectRef bound_target_function = function.bound_target_function();
FixedArrayRef bound_arguments = function.bound_arguments(); FixedArrayRef bound_arguments = function.bound_arguments();
const int bound_arguments_length = bound_arguments.length(); const int bound_arguments_length = bound_arguments.length();
......
...@@ -627,10 +627,7 @@ Reduction JSNativeContextSpecialization::ReduceJSOrdinaryHasInstance( ...@@ -627,10 +627,7 @@ Reduction JSNativeContextSpecialization::ReduceJSOrdinaryHasInstance(
// OrdinaryHasInstance on bound functions turns into a recursive invocation // OrdinaryHasInstance on bound functions turns into a recursive invocation
// of the instanceof operator again. // of the instanceof operator again.
JSBoundFunctionRef function = m.Ref(broker()).AsJSBoundFunction(); JSBoundFunctionRef function = m.Ref(broker()).AsJSBoundFunction();
if (function.ShouldHaveBeenSerialized() && !function.serialized()) { if (!function.serialized()) return NoChange();
TRACE_BROKER_MISSING(broker(), "data for JSBoundFunction " << function);
return NoChange();
}
JSReceiverRef bound_target_function = function.bound_target_function(); JSReceiverRef bound_target_function = function.bound_target_function();
...@@ -650,10 +647,7 @@ Reduction JSNativeContextSpecialization::ReduceJSOrdinaryHasInstance( ...@@ -650,10 +647,7 @@ Reduction JSNativeContextSpecialization::ReduceJSOrdinaryHasInstance(
// Optimize if we currently know the "prototype" property. // Optimize if we currently know the "prototype" property.
JSFunctionRef function = m.Ref(broker()).AsJSFunction(); JSFunctionRef function = m.Ref(broker()).AsJSFunction();
if (function.ShouldHaveBeenSerialized() && !function.serialized()) { if (!function.serialized()) return NoChange();
TRACE_BROKER_MISSING(broker(), "data for JSFunction " << function);
return NoChange();
}
// TODO(neis): Remove the has_prototype_slot condition once the broker is // TODO(neis): Remove the has_prototype_slot condition once the broker is
// always enabled. // always enabled.
...@@ -1478,10 +1472,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) { ...@@ -1478,10 +1472,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
name.equals(ObjectRef(broker(), factory()->prototype_string()))) { name.equals(ObjectRef(broker(), factory()->prototype_string()))) {
// Optimize "prototype" property of functions. // Optimize "prototype" property of functions.
JSFunctionRef function = object.AsJSFunction(); JSFunctionRef function = object.AsJSFunction();
if (function.ShouldHaveBeenSerialized() && !function.serialized()) { if (!function.serialized()) return NoChange();
TRACE_BROKER_MISSING(broker(), "data for function " << function);
return NoChange();
}
// TODO(neis): Remove the has_prototype_slot condition once the broker is // TODO(neis): Remove the has_prototype_slot condition once the broker is
// always enabled. // always enabled.
if (!function.map().has_prototype_slot() || !function.has_prototype() || if (!function.map().has_prototype_slot() || !function.has_prototype() ||
...@@ -1790,12 +1781,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -1790,12 +1781,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
if (!IsTypedArrayElementsKind(access_info.elements_kind())) continue; if (!IsTypedArrayElementsKind(access_info.elements_kind())) continue;
base::Optional<JSTypedArrayRef> typed_array = base::Optional<JSTypedArrayRef> typed_array =
GetTypedArrayConstant(broker(), receiver); GetTypedArrayConstant(broker(), receiver);
if (typed_array.has_value()) { if (typed_array.has_value() && !typed_array->serialized()) {
if (typed_array->ShouldHaveBeenSerialized() && return NoChange();
!typed_array->serialized()) {
TRACE_BROKER_MISSING(broker(), "data for typed array " << *typed_array);
return NoChange();
}
} }
} }
......
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