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

[compiler] Simplify FunctionTemplateInfoRef

... by removing some obsolete code.

Bug: v8:7790
Change-Id: Ie098055a1849de5d853c126e0c7275164f964ce8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3124774
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76575}
parent 7a3cc81d
......@@ -2259,33 +2259,16 @@ bool FunctionTemplateInfoRef::is_signature_undefined() const {
return object()->signature().IsUndefined(broker()->isolate());
}
bool FunctionTemplateInfoRef::has_call_code() const {
HeapObject call_code = object()->call_code(kAcquireLoad);
return !call_code.IsUndefined();
}
HEAP_ACCESSOR_C(FunctionTemplateInfo, bool, accept_any_receiver)
HolderLookupResult FunctionTemplateInfoRef::LookupHolderOfExpectedType(
MapRef receiver_map, SerializationPolicy policy) {
MapRef receiver_map) {
const HolderLookupResult not_found;
// There are currently two ways we can see a FunctionTemplateInfo on the
// background thread: 1.) As part of a SharedFunctionInfo and 2.) in an
// AccessorPair. In both cases, the FTI is fully constructed on the main
// thread before.
// TODO(nicohartmann@, v8:7790): Once the above no longer holds, we might
// have to use the GC predicate to check whether objects are fully
// initialized and safe to read.
if (!receiver_map.IsJSReceiverMap() ||
(receiver_map.is_access_check_needed() &&
!object()->accept_any_receiver())) {
if (!receiver_map.IsJSObjectMap() || (receiver_map.is_access_check_needed() &&
!object()->accept_any_receiver())) {
return not_found;
}
if (!receiver_map.IsJSObjectMap()) return not_found;
DCHECK(has_call_code());
Handle<FunctionTemplateInfo> expected_receiver_type;
{
DisallowGarbageCollection no_gc;
......@@ -2298,17 +2281,11 @@ HolderLookupResult FunctionTemplateInfoRef::LookupHolderOfExpectedType(
if (expected_receiver_type->IsTemplateFor(*receiver_map.object())) {
return HolderLookupResult(CallOptimization::kHolderIsReceiver);
}
if (!receiver_map.IsJSGlobalProxyMap()) return not_found;
}
if (policy == SerializationPolicy::kSerializeIfNeeded) {
receiver_map.SerializePrototype(NotConcurrentInliningTag{broker()});
}
base::Optional<HeapObjectRef> prototype = receiver_map.prototype();
if (!prototype.has_value()) return not_found;
if (prototype->IsNull()) return not_found;
if (!prototype.has_value() || prototype->IsNull()) return not_found;
if (!expected_receiver_type->IsTemplateFor(prototype->object()->map())) {
return not_found;
}
......@@ -3110,18 +3087,6 @@ bool PropertyCellRef::Cache() const {
return data()->AsPropertyCell()->Cache(broker());
}
void FunctionTemplateInfoRef::SerializeCallCode(NotConcurrentInliningTag tag) {
CHECK_EQ(broker()->mode(), JSHeapBroker::kSerializing);
// CallHandlerInfo::data may still hold a serialized heap object, so we
// have to make the broker aware of it.
// TODO(v8:7790): Remove this case once ObjectRef is never serialized.
Handle<HeapObject> call_code(object()->call_code(kAcquireLoad),
broker()->isolate());
if (call_code->IsCallHandlerInfo()) {
broker()->GetOrCreateData(Handle<CallHandlerInfo>::cast(call_code)->data());
}
}
bool NativeContextRef::GlobalIsDetached() const {
base::Optional<ObjectRef> proxy_proto =
global_proxy_object().map().prototype();
......
......@@ -776,17 +776,10 @@ class FunctionTemplateInfoRef : public HeapObjectRef {
bool is_signature_undefined() const;
bool accept_any_receiver() const;
// The following returns true if the CallHandlerInfo is present.
bool has_call_code() const;
void SerializeCallCode(NotConcurrentInliningTag tag);
base::Optional<CallHandlerInfoRef> call_code() const;
ZoneVector<Address> c_functions() const;
ZoneVector<const CFunctionInfo*> c_signatures() const;
HolderLookupResult LookupHolderOfExpectedType(
MapRef receiver_map,
SerializationPolicy policy = SerializationPolicy::kAssumeSerialized);
HolderLookupResult LookupHolderOfExpectedType(MapRef receiver_map);
};
class FixedArrayBaseRef : public HeapObjectRef {
......
......@@ -3638,8 +3638,6 @@ Reduction JSCallReducer::ReduceCallApiFunction(
FunctionTemplateInfoRef function_template_info(
shared.function_template_info().value());
if (!function_template_info.has_call_code()) return NoChange();
if (function_template_info.accept_any_receiver() &&
function_template_info.is_signature_undefined()) {
// We might be able to
......
......@@ -2255,10 +2255,6 @@ void JSNativeContextSpecialization::InlinePropertySetterCall(
Node* JSNativeContextSpecialization::InlineApiCall(
Node* receiver, Node* holder, Node* frame_state, Node* value, Node** effect,
Node** control, FunctionTemplateInfoRef const& function_template_info) {
if (!function_template_info.has_call_code()) {
return nullptr;
}
if (!function_template_info.call_code().has_value()) {
TRACE_BROKER_MISSING(broker(), "call code for function template info "
<< function_template_info);
......
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