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