[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}
This commit is contained in:
parent
abe50f04be
commit
8d18f42fae
@ -202,24 +202,6 @@ Handle<AccessorInfo> Accessors::ArrayLengthInfo(
|
||||
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
|
||||
//
|
||||
|
@ -30,7 +30,6 @@ class AccessorInfo;
|
||||
V(FunctionName) \
|
||||
V(FunctionLength) \
|
||||
V(FunctionPrototype) \
|
||||
V(ModuleNamespaceToStringTag) \
|
||||
V(ScriptColumnOffset) \
|
||||
V(ScriptCompilationType) \
|
||||
V(ScriptContextData) \
|
||||
|
@ -2156,10 +2156,9 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
// Install @@toStringTag.
|
||||
PropertyAttributes attribs =
|
||||
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
|
||||
Handle<AccessorInfo> toStringTag =
|
||||
Accessors::ModuleNamespaceToStringTagInfo(isolate, attribs);
|
||||
AccessorConstantDescriptor d(factory->to_string_tag_symbol(), toStringTag,
|
||||
attribs);
|
||||
DataConstantDescriptor d(factory->to_string_tag_symbol(),
|
||||
factory->NewStringFromAsciiChecked("Module"),
|
||||
attribs);
|
||||
Map::EnsureDescriptorSlack(map, 1);
|
||||
map->AppendDescriptor(&d);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user