Commit 84ff61d3 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[runtime] Share V8-internal AccessorInfo objects via rootset.

This should avoid changes in code serializer in a follow-up class literals
improvement CL.

Bug: v8:5799
Change-Id: I4e4386333bcc7abb30399d4e9abba4eee80ca932
Reviewed-on: https://chromium-review.googlesource.com/733037
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48996}
parent 6d1522d5
...@@ -134,7 +134,7 @@ void Accessors::ArgumentsIteratorGetter( ...@@ -134,7 +134,7 @@ void Accessors::ArgumentsIteratorGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(result, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(result, isolate)));
} }
Handle<AccessorInfo> Accessors::ArgumentsIteratorInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeArgumentsIteratorInfo(Isolate* isolate) {
Handle<Name> name = isolate->factory()->iterator_symbol(); Handle<Name> name = isolate->factory()->iterator_symbol();
return MakeAccessor(isolate, name, &ArgumentsIteratorGetter, nullptr); return MakeAccessor(isolate, name, &ArgumentsIteratorGetter, nullptr);
} }
...@@ -216,7 +216,7 @@ void Accessors::ArrayLengthSetter( ...@@ -216,7 +216,7 @@ void Accessors::ArrayLengthSetter(
} }
} }
Handle<AccessorInfo> Accessors::ArrayLengthInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeArrayLengthInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->length_string(), return MakeAccessor(isolate, isolate->factory()->length_string(),
&ArrayLengthGetter, &ArrayLengthSetter); &ArrayLengthGetter, &ArrayLengthSetter);
} }
...@@ -259,8 +259,8 @@ void Accessors::ModuleNamespaceEntrySetter( ...@@ -259,8 +259,8 @@ void Accessors::ModuleNamespaceEntrySetter(
} }
} }
Handle<AccessorInfo> Accessors::ModuleNamespaceEntryInfo(Isolate* isolate, Handle<AccessorInfo> Accessors::MakeModuleNamespaceEntryInfo(
Handle<String> name) { Isolate* isolate, Handle<String> name) {
return MakeAccessor(isolate, name, &ModuleNamespaceEntryGetter, return MakeAccessor(isolate, name, &ModuleNamespaceEntryGetter,
&ModuleNamespaceEntrySetter); &ModuleNamespaceEntrySetter);
} }
...@@ -293,7 +293,7 @@ void Accessors::StringLengthGetter( ...@@ -293,7 +293,7 @@ void Accessors::StringLengthGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(result, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(result, isolate)));
} }
Handle<AccessorInfo> Accessors::StringLengthInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeStringLengthInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->length_string(), return MakeAccessor(isolate, isolate->factory()->length_string(),
&StringLengthGetter, nullptr); &StringLengthGetter, nullptr);
} }
...@@ -316,7 +316,7 @@ void Accessors::ScriptColumnOffsetGetter( ...@@ -316,7 +316,7 @@ void Accessors::ScriptColumnOffsetGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
} }
Handle<AccessorInfo> Accessors::ScriptColumnOffsetInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptColumnOffsetInfo(Isolate* isolate) {
Handle<String> name(isolate->factory()->InternalizeOneByteString( Handle<String> name(isolate->factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("column_offset"))); STATIC_CHAR_VECTOR("column_offset")));
return MakeAccessor(isolate, name, &ScriptColumnOffsetGetter, nullptr); return MakeAccessor(isolate, name, &ScriptColumnOffsetGetter, nullptr);
...@@ -339,7 +339,7 @@ void Accessors::ScriptIdGetter( ...@@ -339,7 +339,7 @@ void Accessors::ScriptIdGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(id, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(id, isolate)));
} }
Handle<AccessorInfo> Accessors::ScriptIdInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptIdInfo(Isolate* isolate) {
Handle<String> name( Handle<String> name(
isolate->factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("id"))); isolate->factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("id")));
return MakeAccessor(isolate, name, &ScriptIdGetter, nullptr); return MakeAccessor(isolate, name, &ScriptIdGetter, nullptr);
...@@ -362,7 +362,7 @@ void Accessors::ScriptNameGetter( ...@@ -362,7 +362,7 @@ void Accessors::ScriptNameGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(source, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(source, isolate)));
} }
Handle<AccessorInfo> Accessors::ScriptNameInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptNameInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->name_string(), return MakeAccessor(isolate, isolate->factory()->name_string(),
&ScriptNameGetter, nullptr); &ScriptNameGetter, nullptr);
} }
...@@ -384,7 +384,7 @@ void Accessors::ScriptSourceGetter( ...@@ -384,7 +384,7 @@ void Accessors::ScriptSourceGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(source, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(source, isolate)));
} }
Handle<AccessorInfo> Accessors::ScriptSourceInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptSourceInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->source_string(), return MakeAccessor(isolate, isolate->factory()->source_string(),
&ScriptSourceGetter, nullptr); &ScriptSourceGetter, nullptr);
} }
...@@ -407,7 +407,7 @@ void Accessors::ScriptLineOffsetGetter( ...@@ -407,7 +407,7 @@ void Accessors::ScriptLineOffsetGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
} }
Handle<AccessorInfo> Accessors::ScriptLineOffsetInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptLineOffsetInfo(Isolate* isolate) {
Handle<String> name(isolate->factory()->InternalizeOneByteString( Handle<String> name(isolate->factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("line_offset"))); STATIC_CHAR_VECTOR("line_offset")));
return MakeAccessor(isolate, name, &ScriptLineOffsetGetter, nullptr); return MakeAccessor(isolate, name, &ScriptLineOffsetGetter, nullptr);
...@@ -431,7 +431,7 @@ void Accessors::ScriptTypeGetter( ...@@ -431,7 +431,7 @@ void Accessors::ScriptTypeGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
} }
Handle<AccessorInfo> Accessors::ScriptTypeInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptTypeInfo(Isolate* isolate) {
Handle<String> name( Handle<String> name(
isolate->factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("type"))); isolate->factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("type")));
return MakeAccessor(isolate, name, &ScriptTypeGetter, nullptr); return MakeAccessor(isolate, name, &ScriptTypeGetter, nullptr);
...@@ -455,7 +455,8 @@ void Accessors::ScriptCompilationTypeGetter( ...@@ -455,7 +455,8 @@ void Accessors::ScriptCompilationTypeGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
} }
Handle<AccessorInfo> Accessors::ScriptCompilationTypeInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptCompilationTypeInfo(
Isolate* isolate) {
Handle<String> name(isolate->factory()->InternalizeOneByteString( Handle<String> name(isolate->factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("compilation_type"))); STATIC_CHAR_VECTOR("compilation_type")));
return MakeAccessor(isolate, name, &ScriptCompilationTypeGetter, nullptr); return MakeAccessor(isolate, name, &ScriptCompilationTypeGetter, nullptr);
...@@ -478,7 +479,7 @@ void Accessors::ScriptSourceUrlGetter( ...@@ -478,7 +479,7 @@ void Accessors::ScriptSourceUrlGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(url, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(url, isolate)));
} }
Handle<AccessorInfo> Accessors::ScriptSourceUrlInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptSourceUrlInfo(Isolate* isolate) {
Handle<String> name(isolate->factory()->InternalizeOneByteString( Handle<String> name(isolate->factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("source_url"))); STATIC_CHAR_VECTOR("source_url")));
return MakeAccessor(isolate, name, &ScriptSourceUrlGetter, nullptr); return MakeAccessor(isolate, name, &ScriptSourceUrlGetter, nullptr);
...@@ -502,7 +503,8 @@ void Accessors::ScriptSourceMappingUrlGetter( ...@@ -502,7 +503,8 @@ void Accessors::ScriptSourceMappingUrlGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(url, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(url, isolate)));
} }
Handle<AccessorInfo> Accessors::ScriptSourceMappingUrlInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptSourceMappingUrlInfo(
Isolate* isolate) {
Handle<String> name(isolate->factory()->InternalizeOneByteString( Handle<String> name(isolate->factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("source_mapping_url"))); STATIC_CHAR_VECTOR("source_mapping_url")));
return MakeAccessor(isolate, name, &ScriptSourceMappingUrlGetter, nullptr); return MakeAccessor(isolate, name, &ScriptSourceMappingUrlGetter, nullptr);
...@@ -525,7 +527,7 @@ void Accessors::ScriptContextDataGetter( ...@@ -525,7 +527,7 @@ void Accessors::ScriptContextDataGetter(
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
} }
Handle<AccessorInfo> Accessors::ScriptContextDataInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptContextDataInfo(Isolate* isolate) {
Handle<String> name(isolate->factory()->InternalizeOneByteString( Handle<String> name(isolate->factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("context_data"))); STATIC_CHAR_VECTOR("context_data")));
return MakeAccessor(isolate, name, &ScriptContextDataGetter, nullptr); return MakeAccessor(isolate, name, &ScriptContextDataGetter, nullptr);
...@@ -558,7 +560,7 @@ void Accessors::ScriptEvalFromScriptGetter( ...@@ -558,7 +560,7 @@ void Accessors::ScriptEvalFromScriptGetter(
info.GetReturnValue().Set(Utils::ToLocal(result)); info.GetReturnValue().Set(Utils::ToLocal(result));
} }
Handle<AccessorInfo> Accessors::ScriptEvalFromScriptInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeScriptEvalFromScriptInfo(Isolate* isolate) {
Handle<String> name(isolate->factory()->InternalizeOneByteString( Handle<String> name(isolate->factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("eval_from_script"))); STATIC_CHAR_VECTOR("eval_from_script")));
return MakeAccessor(isolate, name, &ScriptEvalFromScriptGetter, nullptr); return MakeAccessor(isolate, name, &ScriptEvalFromScriptGetter, nullptr);
...@@ -585,7 +587,7 @@ void Accessors::ScriptEvalFromScriptPositionGetter( ...@@ -585,7 +587,7 @@ void Accessors::ScriptEvalFromScriptPositionGetter(
info.GetReturnValue().Set(Utils::ToLocal(result)); info.GetReturnValue().Set(Utils::ToLocal(result));
} }
Handle<AccessorInfo> Accessors::ScriptEvalFromScriptPositionInfo( Handle<AccessorInfo> Accessors::MakeScriptEvalFromScriptPositionInfo(
Isolate* isolate) { Isolate* isolate) {
Handle<String> name(isolate->factory()->InternalizeOneByteString( Handle<String> name(isolate->factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("eval_from_script_position"))); STATIC_CHAR_VECTOR("eval_from_script_position")));
...@@ -617,7 +619,7 @@ void Accessors::ScriptEvalFromFunctionNameGetter( ...@@ -617,7 +619,7 @@ void Accessors::ScriptEvalFromFunctionNameGetter(
info.GetReturnValue().Set(Utils::ToLocal(result)); info.GetReturnValue().Set(Utils::ToLocal(result));
} }
Handle<AccessorInfo> Accessors::ScriptEvalFromFunctionNameInfo( Handle<AccessorInfo> Accessors::MakeScriptEvalFromFunctionNameInfo(
Isolate* isolate) { Isolate* isolate) {
Handle<String> name(isolate->factory()->InternalizeOneByteString( Handle<String> name(isolate->factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("eval_from_function_name"))); STATIC_CHAR_VECTOR("eval_from_function_name")));
...@@ -666,7 +668,7 @@ void Accessors::FunctionPrototypeSetter( ...@@ -666,7 +668,7 @@ void Accessors::FunctionPrototypeSetter(
info.GetReturnValue().Set(true); info.GetReturnValue().Set(true);
} }
Handle<AccessorInfo> Accessors::FunctionPrototypeInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeFunctionPrototypeInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->prototype_string(), return MakeAccessor(isolate, isolate->factory()->prototype_string(),
&FunctionPrototypeGetter, &FunctionPrototypeSetter); &FunctionPrototypeGetter, &FunctionPrototypeSetter);
} }
...@@ -692,7 +694,7 @@ void Accessors::FunctionLengthGetter( ...@@ -692,7 +694,7 @@ void Accessors::FunctionLengthGetter(
info.GetReturnValue().Set(Utils::ToLocal(result)); info.GetReturnValue().Set(Utils::ToLocal(result));
} }
Handle<AccessorInfo> Accessors::FunctionLengthInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeFunctionLengthInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->length_string(), return MakeAccessor(isolate, isolate->factory()->length_string(),
&FunctionLengthGetter, &ReconfigureToDataProperty); &FunctionLengthGetter, &ReconfigureToDataProperty);
} }
...@@ -714,7 +716,7 @@ void Accessors::FunctionNameGetter( ...@@ -714,7 +716,7 @@ void Accessors::FunctionNameGetter(
info.GetReturnValue().Set(Utils::ToLocal(result)); info.GetReturnValue().Set(Utils::ToLocal(result));
} }
Handle<AccessorInfo> Accessors::FunctionNameInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeFunctionNameInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->name_string(), return MakeAccessor(isolate, isolate->factory()->name_string(),
&FunctionNameGetter, &ReconfigureToDataProperty); &FunctionNameGetter, &ReconfigureToDataProperty);
} }
...@@ -863,7 +865,7 @@ void Accessors::FunctionArgumentsGetter( ...@@ -863,7 +865,7 @@ void Accessors::FunctionArgumentsGetter(
info.GetReturnValue().Set(Utils::ToLocal(result)); info.GetReturnValue().Set(Utils::ToLocal(result));
} }
Handle<AccessorInfo> Accessors::FunctionArgumentsInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeFunctionArgumentsInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->arguments_string(), return MakeAccessor(isolate, isolate->factory()->arguments_string(),
&FunctionArgumentsGetter, nullptr); &FunctionArgumentsGetter, nullptr);
} }
...@@ -1039,7 +1041,7 @@ void Accessors::FunctionCallerGetter( ...@@ -1039,7 +1041,7 @@ void Accessors::FunctionCallerGetter(
info.GetReturnValue().Set(Utils::ToLocal(result)); info.GetReturnValue().Set(Utils::ToLocal(result));
} }
Handle<AccessorInfo> Accessors::FunctionCallerInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeFunctionCallerInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->caller_string(), return MakeAccessor(isolate, isolate->factory()->caller_string(),
&FunctionCallerGetter, nullptr); &FunctionCallerGetter, nullptr);
} }
...@@ -1067,7 +1069,7 @@ void Accessors::BoundFunctionLengthGetter( ...@@ -1067,7 +1069,7 @@ void Accessors::BoundFunctionLengthGetter(
info.GetReturnValue().Set(Utils::ToLocal(result)); info.GetReturnValue().Set(Utils::ToLocal(result));
} }
Handle<AccessorInfo> Accessors::BoundFunctionLengthInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeBoundFunctionLengthInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->length_string(), return MakeAccessor(isolate, isolate->factory()->length_string(),
&BoundFunctionLengthGetter, &ReconfigureToDataProperty); &BoundFunctionLengthGetter, &ReconfigureToDataProperty);
} }
...@@ -1092,7 +1094,7 @@ void Accessors::BoundFunctionNameGetter( ...@@ -1092,7 +1094,7 @@ void Accessors::BoundFunctionNameGetter(
info.GetReturnValue().Set(Utils::ToLocal(result)); info.GetReturnValue().Set(Utils::ToLocal(result));
} }
Handle<AccessorInfo> Accessors::BoundFunctionNameInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeBoundFunctionNameInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->name_string(), return MakeAccessor(isolate, isolate->factory()->name_string(),
&BoundFunctionNameGetter, &ReconfigureToDataProperty); &BoundFunctionNameGetter, &ReconfigureToDataProperty);
} }
...@@ -1207,7 +1209,7 @@ void Accessors::ErrorStackSetter( ...@@ -1207,7 +1209,7 @@ void Accessors::ErrorStackSetter(
Accessors::ReconfigureToDataProperty(name, val, info); Accessors::ReconfigureToDataProperty(name, val, info);
} }
Handle<AccessorInfo> Accessors::ErrorStackInfo(Isolate* isolate) { Handle<AccessorInfo> Accessors::MakeErrorStackInfo(Isolate* isolate) {
return MakeAccessor(isolate, isolate->factory()->stack_string(), return MakeAccessor(isolate, isolate->factory()->stack_string(),
&ErrorStackGetter, &ErrorStackSetter); &ErrorStackGetter, &ErrorStackSetter);
} }
......
...@@ -21,30 +21,30 @@ class Handle; ...@@ -21,30 +21,30 @@ class Handle;
// The list of accessor descriptors. This is a second-order macro // The list of accessor descriptors. This is a second-order macro
// taking a macro to be applied to all accessor descriptor names. // taking a macro to be applied to all accessor descriptor names.
#define ACCESSOR_INFO_LIST(V) \ #define ACCESSOR_INFO_LIST(V) \
V(ArgumentsIterator) \ V(arguments_iterator, ArgumentsIterator) \
V(ArrayLength) \ V(array_length, ArrayLength) \
V(BoundFunctionLength) \ V(bound_function_length, BoundFunctionLength) \
V(BoundFunctionName) \ V(bound_function_name, BoundFunctionName) \
V(ErrorStack) \ V(error_stack, ErrorStack) \
V(FunctionArguments) \ V(function_arguments, FunctionArguments) \
V(FunctionCaller) \ V(function_caller, FunctionCaller) \
V(FunctionName) \ V(function_name, FunctionName) \
V(FunctionLength) \ V(function_length, FunctionLength) \
V(FunctionPrototype) \ V(function_prototype, FunctionPrototype) \
V(ScriptColumnOffset) \ V(script_column_offset, ScriptColumnOffset) \
V(ScriptCompilationType) \ V(script_compilation_type, ScriptCompilationType) \
V(ScriptContextData) \ V(script_context_data, ScriptContextData) \
V(ScriptEvalFromScript) \ V(script_eval_from_script, ScriptEvalFromScript) \
V(ScriptEvalFromScriptPosition) \ V(script_eval_from_script_position, ScriptEvalFromScriptPosition) \
V(ScriptEvalFromFunctionName) \ V(script_eval_from_function_name, ScriptEvalFromFunctionName) \
V(ScriptId) \ V(script_id, ScriptId) \
V(ScriptLineOffset) \ V(script_line_offset, ScriptLineOffset) \
V(ScriptName) \ V(script_name, ScriptName) \
V(ScriptSource) \ V(script_source, ScriptSource) \
V(ScriptType) \ V(script_type, ScriptType) \
V(ScriptSourceUrl) \ V(script_source_url, ScriptSourceUrl) \
V(ScriptSourceMappingUrl) \ V(script_source_mapping_url, ScriptSourceMappingUrl) \
V(StringLength) V(string_length, StringLength)
#define ACCESSOR_SETTER_LIST(V) \ #define ACCESSOR_SETTER_LIST(V) \
V(ArrayLengthSetter) \ V(ArrayLengthSetter) \
...@@ -57,16 +57,16 @@ class Handle; ...@@ -57,16 +57,16 @@ class Handle;
class Accessors : public AllStatic { class Accessors : public AllStatic {
public: public:
// Accessor descriptors. #define ACCESSOR_GETTER_DECLARATION(accessor_name, AccessorName) \
#define ACCESSOR_INFO_DECLARATION(name) \ static void AccessorName##Getter( \
static void name##Getter(v8::Local<v8::Name> name, \ v8::Local<v8::Name> name, \
const v8::PropertyCallbackInfo<v8::Value>& info); \ const v8::PropertyCallbackInfo<v8::Value>& info);
static Handle<AccessorInfo> name##Info(Isolate* isolate); ACCESSOR_INFO_LIST(ACCESSOR_GETTER_DECLARATION)
ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION) #undef ACCESSOR_GETTER_DECLARATION
#undef ACCESSOR_INFO_DECLARATION
#define ACCESSOR_SETTER_DECLARATION(name) \ #define ACCESSOR_SETTER_DECLARATION(accessor_name) \
static void name(v8::Local<v8::Name> name, v8::Local<v8::Value> value, \ static void accessor_name( \
v8::Local<v8::Name> name, v8::Local<v8::Value> value, \
const v8::PropertyCallbackInfo<v8::Boolean>& info); const v8::PropertyCallbackInfo<v8::Boolean>& info);
ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION) ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION)
#undef ACCESSOR_SETTER_DECLARATION #undef ACCESSOR_SETTER_DECLARATION
...@@ -74,18 +74,9 @@ class Accessors : public AllStatic { ...@@ -74,18 +74,9 @@ class Accessors : public AllStatic {
static void ModuleNamespaceEntryGetter( static void ModuleNamespaceEntryGetter(
v8::Local<v8::Name> name, v8::Local<v8::Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info); const v8::PropertyCallbackInfo<v8::Value>& info);
static Handle<AccessorInfo> ModuleNamespaceEntryInfo(Isolate* isolate, static Handle<AccessorInfo> MakeModuleNamespaceEntryInfo(Isolate* isolate,
Handle<String> name); Handle<String> name);
enum DescriptorId {
#define ACCESSOR_INFO_DECLARATION(name) \
k##name##Getter, \
k##name##Setter,
ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
#undef ACCESSOR_INFO_DECLARATION
descriptorCount
};
// Accessor functions called directly from the runtime system. // Accessor functions called directly from the runtime system.
static Handle<JSObject> FunctionGetArguments(Handle<JSFunction> object); static Handle<JSObject> FunctionGetArguments(Handle<JSFunction> object);
...@@ -109,6 +100,14 @@ class Accessors : public AllStatic { ...@@ -109,6 +100,14 @@ class Accessors : public AllStatic {
static Handle<AccessorInfo> MakeAccessor( static Handle<AccessorInfo> MakeAccessor(
Isolate* isolate, Handle<Name> name, AccessorNameGetterCallback getter, Isolate* isolate, Handle<Name> name, AccessorNameGetterCallback getter,
AccessorNameBooleanSetterCallback setter); AccessorNameBooleanSetterCallback setter);
private:
#define ACCESSOR_INFO_DECLARATION(accessor_name, AccessorName) \
static Handle<AccessorInfo> Make##AccessorName##Info(Isolate* isolate);
ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
#undef ACCESSOR_INFO_DECLARATION
friend class Heap;
}; };
} // namespace internal } // namespace internal
......
...@@ -1342,7 +1342,7 @@ static void InstallError(Isolate* isolate, Handle<JSObject> global, ...@@ -1342,7 +1342,7 @@ static void InstallError(Isolate* isolate, Handle<JSObject> global,
Map::EnsureDescriptorSlack(initial_map, 1); Map::EnsureDescriptorSlack(initial_map, 1);
{ {
Handle<AccessorInfo> info = Accessors::ErrorStackInfo(isolate); Handle<AccessorInfo> info = factory->error_stack_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, DONT_ENUM); info, DONT_ENUM);
initial_map->AppendDescriptor(&d); initial_map->AppendDescriptor(&d);
...@@ -1617,9 +1617,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -1617,9 +1617,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
DONT_ENUM | DONT_DELETE); DONT_ENUM | DONT_DELETE);
{ // Add length. { // Add length.
Handle<AccessorInfo> info = Accessors::ArrayLengthInfo(isolate); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = factory->length_string(), factory->array_length_accessor(), attribs);
Descriptor::AccessorConstant(factory->length_string(), info, attribs);
initial_map->AppendDescriptor(&d); initial_map->AppendDescriptor(&d);
} }
...@@ -1927,9 +1926,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -1927,9 +1926,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
DONT_ENUM | DONT_DELETE | READ_ONLY); DONT_ENUM | DONT_DELETE | READ_ONLY);
{ // Add length. { // Add length.
Handle<AccessorInfo> info = Accessors::StringLengthInfo(isolate); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = factory->length_string(), factory->string_length_accessor(), attribs);
Descriptor::AccessorConstant(factory->length_string(), info, attribs);
string_map->AppendDescriptor(&d); string_map->AppendDescriptor(&d);
} }
...@@ -3409,15 +3407,15 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -3409,15 +3407,15 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Map::EnsureDescriptorSlack(map, 2); Map::EnsureDescriptorSlack(map, 2);
{ // length { // length
Handle<AccessorInfo> info = Accessors::BoundFunctionLengthInfo(isolate); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = Descriptor::AccessorConstant(factory->length_string(), factory->length_string(), factory->bound_function_length_accessor(),
info, roc_attribs); roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
{ // name { // name
Handle<AccessorInfo> info = Accessors::BoundFunctionNameInfo(isolate); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = Descriptor::AccessorConstant(factory->name_string(), info, factory->name_string(), factory->bound_function_name_accessor(),
roc_attribs); roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
...@@ -3983,63 +3981,63 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, ...@@ -3983,63 +3981,63 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
{ // column_offset { // column_offset
Handle<AccessorInfo> info = Accessors::ScriptColumnOffsetInfo(isolate); Handle<AccessorInfo> info = factory->script_column_offset_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
} }
{ // id { // id
Handle<AccessorInfo> info = Accessors::ScriptIdInfo(isolate); Handle<AccessorInfo> info = factory->script_id_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
} }
{ // name { // name
Handle<AccessorInfo> info = Accessors::ScriptNameInfo(isolate); Handle<AccessorInfo> info = factory->script_name_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
} }
{ // line_offset { // line_offset
Handle<AccessorInfo> info = Accessors::ScriptLineOffsetInfo(isolate); Handle<AccessorInfo> info = factory->script_line_offset_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
} }
{ // source { // source
Handle<AccessorInfo> info = Accessors::ScriptSourceInfo(isolate); Handle<AccessorInfo> info = factory->script_source_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
} }
{ // type { // type
Handle<AccessorInfo> info = Accessors::ScriptTypeInfo(isolate); Handle<AccessorInfo> info = factory->script_type_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
} }
{ // compilation_type { // compilation_type
Handle<AccessorInfo> info = Accessors::ScriptCompilationTypeInfo(isolate); Handle<AccessorInfo> info = factory->script_compilation_type_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
} }
{ // context_data { // context_data
Handle<AccessorInfo> info = Accessors::ScriptContextDataInfo(isolate); Handle<AccessorInfo> info = factory->script_context_data_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
} }
{ // eval_from_script { // eval_from_script
Handle<AccessorInfo> info = Accessors::ScriptEvalFromScriptInfo(isolate); Handle<AccessorInfo> info = factory->script_eval_from_script_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
...@@ -4047,7 +4045,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, ...@@ -4047,7 +4045,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
{ // eval_from_script_position { // eval_from_script_position
Handle<AccessorInfo> info = Handle<AccessorInfo> info =
Accessors::ScriptEvalFromScriptPositionInfo(isolate); factory->script_eval_from_script_position_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
...@@ -4055,22 +4053,21 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, ...@@ -4055,22 +4053,21 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
{ // eval_from_function_name { // eval_from_function_name
Handle<AccessorInfo> info = Handle<AccessorInfo> info =
Accessors::ScriptEvalFromFunctionNameInfo(isolate); factory->script_eval_from_function_name_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
} }
{ // source_url { // source_url
Handle<AccessorInfo> info = Accessors::ScriptSourceUrlInfo(isolate); Handle<AccessorInfo> info = factory->script_source_url_accessor();
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
} }
{ // source_mapping_url { // source_mapping_url
Handle<AccessorInfo> info = Handle<AccessorInfo> info = factory->script_source_mapping_url_accessor();
Accessors::ScriptSourceMappingUrlInfo(isolate);
Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate), Descriptor d = Descriptor::AccessorConstant(handle(info->name(), isolate),
info, attribs); info, attribs);
script_map->AppendDescriptor(&d); script_map->AppendDescriptor(&d);
...@@ -4510,9 +4507,9 @@ Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target, ...@@ -4510,9 +4507,9 @@ Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target,
DONT_ENUM | DONT_DELETE); DONT_ENUM | DONT_DELETE);
{ // Add length. { // Add length.
Handle<AccessorInfo> info = Accessors::ArrayLengthInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = factory()->length_string(), factory()->array_length_accessor(),
Descriptor::AccessorConstant(factory()->length_string(), info, attribs); attribs);
initial_map->AppendDescriptor(&d); initial_map->AppendDescriptor(&d);
} }
...@@ -4823,7 +4820,7 @@ bool Genesis::InstallNatives(GlobalContextType context_type) { ...@@ -4823,7 +4820,7 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
{ {
PropertyAttributes attribs = DONT_ENUM; PropertyAttributes attribs = DONT_ENUM;
Handle<AccessorInfo> arguments_iterator = Handle<AccessorInfo> arguments_iterator =
Accessors::ArgumentsIteratorInfo(isolate()); factory()->arguments_iterator_accessor();
{ {
Descriptor d = Descriptor::AccessorConstant(factory()->iterator_symbol(), Descriptor d = Descriptor::AccessorConstant(factory()->iterator_symbol(),
arguments_iterator, attribs); arguments_iterator, attribs);
......
...@@ -60,7 +60,7 @@ BUILTIN(ErrorCaptureStackTrace) { ...@@ -60,7 +60,7 @@ BUILTIN(ErrorCaptureStackTrace) {
// Add the stack accessors. // Add the stack accessors.
Handle<AccessorInfo> error_stack = Accessors::ErrorStackInfo(isolate); Handle<AccessorInfo> error_stack = isolate->factory()->error_stack_accessor();
Handle<Name> name(Name::cast(error_stack->name()), isolate); Handle<Name> name(Name::cast(error_stack->name()), isolate);
// Explicitly check for frozen objects. Other access checks are performed by // Explicitly check for frozen objects. Other access checks are performed by
......
...@@ -392,8 +392,9 @@ void ExternalReferenceTable::AddAccessors(Isolate* isolate) { ...@@ -392,8 +392,9 @@ void ExternalReferenceTable::AddAccessors(Isolate* isolate) {
}; };
static const AccessorRefTable getters[] = { static const AccessorRefTable getters[] = {
#define ACCESSOR_INFO_DECLARATION(name) \ #define ACCESSOR_INFO_DECLARATION(accessor_name, AccessorName) \
{FUNCTION_ADDR(&Accessors::name##Getter), "Accessors::" #name "Getter"}, {FUNCTION_ADDR(&Accessors::AccessorName##Getter), \
"Accessors::" #AccessorName "Getter"}, /* NOLINT(whitespace/indent) */
ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION) ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
#undef ACCESSOR_INFO_DECLARATION #undef ACCESSOR_INFO_DECLARATION
}; };
...@@ -401,7 +402,7 @@ void ExternalReferenceTable::AddAccessors(Isolate* isolate) { ...@@ -401,7 +402,7 @@ void ExternalReferenceTable::AddAccessors(Isolate* isolate) {
#define ACCESSOR_SETTER_DECLARATION(name) \ #define ACCESSOR_SETTER_DECLARATION(name) \
{ FUNCTION_ADDR(&Accessors::name), "Accessors::" #name}, { FUNCTION_ADDR(&Accessors::name), "Accessors::" #name},
ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION) ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION)
#undef ACCESSOR_INFO_DECLARATION #undef ACCESSOR_SETTER_DECLARATION
}; };
for (unsigned i = 0; i < arraysize(getters); ++i) { for (unsigned i = 0; i < arraysize(getters); ++i) {
...@@ -449,3 +450,5 @@ void ExternalReferenceTable::AddStubCache(Isolate* isolate) { ...@@ -449,3 +450,5 @@ void ExternalReferenceTable::AddStubCache(Isolate* isolate) {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#undef SYMBOLIZE_FUNCTION
...@@ -54,6 +54,16 @@ PUBLIC_SYMBOL_LIST(SYMBOL_ACCESSOR) ...@@ -54,6 +54,16 @@ PUBLIC_SYMBOL_LIST(SYMBOL_ACCESSOR)
WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR) WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR)
#undef SYMBOL_ACCESSOR #undef SYMBOL_ACCESSOR
#define ACCESSOR_INFO_ACCESSOR(accessor_name, AccessorName) \
Handle<AccessorInfo> Factory::accessor_name##_accessor() { \
return Handle<AccessorInfo>(bit_cast<AccessorInfo**>( \
&isolate() \
->heap() \
->roots_[Heap::k##AccessorName##AccessorRootIndex])); \
}
ACCESSOR_INFO_LIST(ACCESSOR_INFO_ACCESSOR)
#undef ACCESSOR_INFO_ACCESSOR
Handle<String> Factory::InternalizeString(Handle<String> string) { Handle<String> Factory::InternalizeString(Handle<String> string) {
if (string->IsInternalizedString()) return string; if (string->IsInternalizedString()) return string;
return StringTable::LookupString(isolate(), string); return StringTable::LookupString(isolate(), string);
......
...@@ -3012,9 +3012,8 @@ Handle<Map> Factory::CreateSloppyFunctionMap( ...@@ -3012,9 +3012,8 @@ Handle<Map> Factory::CreateSloppyFunctionMap(
int field_index = 0; int field_index = 0;
STATIC_ASSERT(JSFunction::kLengthDescriptorIndex == 0); STATIC_ASSERT(JSFunction::kLengthDescriptorIndex == 0);
{ // Add length accessor. { // Add length accessor.
Handle<AccessorInfo> info = Accessors::FunctionLengthInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = length_string(), function_length_accessor(), roc_attribs);
Descriptor::AccessorConstant(length_string(), info, roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
...@@ -3028,21 +3027,18 @@ Handle<Map> Factory::CreateSloppyFunctionMap( ...@@ -3028,21 +3027,18 @@ Handle<Map> Factory::CreateSloppyFunctionMap(
} else { } else {
// Add name accessor. // Add name accessor.
Handle<AccessorInfo> info = Accessors::FunctionNameInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = name_string(), function_name_accessor(), roc_attribs);
Descriptor::AccessorConstant(name_string(), info, roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
{ // Add arguments accessor. { // Add arguments accessor.
Handle<AccessorInfo> info = Accessors::FunctionArgumentsInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = arguments_string(), function_arguments_accessor(), ro_attribs);
Descriptor::AccessorConstant(arguments_string(), info, ro_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
{ // Add caller accessor. { // Add caller accessor.
Handle<AccessorInfo> info = Accessors::FunctionCallerInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = caller_string(), function_caller_accessor(), ro_attribs);
Descriptor::AccessorConstant(caller_string(), info, ro_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
if (IsFunctionModeWithPrototype(function_mode)) { if (IsFunctionModeWithPrototype(function_mode)) {
...@@ -3050,9 +3046,8 @@ Handle<Map> Factory::CreateSloppyFunctionMap( ...@@ -3050,9 +3046,8 @@ Handle<Map> Factory::CreateSloppyFunctionMap(
PropertyAttributes attribs = PropertyAttributes attribs =
IsFunctionModeWithWritablePrototype(function_mode) ? rw_attribs IsFunctionModeWithWritablePrototype(function_mode) ? rw_attribs
: ro_attribs; : ro_attribs;
Handle<AccessorInfo> info = Accessors::FunctionPrototypeInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = prototype_string(), function_prototype_accessor(), attribs);
Descriptor::AccessorConstant(prototype_string(), info, attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
DCHECK_EQ(inobject_properties_count, field_index); DCHECK_EQ(inobject_properties_count, field_index);
...@@ -3093,9 +3088,8 @@ Handle<Map> Factory::CreateStrictFunctionMap( ...@@ -3093,9 +3088,8 @@ Handle<Map> Factory::CreateStrictFunctionMap(
int field_index = 0; int field_index = 0;
STATIC_ASSERT(JSFunction::kLengthDescriptorIndex == 0); STATIC_ASSERT(JSFunction::kLengthDescriptorIndex == 0);
{ // Add length accessor. { // Add length accessor.
Handle<AccessorInfo> info = Accessors::FunctionLengthInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = length_string(), function_length_accessor(), roc_attribs);
Descriptor::AccessorConstant(length_string(), info, roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
...@@ -3109,9 +3103,8 @@ Handle<Map> Factory::CreateStrictFunctionMap( ...@@ -3109,9 +3103,8 @@ Handle<Map> Factory::CreateStrictFunctionMap(
} else { } else {
// Add name accessor. // Add name accessor.
Handle<AccessorInfo> info = Accessors::FunctionNameInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = name_string(), function_name_accessor(), roc_attribs);
Descriptor::AccessorConstant(name_string(), info, roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
...@@ -3120,9 +3113,8 @@ Handle<Map> Factory::CreateStrictFunctionMap( ...@@ -3120,9 +3113,8 @@ Handle<Map> Factory::CreateStrictFunctionMap(
PropertyAttributes attribs = PropertyAttributes attribs =
IsFunctionModeWithWritablePrototype(function_mode) ? rw_attribs IsFunctionModeWithWritablePrototype(function_mode) ? rw_attribs
: ro_attribs; : ro_attribs;
Handle<AccessorInfo> info = Accessors::FunctionPrototypeInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = prototype_string(), function_prototype_accessor(), attribs);
Descriptor::AccessorConstant(prototype_string(), info, attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
...@@ -3156,17 +3148,15 @@ Handle<Map> Factory::CreateClassFunctionMap(Handle<JSFunction> empty_function) { ...@@ -3156,17 +3148,15 @@ Handle<Map> Factory::CreateClassFunctionMap(Handle<JSFunction> empty_function) {
STATIC_ASSERT(JSFunction::kLengthDescriptorIndex == 0); STATIC_ASSERT(JSFunction::kLengthDescriptorIndex == 0);
{ // Add length accessor. { // Add length accessor.
Handle<AccessorInfo> info = Accessors::FunctionLengthInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = length_string(), function_length_accessor(), roc_attribs);
Descriptor::AccessorConstant(length_string(), info, roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
{ {
// Add prototype accessor. // Add prototype accessor.
Handle<AccessorInfo> info = Accessors::FunctionPrototypeInfo(isolate()); Descriptor d = Descriptor::AccessorConstant(
Descriptor d = prototype_string(), function_prototype_accessor(), rw_attribs);
Descriptor::AccessorConstant(prototype_string(), info, rw_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
return map; return map;
......
...@@ -757,6 +757,11 @@ class V8_EXPORT_PRIVATE Factory final { ...@@ -757,6 +757,11 @@ class V8_EXPORT_PRIVATE Factory final {
WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR) WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR)
#undef SYMBOL_ACCESSOR #undef SYMBOL_ACCESSOR
#define ACCESSOR_INFO_ACCESSOR(accessor_name, AccessorName) \
inline Handle<AccessorInfo> accessor_name##_accessor();
ACCESSOR_INFO_LIST(ACCESSOR_INFO_ACCESSOR)
#undef ACCESSOR_INFO_ACCESSOR
// Allocates a new SharedFunctionInfo object. // Allocates a new SharedFunctionInfo object.
Handle<SharedFunctionInfo> NewSharedFunctionInfo( Handle<SharedFunctionInfo> NewSharedFunctionInfo(
MaybeHandle<String> name, FunctionKind kind, Handle<Code> code, MaybeHandle<String> name, FunctionKind kind, Handle<Code> code,
......
...@@ -66,6 +66,13 @@ PUBLIC_SYMBOL_LIST(SYMBOL_ACCESSOR) ...@@ -66,6 +66,13 @@ PUBLIC_SYMBOL_LIST(SYMBOL_ACCESSOR)
WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR) WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR)
#undef SYMBOL_ACCESSOR #undef SYMBOL_ACCESSOR
#define ACCESSOR_INFO_ACCESSOR(accessor_name, AccessorName) \
AccessorInfo* Heap::accessor_name##_accessor() { \
return AccessorInfo::cast(roots_[k##AccessorName##AccessorRootIndex]); \
}
ACCESSOR_INFO_LIST(ACCESSOR_INFO_ACCESSOR)
#undef ACCESSOR_INFO_ACCESSOR
#define ROOT_ACCESSOR(type, name, camel_name) \ #define ROOT_ACCESSOR(type, name, camel_name) \
void Heap::set_##name(type* value) { \ void Heap::set_##name(type* value) { \
/* The deserializer makes use of the fact that these common roots are */ \ /* The deserializer makes use of the fact that these common roots are */ \
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
// Clients of this interface shouldn't depend on lots of heap internals. // Clients of this interface shouldn't depend on lots of heap internals.
// Do not include anything from src/heap here! // Do not include anything from src/heap here!
#include "include/v8.h" #include "include/v8.h"
#include "src/accessors.h"
#include "src/allocation.h" #include "src/allocation.h"
#include "src/assert-scope.h" #include "src/assert-scope.h"
#include "src/base/atomic-utils.h" #include "src/base/atomic-utils.h"
...@@ -551,6 +552,11 @@ class Heap { ...@@ -551,6 +552,11 @@ class Heap {
WELL_KNOWN_SYMBOL_LIST(SYMBOL_INDEX_DECLARATION) WELL_KNOWN_SYMBOL_LIST(SYMBOL_INDEX_DECLARATION)
#undef SYMBOL_INDEX_DECLARATION #undef SYMBOL_INDEX_DECLARATION
#define ACCESSOR_INDEX_DECLARATION(accessor_name, AccessorName) \
k##AccessorName##AccessorRootIndex,
ACCESSOR_INFO_LIST(ACCESSOR_INDEX_DECLARATION)
#undef ACCESSOR_INDEX_DECLARATION
// Utility type maps // Utility type maps
#define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex,
STRUCT_LIST(DECLARE_STRUCT_MAP) STRUCT_LIST(DECLARE_STRUCT_MAP)
...@@ -797,7 +803,7 @@ class Heap { ...@@ -797,7 +803,7 @@ class Heap {
// Support for the API. // Support for the API.
// //
bool CreateApiObjects(); void CreateApiObjects();
// Implements the corresponding V8 API function. // Implements the corresponding V8 API function.
bool IdleNotification(double deadline_in_seconds); bool IdleNotification(double deadline_in_seconds);
...@@ -1020,6 +1026,11 @@ class Heap { ...@@ -1020,6 +1026,11 @@ class Heap {
WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR) WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR)
#undef SYMBOL_ACCESSOR #undef SYMBOL_ACCESSOR
#define ACCESSOR_INFO_ACCESSOR(accessor_name, AccessorName) \
inline AccessorInfo* accessor_name##_accessor();
ACCESSOR_INFO_LIST(ACCESSOR_INFO_ACCESSOR)
#undef ACCESSOR_INFO_ACCESSOR
Object* root(RootListIndex index) { return roots_[index]; } Object* root(RootListIndex index) { return roots_[index]; }
Handle<Object> root_handle(RootListIndex index) { Handle<Object> root_handle(RootListIndex index) {
return Handle<Object>(&roots_[index]); return Handle<Object>(&roots_[index]);
...@@ -1726,6 +1737,7 @@ class Heap { ...@@ -1726,6 +1737,7 @@ class Heap {
AllocationSite* allocation_site); AllocationSite* allocation_site);
bool CreateInitialMaps(); bool CreateInitialMaps();
void CreateInternalAccessorInfoObjects();
void CreateInitialObjects(); void CreateInitialObjects();
// These five Create*EntryStub functions are here and forced to not be inlined // These five Create*EntryStub functions are here and forced to not be inlined
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "src/setup-isolate.h" #include "src/setup-isolate.h"
#include "src/accessors.h"
#include "src/ast/context-slot-cache.h" #include "src/ast/context-slot-cache.h"
#include "src/compilation-cache.h" #include "src/compilation-cache.h"
#include "src/contexts.h" #include "src/contexts.h"
...@@ -35,10 +36,11 @@ bool SetupIsolateDelegate::SetupHeapInternal(Heap* heap) { ...@@ -35,10 +36,11 @@ bool SetupIsolateDelegate::SetupHeapInternal(Heap* heap) {
bool Heap::CreateHeapObjects() { bool Heap::CreateHeapObjects() {
// Create initial maps. // Create initial maps.
if (!CreateInitialMaps()) return false; if (!CreateInitialMaps()) return false;
if (!CreateApiObjects()) return false; CreateApiObjects();
// Create initial objects // Create initial objects
CreateInitialObjects(); CreateInitialObjects();
CreateInternalAccessorInfoObjects();
CHECK_EQ(0u, gc_count_); CHECK_EQ(0u, gc_count_);
set_native_contexts_list(undefined_value()); set_native_contexts_list(undefined_value());
...@@ -363,18 +365,16 @@ bool Heap::CreateInitialMaps() { ...@@ -363,18 +365,16 @@ bool Heap::CreateInitialMaps() {
return true; return true;
} }
bool Heap::CreateApiObjects() { void Heap::CreateApiObjects() {
HandleScope scope(isolate()); Isolate* isolate = this->isolate();
set_message_listeners(*TemplateList::New(isolate(), 2)); HandleScope scope(isolate);
HeapObject* obj = nullptr;
{ set_message_listeners(*TemplateList::New(isolate, 2));
AllocationResult allocation = AllocateStruct(INTERCEPTOR_INFO_TYPE);
if (!allocation.To(&obj)) return false; Handle<InterceptorInfo> info = Handle<InterceptorInfo>::cast(
} isolate->factory()->NewStruct(INTERCEPTOR_INFO_TYPE, TENURED));
InterceptorInfo* info = InterceptorInfo::cast(obj);
info->set_flags(0); info->set_flags(0);
set_noop_interceptor_info(info); set_noop_interceptor_info(*info);
return true;
} }
void Heap::CreateInitialObjects() { void Heap::CreateInitialObjects() {
...@@ -630,5 +630,17 @@ void Heap::CreateInitialObjects() { ...@@ -630,5 +630,17 @@ void Heap::CreateInitialObjects() {
isolate_->compilation_cache()->Clear(); isolate_->compilation_cache()->Clear();
} }
void Heap::CreateInternalAccessorInfoObjects() {
Isolate* isolate = this->isolate();
HandleScope scope(isolate);
Handle<AccessorInfo> acessor_info;
#define INIT_ACCESSOR_INFO(accessor_name, AccessorName) \
acessor_info = Accessors::Make##AccessorName##Info(isolate); \
roots_[k##AccessorName##AccessorRootIndex] = *acessor_info;
ACCESSOR_INFO_LIST(INIT_ACCESSOR_INFO)
#undef INIT_ACCESSOR_INFO
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -848,7 +848,7 @@ Handle<JSModuleNamespace> Module::GetModuleNamespace(Handle<Module> module) { ...@@ -848,7 +848,7 @@ Handle<JSModuleNamespace> Module::GetModuleNamespace(Handle<Module> module) {
"JSModuleNamespace"); "JSModuleNamespace");
for (const auto& name : names) { for (const auto& name : names) {
JSObject::SetNormalizedProperty( JSObject::SetNormalizedProperty(
ns, name, Accessors::ModuleNamespaceEntryInfo(isolate, name), ns, name, Accessors::MakeModuleNamespaceEntryInfo(isolate, name),
PropertyDetails(kAccessor, attr, PropertyCellType::kMutable)); PropertyDetails(kAccessor, attr, PropertyCellType::kMutable));
} }
JSObject::PreventExtensions(ns, kThrowOnError).ToChecked(); JSObject::PreventExtensions(ns, kThrowOnError).ToChecked();
......
...@@ -1919,6 +1919,10 @@ const char* V8HeapExplorer::GetStrongGcSubrootName(Object* object) { ...@@ -1919,6 +1919,10 @@ const char* V8HeapExplorer::GetStrongGcSubrootName(Object* object) {
PUBLIC_SYMBOL_LIST(SYMBOL_NAME) PUBLIC_SYMBOL_LIST(SYMBOL_NAME)
WELL_KNOWN_SYMBOL_LIST(SYMBOL_NAME) WELL_KNOWN_SYMBOL_LIST(SYMBOL_NAME)
#undef SYMBOL_NAME #undef SYMBOL_NAME
#define ACCESSOR_NAME(accessor_name, AccessorName) \
NAME_ENTRY(accessor_name##_accessor)
ACCESSOR_INFO_LIST(ACCESSOR_NAME)
#undef ACCESSOR_NAME
#undef NAME_ENTRY #undef NAME_ENTRY
CHECK(!strong_gc_subroot_names_.is_empty()); CHECK(!strong_gc_subroot_names_.is_empty());
} }
......
...@@ -205,8 +205,7 @@ void InstallClassNameAccessor(Isolate* isolate, Handle<JSObject> object) { ...@@ -205,8 +205,7 @@ void InstallClassNameAccessor(Isolate* isolate, Handle<JSObject> object) {
// Cannot fail since this should only be called when creating an object // Cannot fail since this should only be called when creating an object
// literal. // literal.
CHECK(!JSObject::SetAccessor( CHECK(!JSObject::SetAccessor(
object, name, Accessors::FunctionNameInfo(object->GetIsolate()), object, name, isolate->factory()->function_name_accessor(), attrs)
attrs)
.is_null()); .is_null());
} }
} // anonymous namespace } // anonymous namespace
......
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