[buildins] Use ACCESSOR_GETTER_LIST to expose accessor getters
Add a new ACCESSOR_GETTER_LIST macro to define all the accesor getters and allow using non statically known accessor names. This allows exposing the ModuleNamespaceEntryGetter to the external-reference-table Change-Id: I40700e2cd19bc58ba55569c7b1e6fc34357bd80f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3856924 Reviewed-by: Igor Sheludko <ishell@chromium.org> Commit-Queue: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/main@{#82764}
This commit is contained in:
parent
fc6b16d17c
commit
c37badf3b1
1
AUTHORS
1
AUTHORS
@ -117,6 +117,7 @@ Gao Sheng <gaosheng08@meituan.com>
|
||||
Geoffrey Garside <ggarside@gmail.com>
|
||||
Gergely Nagy <ngg@ngg.hu>
|
||||
Gilang Mentari Hamidy <gilang@hamidy.net>
|
||||
Giovanny Gutierrez <giovannygutierrez@gmail.com>
|
||||
Gus Caplan <me@gus.host>
|
||||
Gwang Yoon Hwang <ryumiel@company100.net>
|
||||
Haichuan Wang <hc.opensource@gmail.com>
|
||||
|
@ -55,6 +55,8 @@ class JavaScriptFrame;
|
||||
V(_, wrapped_function_name, WrappedFunctionName, kHasNoSideEffect, \
|
||||
kHasSideEffectToReceiver)
|
||||
|
||||
#define ACCESSOR_GETTER_LIST(V) V(ModuleNamespaceEntryGetter)
|
||||
|
||||
#define ACCESSOR_SETTER_LIST(V) \
|
||||
V(ArrayLengthSetter) \
|
||||
V(ErrorStackSetter) \
|
||||
@ -73,6 +75,12 @@ class Accessors : public AllStatic {
|
||||
ACCESSOR_INFO_LIST_GENERATOR(ACCESSOR_GETTER_DECLARATION, /* not used */)
|
||||
#undef ACCESSOR_GETTER_DECLARATION
|
||||
|
||||
#define ACCESSOR_GETTER_DECLARATION(accessor_name) \
|
||||
static void accessor_name(v8::Local<v8::Name> name, \
|
||||
const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
ACCESSOR_GETTER_LIST(ACCESSOR_GETTER_DECLARATION)
|
||||
#undef ACCESSOR_GETTER_DECLARATION
|
||||
|
||||
#define ACCESSOR_SETTER_DECLARATION(accessor_name) \
|
||||
static void accessor_name( \
|
||||
v8::Local<v8::Name> name, v8::Local<v8::Value> value, \
|
||||
@ -85,14 +93,16 @@ class Accessors : public AllStatic {
|
||||
ACCESSOR_INFO_LIST_GENERATOR(COUNT_ACCESSOR, /* not used */);
|
||||
#undef COUNT_ACCESSOR
|
||||
|
||||
static constexpr int kAccessorGetterCount =
|
||||
#define COUNT_ACCESSOR(...) +1
|
||||
ACCESSOR_GETTER_LIST(COUNT_ACCESSOR);
|
||||
#undef COUNT_ACCESSOR
|
||||
|
||||
static constexpr int kAccessorSetterCount =
|
||||
#define COUNT_ACCESSOR(...) +1
|
||||
ACCESSOR_SETTER_LIST(COUNT_ACCESSOR);
|
||||
#undef COUNT_ACCESSOR
|
||||
|
||||
static void ModuleNamespaceEntryGetter(
|
||||
v8::Local<v8::Name> name,
|
||||
const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
static Handle<AccessorInfo> MakeModuleNamespaceEntryInfo(Isolate* isolate,
|
||||
Handle<String> name);
|
||||
|
||||
|
@ -28,6 +28,7 @@ namespace internal {
|
||||
#define ADD_ISOLATE_ADDR(Name, name) "Isolate::" #name "_address",
|
||||
#define ADD_ACCESSOR_INFO_NAME(_, __, AccessorName, ...) \
|
||||
"Accessors::" #AccessorName "Getter",
|
||||
#define ADD_ACCESSOR_GETTER_NAME(name) "Accessors::" #name,
|
||||
#define ADD_ACCESSOR_SETTER_NAME(name) "Accessors::" #name,
|
||||
#define ADD_STATS_COUNTER_NAME(name, ...) "StatsCounter::" #name,
|
||||
// static
|
||||
@ -45,6 +46,7 @@ const char* const
|
||||
FOR_EACH_INTRINSIC(ADD_RUNTIME_FUNCTION)
|
||||
// Accessors:
|
||||
ACCESSOR_INFO_LIST_GENERATOR(ADD_ACCESSOR_INFO_NAME, /* not used */)
|
||||
ACCESSOR_GETTER_LIST(ADD_ACCESSOR_GETTER_NAME)
|
||||
ACCESSOR_SETTER_LIST(ADD_ACCESSOR_SETTER_NAME)
|
||||
|
||||
// === Isolate dependent ===
|
||||
@ -242,9 +244,13 @@ void ExternalReferenceTable::AddAccessors(int* index) {
|
||||
FUNCTION_ADDR(&Accessors::AccessorName##Getter),
|
||||
ACCESSOR_INFO_LIST_GENERATOR(ACCESSOR_INFO_DECLARATION, /* not used */)
|
||||
#undef ACCESSOR_INFO_DECLARATION
|
||||
|
||||
#define ACCESSOR_GETTER_DECLARATION(name) FUNCTION_ADDR(&Accessors::name),
|
||||
ACCESSOR_GETTER_LIST(ACCESSOR_GETTER_DECLARATION)
|
||||
#undef ACCESSOR_GETTER_DECLARATION
|
||||
// Setters:
|
||||
#define ACCESSOR_SETTER_DECLARATION(name) FUNCTION_ADDR(&Accessors::name),
|
||||
ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION)
|
||||
ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION)
|
||||
#undef ACCESSOR_SETTER_DECLARATION
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,8 @@ class ExternalReferenceTable {
|
||||
Runtime::kNumInlineFunctions; // Don't count dupe kInline... functions.
|
||||
static constexpr int kIsolateAddressReferenceCount = kIsolateAddressCount;
|
||||
static constexpr int kAccessorReferenceCount =
|
||||
Accessors::kAccessorInfoCount + Accessors::kAccessorSetterCount;
|
||||
Accessors::kAccessorInfoCount + Accessors::kAccessorGetterCount +
|
||||
Accessors::kAccessorSetterCount;
|
||||
// The number of stub cache external references, see AddStubCache.
|
||||
static constexpr int kStubCacheReferenceCount = 12;
|
||||
static constexpr int kStatsCountersReferenceCount =
|
||||
|
Loading…
Reference in New Issue
Block a user