Commit 8d18f42f authored by neis's avatar neis Committed by Commit bot

[modules] Simplify installation of @@toStringTag on namespace objects.

Install it as DataConstantDescriptor, not AccessorConstantDescriptor.

R=adamk@chromium.org
BUG=v8:1569

Review-Url: https://codereview.chromium.org/2410823002
Cr-Commit-Position: refs/heads/master@{#40180}
parent abe50f04
...@@ -202,24 +202,6 @@ Handle<AccessorInfo> Accessors::ArrayLengthInfo( ...@@ -202,24 +202,6 @@ Handle<AccessorInfo> Accessors::ArrayLengthInfo(
attributes); attributes);
} }
//
// Accessors::ModuleNamespaceToStringTag
//
void Accessors::ModuleNamespaceToStringTagGetter(
v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
info.GetReturnValue().Set(
Utils::ToLocal(isolate->factory()->NewStringFromAsciiChecked("Module")));
}
Handle<AccessorInfo> Accessors::ModuleNamespaceToStringTagInfo(
Isolate* isolate, PropertyAttributes attributes) {
Handle<Name> name = isolate->factory()->to_string_tag_symbol();
return MakeAccessor(isolate, name, &ModuleNamespaceToStringTagGetter, nullptr,
attributes);
}
// //
// Accessors::ModuleNamespaceEntry // Accessors::ModuleNamespaceEntry
// //
......
...@@ -30,7 +30,6 @@ class AccessorInfo; ...@@ -30,7 +30,6 @@ class AccessorInfo;
V(FunctionName) \ V(FunctionName) \
V(FunctionLength) \ V(FunctionLength) \
V(FunctionPrototype) \ V(FunctionPrototype) \
V(ModuleNamespaceToStringTag) \
V(ScriptColumnOffset) \ V(ScriptColumnOffset) \
V(ScriptCompilationType) \ V(ScriptCompilationType) \
V(ScriptContextData) \ V(ScriptContextData) \
......
...@@ -2156,9 +2156,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -2156,9 +2156,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
// Install @@toStringTag. // Install @@toStringTag.
PropertyAttributes attribs = PropertyAttributes attribs =
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
Handle<AccessorInfo> toStringTag = DataConstantDescriptor d(factory->to_string_tag_symbol(),
Accessors::ModuleNamespaceToStringTagInfo(isolate, attribs); factory->NewStringFromAsciiChecked("Module"),
AccessorConstantDescriptor d(factory->to_string_tag_symbol(), toStringTag,
attribs); attribs);
Map::EnsureDescriptorSlack(map, 1); Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
......
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