[runtime] Prepare for inlining CallHandlerInfo into FunctionTemplateInfo

... which will allow to remove one indirection when calling Api
functions.

This CL
 - introduces custom visitor for FunctionTemplateInfo,
 - stores flags, length and instance type values as raw data and
   packs length and instance type into 32-bits value,
 - stores FunctionTemplateInfo instead of CallHandlerInfo as an
   instance call handler for callable ObjectTemplates.

The latter comes with a memory overhead because FunctionTemplateInfo is
bigger than CallHandlerInfo but it's ok since callable ObjectTemplates
are rarely used in practice. It also temporarily adds an additional
indirection when calling callable Api objects until the CallHandlerInfo
is inlined into FunctionTemplateInfo.

Bug: chromium:326505377
Change-Id: I0a6645f228f413ff5412403e05aee1dfceb65966
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5329250
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92597}
This commit is contained in:
Igor Sheludko authored and V8 LUCI CQ committed 2024-02-29 09:09:56 +00:00
1 parent e50ab13bbf
commit 4ff2d3237e
16 files changed
+137 -81

No files matched your search

+11 -9
View File
@@ -1870,15 +1870,17 @@ void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback,
i::HandleScope scope(i_isolate);
auto cons = EnsureConstructor(i_isolate, this);
EnsureNotPublished(cons, "v8::ObjectTemplate::SetCallAsFunctionHandler");
i::Handle<i::CallHandlerInfo> obj =
i_isolate->factory()->NewCallHandlerInfo();
obj->set_owner_template(*Utils::OpenDirectHandle(this));
obj->set_callback(i_isolate, reinterpret_cast<i::Address>(callback));
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(i_isolate));
}
obj->set_data(*Utils::OpenDirectHandle(*data));
i::FunctionTemplateInfo::SetInstanceCallHandler(i_isolate, cons, obj);
DCHECK_NOT_NULL(callback);
// This template is just a container for callback and data values and thus
// it's not supposed to be instantiated. Don't cache it.
constexpr bool do_not_cache = true;
constexpr int length = 0;
i::Handle<i::FunctionTemplateInfo> templ =
i_isolate->factory()->NewFunctionTemplateInfo(length, do_not_cache);
templ->set_is_object_template_call_handler(true);
Utils::ToLocal(templ)->SetCallHandler(callback, data);
i::FunctionTemplateInfo::SetInstanceCallHandler(i_isolate, cons, templ);
}
int ObjectTemplate::InternalFieldCount() const {
+5
View File
@@ -236,6 +236,11 @@ HandleApiCallAsFunctionOrConstructorDelegate(Isolate* isolate,
Tagged<Object> handler =
constructor->shared()->api_func_data()->GetInstanceCallHandler();
DCHECK(!IsUndefined(handler, isolate));
Tagged<FunctionTemplateInfo> templ = FunctionTemplateInfo::cast(handler);
DCHECK(templ->is_object_template_call_handler());
// TODO(chromium:326505377): inline CallHandlerInfo into FunctionTemplateInfo.
handler = templ->call_code(kAcquireLoad);
DCHECK(!IsUndefined(handler, isolate));
Tagged<CallHandlerInfo> call_data = CallHandlerInfo::cast(handler);
// Get the data for the call and perform the callback.
+2 -3
View File
@@ -717,9 +717,8 @@ void CallOrConstructBuiltinsAssembler::CallFunctionTemplate(
GotoIfNot(IsSetWord32<Map::Bits1::IsAccessCheckNeededBit>(
LoadMapBitField(receiver_map)),
&receiver_done);
TNode<Int32T> function_template_info_flags =
LoadAndUntagToWord32ObjectField(function_template_info,
FunctionTemplateInfo::kFlagOffset);
TNode<Uint32T> function_template_info_flags = LoadObjectField<Uint32T>(
function_template_info, FunctionTemplateInfo::kFlagOffset);
Branch(IsSetWord32<FunctionTemplateInfo::AcceptAnyReceiverBit>(
function_template_info_flags),
&receiver_done, &receiver_needs_access_check);
+1
View File
@@ -62,6 +62,7 @@ inline bool ContainsReadOnlyMap(PtrComprCageBase, Tagged<HeapObject>) {
V(FeedbackVector) \
V(FixedArray) \
V(FixedDoubleArray) \
V(FunctionTemplateInfo) \
V(InstructionStream) \
V(PreparseData) \
V(PropertyArray) \
+1
View File
@@ -40,6 +40,7 @@ namespace internal {
V(ExternalString) \
V(FeedbackCell) \
V(FeedbackMetadata) \
V(FunctionTemplateInfo) \
V(Hole) \
V(JSArrayBuffer) \
V(JSDataViewOrRabGsabDataView) \
-2
View File
@@ -286,8 +286,6 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
V(_, FreeSpaceMap, free_space_map, FreeSpace) \
V(_, FeedbackVectorMap, feedback_vector_map, FeedbackVector) \
V(_, FixedDoubleArrayMap, fixed_double_array_map, FixedDoubleArray) \
V(_, FunctionTemplateInfoMap, function_template_info_map, \
FunctionTemplateInfo) \
V(_, InterpreterDataMap, interpreter_data_map, InterpreterData) \
V(_, MegaDomHandlerMap, mega_dom_handler_map, MegaDomHandler) \
V(_, PreparseDataMap, preparse_data_map, PreparseData) \
+8
View File
@@ -176,9 +176,15 @@ VisitorId Map::GetVisitorId(Tagged<Map> map) {
case ACCESSOR_INFO_TYPE:
return kVisitAccessorInfo;
case FUNCTION_TEMPLATE_INFO_TYPE:
return kVisitFunctionTemplateInfo;
case CALL_HANDLER_INFO_TYPE:
return kVisitCallHandlerInfo;
case OBJECT_TEMPLATE_INFO_TYPE:
return kVisitStruct;
case JS_PROXY_TYPE:
return kVisitStruct;
@@ -349,6 +355,8 @@ VisitorId Map::GetVisitorId(Tagged<Map> map) {
#define MAKE_STRUCT_CASE(TYPE, Name, name) case TYPE:
STRUCT_LIST(MAKE_STRUCT_CASE)
#undef MAKE_STRUCT_CASE
// TODO(ishell): given that the following objects have custom visitors
// don't define them as Structs.
if (instance_type == PROMISE_ON_STACK_TYPE) {
return kVisitPromiseOnStack;
}
+1
View File
@@ -54,6 +54,7 @@ enum InstanceType : uint16_t;
V(ExternalString) \
V(FeedbackCell) \
V(FreeSpace) \
V(FunctionTemplateInfo) \
V(Hole) \
V(JSApiObject) \
V(JSArrayBuffer) \
+3 -1
View File
@@ -112,7 +112,6 @@ namespace internal {
V(CallHandlerInfo) \
V(Callable) \
V(Cell) \
V(DictionaryTemplateInfo) \
V(CompilationCacheTable) \
V(ConsString) \
V(Constructor) \
@@ -123,6 +122,7 @@ namespace internal {
V(DeoptimizationData) \
V(DependentCode) \
V(DescriptorArray) \
V(DictionaryTemplateInfo) \
V(EmbedderDataArray) \
V(EphemeronHashTable) \
V(ExternalOneByteString) \
@@ -131,6 +131,7 @@ namespace internal {
V(FeedbackCell) \
V(FeedbackMetadata) \
V(FeedbackVector) \
V(FunctionTemplateInfo) \
V(Filler) \
V(FixedArrayBase) \
V(FixedArrayExact) \
@@ -227,6 +228,7 @@ namespace internal {
V(NumberWrapper) \
V(ObjectHashSet) \
V(ObjectHashTable) \
V(ObjectTemplateInfo) \
V(ObjectTwoHashTable) \
V(Oddball) \
V(Hole) \
@@ -1383,6 +1383,10 @@ auto BodyDescriptorApply(InstanceType type, Args&&... args) {
return CALL_APPLY(AccessorInfo);
case CALL_HANDLER_INFO_TYPE:
return CALL_APPLY(CallHandlerInfo);
case FUNCTION_TEMPLATE_INFO_TYPE:
return CALL_APPLY(FunctionTemplateInfo);
case OBJECT_TEMPLATE_INFO_TYPE:
return CALL_APPLY(ObjectTemplateInfo);
case LOAD_HANDLER_TYPE:
return CALL_APPLY(LoadHandler);
case STORE_HANDLER_TYPE:
@@ -1522,6 +1526,20 @@ class AccessorInfo::BodyDescriptor final : public BodyDescriptorBase {
}
};
class FunctionTemplateInfo::BodyDescriptor final : public BodyDescriptorBase {
public:
template <typename ObjectVisitor>
static inline void IterateBody(Tagged<Map> map, Tagged<HeapObject> obj,
int object_size, ObjectVisitor* v) {
IteratePointers(obj, HeapObject::kHeaderSize,
FunctionTemplateInfo::kEndOfStrongFieldsOffset, v);
}
static inline int SizeOf(Tagged<Map> map, Tagged<HeapObject> object) {
return kSize;
}
};
class CallHandlerInfo::BodyDescriptor final : public BodyDescriptorBase {
public:
static_assert(CallHandlerInfo::kEndOfStrongFieldsOffset ==
-3
View File
@@ -138,9 +138,6 @@ namespace internal {
V(_, CALLBACK_TASK_TYPE, CallbackTask, callback_task) \
V(_, PROMISE_RESOLVE_THENABLE_JOB_TASK_TYPE, PromiseResolveThenableJobTask, \
promise_resolve_thenable_job_task) \
V(_, FUNCTION_TEMPLATE_INFO_TYPE, FunctionTemplateInfo, \
function_template_info) \
V(_, OBJECT_TEMPLATE_INFO_TYPE, ObjectTemplateInfo, object_template_info) \
V(_, ACCESS_CHECK_INFO_TYPE, AccessCheckInfo, access_check_info) \
V(_, ACCESSOR_PAIR_TYPE, AccessorPair, accessor_pair) \
V(_, ALIASED_ARGUMENTS_ENTRY_TYPE, AliasedArgumentsEntry, \
+8 -1
View File
@@ -28,6 +28,9 @@ TQ_OBJECT_CONSTRUCTORS_IMPL(DictionaryTemplateInfo)
NEVER_READ_ONLY_SPACE_IMPL(DictionaryTemplateInfo)
NEVER_READ_ONLY_SPACE_IMPL(ObjectTemplateInfo)
BOOL_ACCESSORS(FunctionTemplateInfo, relaxed_flag,
is_object_template_call_handler,
IsObjectTemplateCallHandlerBit::kShift)
BOOL_ACCESSORS(FunctionTemplateInfo, relaxed_flag, undetectable,
UndetectableBit::kShift)
BOOL_ACCESSORS(FunctionTemplateInfo, relaxed_flag, needs_access_check,
@@ -50,6 +53,9 @@ BIT_FIELD_ACCESSORS(
allowed_receiver_instance_type_range_end,
FunctionTemplateInfo::AllowedReceiverInstanceTypeRangeEndBits)
RELAXED_UINT32_ACCESSORS(FunctionTemplateInfo, flag,
FunctionTemplateInfo::kFlagOffset)
int32_t FunctionTemplateInfo::relaxed_flag() const {
return flag(kRelaxedLoad);
}
@@ -119,7 +125,8 @@ void FunctionTemplateInfo::SetInstanceType(int api_instance_type) {
// kNoJSApiObjectType must correspond to JS_API_OBJECT_TYPE.
static_assert(kNoJSApiObjectType == 0);
static_assert(JS_API_OBJECT_TYPE == Internals::kFirstJSApiObjectType);
set_instance_type(api_instance_type + Internals::kFirstJSApiObjectType);
set_instance_type(static_cast<InstanceType>(
api_instance_type + Internals::kFirstJSApiObjectType));
}
void FunctionTemplateInfo::SetAllowedReceiverInstanceTypeRange(
+12 -5
View File
@@ -25,7 +25,8 @@ namespace internal {
#include "torque-generated/src/objects/templates-tq.inc"
class TemplateInfo : public TorqueGeneratedTemplateInfo<TemplateInfo, Struct> {
class TemplateInfo
: public TorqueGeneratedTemplateInfo<TemplateInfo, HeapObject> {
public:
static const int kFastTemplateInstantiationsCacheSize = 1 * KB;
@@ -102,7 +103,7 @@ class FunctionTemplateInfo
// upon first instantiation if it's Undefined.
DECL_RARE_ACCESSORS(instance_template, InstanceTemplate, HeapObject)
// Either a CallHandlerInfo or Undefined. If an instance_call_handler is
// Either a FunctionTemplateInfo or Undefined. If an instance_call_handler is
// provided the instances created from the associated JSFunction are marked as
// callable.
DECL_RARE_ACCESSORS(instance_call_handler, InstanceCallHandler, HeapObject)
@@ -112,11 +113,17 @@ class FunctionTemplateInfo
DECL_RARE_ACCESSORS(c_function_overloads, CFunctionOverloads, FixedArray)
#undef DECL_RARE_ACCESSORS
DECL_RELAXED_UINT32_ACCESSORS(flag)
// Begin flag bits ---------------------
// This FunctionTemplateInfo is just a storage for callback function and
// callback data for a callable ObjectTemplate object.
DECL_BOOLEAN_ACCESSORS(is_object_template_call_handler)
DECL_BOOLEAN_ACCESSORS(undetectable)
// If set, object instances created by this function
// requires access check.
// If set, object instances created by this function requires access check.
DECL_BOOLEAN_ACCESSORS(needs_access_check)
DECL_BOOLEAN_ACCESSORS(read_only_prototype)
@@ -190,7 +197,7 @@ class FunctionTemplateInfo
// Bit position in the flag, from least significant bit position.
DEFINE_TORQUE_GENERATED_FUNCTION_TEMPLATE_INFO_FLAGS()
using BodyDescriptor = StructBodyDescriptor;
class BodyDescriptor;
private:
// For ease of use of the BITFIELD macro.
+11 -7
View File
@@ -3,7 +3,7 @@
// found in the LICENSE file.
@abstract
extern class TemplateInfo extends Struct {
extern class TemplateInfo extends HeapObject {
serial_number: Smi;
number_of_properties: Smi;
property_list: ArrayList|Undefined;
@@ -18,12 +18,15 @@ extern class FunctionTemplateRareData extends Struct {
named_property_handler: InterceptorInfo|Undefined;
indexed_property_handler: InterceptorInfo|Undefined;
instance_template: ObjectTemplateInfo|Undefined;
instance_call_handler: CallHandlerInfo|Undefined;
instance_call_handler: FunctionTemplateInfo|Undefined;
access_check_info: AccessCheckInfo|Undefined;
c_function_overloads: FixedArray;
}
bitfield struct FunctionTemplateInfoFlags extends uint31 {
bitfield struct FunctionTemplateInfoFlags extends uint32 {
// True in case this FunctionTemplateInfo object is used as a call handler
// for callable ObjectTemplateInfo.
is_object_template_call_handler: bool: 1 bit;
undetectable: bool: 1 bit;
needs_access_check: bool: 1 bit;
read_only_prototype: bool: 1 bit;
@@ -37,6 +40,7 @@ bitfield struct FunctionTemplateInfoFlags extends uint31 {
allowed_receiver_instance_type_range_end: InstanceType: 12 bit;
}
@generateUniqueMap
extern class FunctionTemplateInfo extends TemplateInfo {
// Handler invoked when calling an instance of this FunctionTemplateInfo.
// Either CallHandlerInfo or Undefined.
@@ -58,14 +62,13 @@ extern class FunctionTemplateInfo extends TemplateInfo {
// the receiver under the the cached_property_name when this
// FunctionTemplateInfo is used as a getter.
cached_property_name: Object;
// TODO(ishell): store the values below as raw data.
// Internal field to store a flag bitfield.
@cppRelaxedLoad @cppRelaxedStore flag: SmiTagged<FunctionTemplateInfoFlags>;
flag: FunctionTemplateInfoFlags;
// "length" property of the final JSFunction.
length: Smi;
length: int16;
// This will be set as the instance type of the objects that are created from
// this FunctionTemplateInfo.
instance_type: Smi;
instance_type: InstanceType;
}
bitfield struct ObjectTemplateInfoFlags extends uint31 {
@@ -74,6 +77,7 @@ bitfield struct ObjectTemplateInfoFlags extends uint31 {
embedder_field_count: int32: 28 bit;
}
@generateUniqueMap
extern class ObjectTemplateInfo extends TemplateInfo {
constructor: FunctionTemplateInfo|Undefined;
data: SmiTagged<ObjectTemplateInfoFlags>;
+49 -49
View File
@@ -148,54 +148,54 @@ struct StaticReadOnlyRoot {
static constexpr Tagged_t kCallableTaskMap = 0xf6d;
static constexpr Tagged_t kCallbackTaskMap = 0xf95;
static constexpr Tagged_t kPromiseResolveThenableJobTaskMap = 0xfbd;
static constexpr Tagged_t kFunctionTemplateInfoMap = 0xfe5;
static constexpr Tagged_t kObjectTemplateInfoMap = 0x100d;
static constexpr Tagged_t kAccessCheckInfoMap = 0x1035;
static constexpr Tagged_t kAccessorPairMap = 0x105d;
static constexpr Tagged_t kAliasedArgumentsEntryMap = 0x1085;
static constexpr Tagged_t kAllocationMementoMap = 0x10ad;
static constexpr Tagged_t kArrayBoilerplateDescriptionMap = 0x10d5;
static constexpr Tagged_t kAsmWasmDataMap = 0x10fd;
static constexpr Tagged_t kAsyncGeneratorRequestMap = 0x1125;
static constexpr Tagged_t kBreakPointMap = 0x114d;
static constexpr Tagged_t kBreakPointInfoMap = 0x1175;
static constexpr Tagged_t kBytecodeWrapperMap = 0x119d;
static constexpr Tagged_t kClassBoilerplateMap = 0x11c5;
static constexpr Tagged_t kClassPositionsMap = 0x11ed;
static constexpr Tagged_t kCodeWrapperMap = 0x1215;
static constexpr Tagged_t kDebugInfoMap = 0x123d;
static constexpr Tagged_t kErrorStackDataMap = 0x1265;
static constexpr Tagged_t kFunctionTemplateRareDataMap = 0x128d;
static constexpr Tagged_t kInterceptorInfoMap = 0x12b5;
static constexpr Tagged_t kModuleRequestMap = 0x12dd;
static constexpr Tagged_t kPromiseCapabilityMap = 0x1305;
static constexpr Tagged_t kPromiseOnStackMap = 0x132d;
static constexpr Tagged_t kPromiseReactionMap = 0x1355;
static constexpr Tagged_t kPropertyDescriptorObjectMap = 0x137d;
static constexpr Tagged_t kPrototypeInfoMap = 0x13a5;
static constexpr Tagged_t kRegExpBoilerplateDescriptionMap = 0x13cd;
static constexpr Tagged_t kScriptMap = 0x13f5;
static constexpr Tagged_t kScriptOrModuleMap = 0x141d;
static constexpr Tagged_t kSourceTextModuleInfoEntryMap = 0x1445;
static constexpr Tagged_t kStackFrameInfoMap = 0x146d;
static constexpr Tagged_t kTemplateObjectDescriptionMap = 0x1495;
static constexpr Tagged_t kTuple2Map = 0x14bd;
static constexpr Tagged_t kWasmExceptionTagMap = 0x14e5;
static constexpr Tagged_t kAllocationSiteWithWeakNextMap = 0x150d;
static constexpr Tagged_t kAllocationSiteWithoutWeakNextMap = 0x1535;
static constexpr Tagged_t kLoadHandler1Map = 0x155d;
static constexpr Tagged_t kLoadHandler2Map = 0x1585;
static constexpr Tagged_t kLoadHandler3Map = 0x15ad;
static constexpr Tagged_t kStoreHandler0Map = 0x15d5;
static constexpr Tagged_t kStoreHandler1Map = 0x15fd;
static constexpr Tagged_t kStoreHandler2Map = 0x1625;
static constexpr Tagged_t kStoreHandler3Map = 0x164d;
static constexpr Tagged_t kUncompiledDataWithoutPreparseDataMap = 0x1675;
static constexpr Tagged_t kUncompiledDataWithPreparseDataMap = 0x169d;
static constexpr Tagged_t kAccessCheckInfoMap = 0xfe5;
static constexpr Tagged_t kAccessorPairMap = 0x100d;
static constexpr Tagged_t kAliasedArgumentsEntryMap = 0x1035;
static constexpr Tagged_t kAllocationMementoMap = 0x105d;
static constexpr Tagged_t kArrayBoilerplateDescriptionMap = 0x1085;
static constexpr Tagged_t kAsmWasmDataMap = 0x10ad;
static constexpr Tagged_t kAsyncGeneratorRequestMap = 0x10d5;
static constexpr Tagged_t kBreakPointMap = 0x10fd;
static constexpr Tagged_t kBreakPointInfoMap = 0x1125;
static constexpr Tagged_t kBytecodeWrapperMap = 0x114d;
static constexpr Tagged_t kClassBoilerplateMap = 0x1175;
static constexpr Tagged_t kClassPositionsMap = 0x119d;
static constexpr Tagged_t kCodeWrapperMap = 0x11c5;
static constexpr Tagged_t kDebugInfoMap = 0x11ed;
static constexpr Tagged_t kErrorStackDataMap = 0x1215;
static constexpr Tagged_t kFunctionTemplateRareDataMap = 0x123d;
static constexpr Tagged_t kInterceptorInfoMap = 0x1265;
static constexpr Tagged_t kModuleRequestMap = 0x128d;
static constexpr Tagged_t kPromiseCapabilityMap = 0x12b5;
static constexpr Tagged_t kPromiseOnStackMap = 0x12dd;
static constexpr Tagged_t kPromiseReactionMap = 0x1305;
static constexpr Tagged_t kPropertyDescriptorObjectMap = 0x132d;
static constexpr Tagged_t kPrototypeInfoMap = 0x1355;
static constexpr Tagged_t kRegExpBoilerplateDescriptionMap = 0x137d;
static constexpr Tagged_t kScriptMap = 0x13a5;
static constexpr Tagged_t kScriptOrModuleMap = 0x13cd;
static constexpr Tagged_t kSourceTextModuleInfoEntryMap = 0x13f5;
static constexpr Tagged_t kStackFrameInfoMap = 0x141d;
static constexpr Tagged_t kTemplateObjectDescriptionMap = 0x1445;
static constexpr Tagged_t kTuple2Map = 0x146d;
static constexpr Tagged_t kWasmExceptionTagMap = 0x1495;
static constexpr Tagged_t kAllocationSiteWithWeakNextMap = 0x14bd;
static constexpr Tagged_t kAllocationSiteWithoutWeakNextMap = 0x14e5;
static constexpr Tagged_t kLoadHandler1Map = 0x150d;
static constexpr Tagged_t kLoadHandler2Map = 0x1535;
static constexpr Tagged_t kLoadHandler3Map = 0x155d;
static constexpr Tagged_t kStoreHandler0Map = 0x1585;
static constexpr Tagged_t kStoreHandler1Map = 0x15ad;
static constexpr Tagged_t kStoreHandler2Map = 0x15d5;
static constexpr Tagged_t kStoreHandler3Map = 0x15fd;
static constexpr Tagged_t kUncompiledDataWithoutPreparseDataMap = 0x1625;
static constexpr Tagged_t kUncompiledDataWithPreparseDataMap = 0x164d;
static constexpr Tagged_t kUncompiledDataWithoutPreparseDataWithJobMap =
0x16c5;
static constexpr Tagged_t kUncompiledDataWithPreparseDataAndJobMap = 0x16ed;
static constexpr Tagged_t kOnHeapBasicBlockProfilerDataMap = 0x1715;
0x1675;
static constexpr Tagged_t kUncompiledDataWithPreparseDataAndJobMap = 0x169d;
static constexpr Tagged_t kOnHeapBasicBlockProfilerDataMap = 0x16c5;
static constexpr Tagged_t kFunctionTemplateInfoMap = 0x16ed;
static constexpr Tagged_t kObjectTemplateInfoMap = 0x1715;
static constexpr Tagged_t kTurbofanBitsetTypeMap = 0x173d;
static constexpr Tagged_t kTurbofanUnionTypeMap = 0x1765;
static constexpr Tagged_t kTurbofanRangeTypeMap = 0x178d;
@@ -1464,8 +1464,6 @@ static constexpr std::array<Tagged_t, 760> StaticReadOnlyRootsPointerTable = {
StaticReadOnlyRoot::kCallableTaskMap,
StaticReadOnlyRoot::kCallbackTaskMap,
StaticReadOnlyRoot::kPromiseResolveThenableJobTaskMap,
StaticReadOnlyRoot::kFunctionTemplateInfoMap,
StaticReadOnlyRoot::kObjectTemplateInfoMap,
StaticReadOnlyRoot::kAccessCheckInfoMap,
StaticReadOnlyRoot::kAccessorPairMap,
StaticReadOnlyRoot::kAliasedArgumentsEntryMap,
@@ -1507,6 +1505,8 @@ static constexpr std::array<Tagged_t, 760> StaticReadOnlyRootsPointerTable = {
StaticReadOnlyRoot::kUncompiledDataWithoutPreparseDataWithJobMap,
StaticReadOnlyRoot::kUncompiledDataWithPreparseDataAndJobMap,
StaticReadOnlyRoot::kOnHeapBasicBlockProfilerDataMap,
StaticReadOnlyRoot::kFunctionTemplateInfoMap,
StaticReadOnlyRoot::kObjectTemplateInfoMap,
StaticReadOnlyRoot::kTurbofanBitsetTypeMap,
StaticReadOnlyRoot::kTurbofanUnionTypeMap,
StaticReadOnlyRoot::kTurbofanRangeTypeMap,
+7 -1
View File
@@ -56,6 +56,7 @@
#include "src/base/platform/platform.h"
#include "src/base/strings.h"
#include "src/codegen/compilation-cache.h"
#include "src/common/globals.h"
#include "src/compiler/globals.h"
#include "src/execution/execution.h"
#include "src/execution/futex-emulation.h"
@@ -12720,8 +12721,13 @@ TEST(CallHandlerAsFunctionHasNoSideEffectNotSupported) {
i::Tagged<i::FunctionTemplateInfo> cons = i::FunctionTemplateInfo::cast(
v8::Utils::OpenDirectHandle(*templ)->constructor());
i::Heap* heap = reinterpret_cast<i::Isolate*>(isolate)->heap();
i::Tagged<i::FunctionTemplateInfo> handler =
i::FunctionTemplateInfo::cast(cons->GetInstanceCallHandler());
CHECK(handler->is_object_template_call_handler());
i::Tagged<i::CallHandlerInfo> handler_info =
i::CallHandlerInfo::cast(cons->GetInstanceCallHandler());
i::CallHandlerInfo::cast(handler->call_code(v8::kAcquireLoad));
CHECK(!handler_info->IsSideEffectFreeCallHandlerInfo());
handler_info->set_map(
i::ReadOnlyRoots(heap).side_effect_free_call_handler_info_map());