Commit 5f638462 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[offthread] Add off-thread scope allocation

Make Scope allocation and ScopeInfo creation Isolate-templated. This
includes making SourceTextModuleInfo allocation templated -- modules
aren't currently streamed off-thread, but will hopefully be in the
future, so this future-proofs them against that.

Bug: chromium:1011762
Change-Id: I8954e08e8e81489eb821b5f62ec35a5be31fce09
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2043790Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66197}
parent 7a410e73
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "src/ast/modules.h" #include "src/ast/modules.h"
#include "src/ast/ast-value-factory.h" #include "src/ast/ast-value-factory.h"
#include "src/ast/scopes.h" #include "src/ast/scopes.h"
#include "src/heap/off-thread-factory-inl.h"
#include "src/objects/module-inl.h" #include "src/objects/module-inl.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"
#include "src/parsing/pending-compilation-error-handler.h" #include "src/parsing/pending-compilation-error-handler.h"
...@@ -84,17 +85,17 @@ void SourceTextModuleDescriptor::AddStarExport( ...@@ -84,17 +85,17 @@ void SourceTextModuleDescriptor::AddStarExport(
} }
namespace { namespace {
Handle<PrimitiveHeapObject> ToStringOrUndefined(Isolate* isolate, template <typename Isolate>
const AstRawString* s) { HandleFor<Isolate, PrimitiveHeapObject> ToStringOrUndefined(
return (s == nullptr) Isolate* isolate, const AstRawString* s) {
? Handle<PrimitiveHeapObject>::cast( if (s == nullptr) return isolate->factory()->undefined_value();
isolate->factory()->undefined_value()) return s->string();
: Handle<PrimitiveHeapObject>::cast(s->string().get<Isolate>());
} }
} // namespace } // namespace
Handle<SourceTextModuleInfoEntry> SourceTextModuleDescriptor::Entry::Serialize( template <typename Isolate>
Isolate* isolate) const { HandleFor<Isolate, SourceTextModuleInfoEntry>
SourceTextModuleDescriptor::Entry::Serialize(Isolate* isolate) const {
CHECK(Smi::IsValid(module_request)); // TODO(neis): Check earlier? CHECK(Smi::IsValid(module_request)); // TODO(neis): Check earlier?
return SourceTextModuleInfoEntry::New( return SourceTextModuleInfoEntry::New(
isolate, ToStringOrUndefined(isolate, export_name), isolate, ToStringOrUndefined(isolate, export_name),
...@@ -102,14 +103,20 @@ Handle<SourceTextModuleInfoEntry> SourceTextModuleDescriptor::Entry::Serialize( ...@@ -102,14 +103,20 @@ Handle<SourceTextModuleInfoEntry> SourceTextModuleDescriptor::Entry::Serialize(
ToStringOrUndefined(isolate, import_name), module_request, cell_index, ToStringOrUndefined(isolate, import_name), module_request, cell_index,
location.beg_pos, location.end_pos); location.beg_pos, location.end_pos);
} }
template Handle<SourceTextModuleInfoEntry>
Handle<FixedArray> SourceTextModuleDescriptor::SerializeRegularExports( SourceTextModuleDescriptor::Entry::Serialize(Isolate* isolate) const;
Isolate* isolate, Zone* zone) const { template OffThreadHandle<SourceTextModuleInfoEntry>
SourceTextModuleDescriptor::Entry::Serialize(OffThreadIsolate* isolate) const;
template <typename Isolate>
HandleFor<Isolate, FixedArray>
SourceTextModuleDescriptor::SerializeRegularExports(Isolate* isolate,
Zone* zone) const {
// We serialize regular exports in a way that lets us later iterate over their // We serialize regular exports in a way that lets us later iterate over their
// local names and for each local name immediately access all its export // local names and for each local name immediately access all its export
// names. (Regular exports have neither import name nor module request.) // names. (Regular exports have neither import name nor module request.)
ZoneVector<Handle<Object>> data( ZoneVector<HandleFor<Isolate, Object>> data(
SourceTextModuleInfo::kRegularExportLength * regular_exports_.size(), SourceTextModuleInfo::kRegularExportLength * regular_exports_.size(),
zone); zone);
int index = 0; int index = 0;
...@@ -125,7 +132,8 @@ Handle<FixedArray> SourceTextModuleDescriptor::SerializeRegularExports( ...@@ -125,7 +132,8 @@ Handle<FixedArray> SourceTextModuleDescriptor::SerializeRegularExports(
++count; ++count;
} while (next != regular_exports_.end() && next->first == it->first); } while (next != regular_exports_.end() && next->first == it->first);
Handle<FixedArray> export_names = isolate->factory()->NewFixedArray(count); HandleFor<Isolate, FixedArray> export_names =
isolate->factory()->NewFixedArray(count);
data[index + SourceTextModuleInfo::kRegularExportLocalNameOffset] = data[index + SourceTextModuleInfo::kRegularExportLocalNameOffset] =
it->second->local_name->string(); it->second->local_name->string();
data[index + SourceTextModuleInfo::kRegularExportCellIndexOffset] = data[index + SourceTextModuleInfo::kRegularExportCellIndexOffset] =
...@@ -149,12 +157,18 @@ Handle<FixedArray> SourceTextModuleDescriptor::SerializeRegularExports( ...@@ -149,12 +157,18 @@ Handle<FixedArray> SourceTextModuleDescriptor::SerializeRegularExports(
// We cannot create the FixedArray earlier because we only now know the // We cannot create the FixedArray earlier because we only now know the
// precise size. // precise size.
Handle<FixedArray> result = isolate->factory()->NewFixedArray(index); HandleFor<Isolate, FixedArray> result =
isolate->factory()->NewFixedArray(index);
for (int i = 0; i < index; ++i) { for (int i = 0; i < index; ++i) {
result->set(i, *data[i]); result->set(i, *data[i]);
} }
return result; return result;
} }
template Handle<FixedArray> SourceTextModuleDescriptor::SerializeRegularExports(
Isolate* isolate, Zone* zone) const;
template OffThreadHandle<FixedArray>
SourceTextModuleDescriptor::SerializeRegularExports(OffThreadIsolate* isolate,
Zone* zone) const;
void SourceTextModuleDescriptor::MakeIndirectExportsExplicit(Zone* zone) { void SourceTextModuleDescriptor::MakeIndirectExportsExplicit(Zone* zone) {
for (auto it = regular_exports_.begin(); it != regular_exports_.end();) { for (auto it = regular_exports_.begin(); it != regular_exports_.end();) {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef V8_AST_MODULES_H_ #ifndef V8_AST_MODULES_H_
#define V8_AST_MODULES_H_ #define V8_AST_MODULES_H_
#include "src/handles/handle-for.h"
#include "src/parsing/scanner.h" // Only for Scanner::Location. #include "src/parsing/scanner.h" // Only for Scanner::Location.
#include "src/zone/zone-containers.h" #include "src/zone/zone-containers.h"
...@@ -107,7 +108,9 @@ class SourceTextModuleDescriptor : public ZoneObject { ...@@ -107,7 +108,9 @@ class SourceTextModuleDescriptor : public ZoneObject {
module_request(-1), module_request(-1),
cell_index(0) {} cell_index(0) {}
Handle<SourceTextModuleInfoEntry> Serialize(Isolate* isolate) const; template <typename Isolate>
HandleFor<Isolate, SourceTextModuleInfoEntry> Serialize(
Isolate* isolate) const;
}; };
enum CellIndexKind { kInvalid, kExport, kImport }; enum CellIndexKind { kInvalid, kExport, kImport };
...@@ -184,8 +187,9 @@ class SourceTextModuleDescriptor : public ZoneObject { ...@@ -184,8 +187,9 @@ class SourceTextModuleDescriptor : public ZoneObject {
namespace_imports_.push_back(entry); namespace_imports_.push_back(entry);
} }
Handle<FixedArray> SerializeRegularExports(Isolate* isolate, template <typename Isolate>
Zone* zone) const; HandleFor<Isolate, FixedArray> SerializeRegularExports(Isolate* isolate,
Zone* zone) const;
private: private:
ModuleRequestMap module_requests_; ModuleRequestMap module_requests_;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "src/base/optional.h" #include "src/base/optional.h"
#include "src/builtins/accessors.h" #include "src/builtins/accessors.h"
#include "src/common/message-template.h" #include "src/common/message-template.h"
#include "src/heap/off-thread-factory-inl.h"
#include "src/init/bootstrapper.h" #include "src/init/bootstrapper.h"
#include "src/logging/counters.h" #include "src/logging/counters.h"
#include "src/objects/module-inl.h" #include "src/objects/module-inl.h"
...@@ -835,7 +836,8 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name, Scope* cache) { ...@@ -835,7 +836,8 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name, Scope* cache) {
DCHECK_NULL(cache->variables_.Lookup(name)); DCHECK_NULL(cache->variables_.Lookup(name));
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
String name_handle = *name->string().get<Isolate>(); String name_handle = *name->string().get_handle();
ScopeInfo scope_info = *scope_info_.get_handle();
// The Scope is backed up by ScopeInfo. This means it cannot operate in a // The Scope is backed up by ScopeInfo. This means it cannot operate in a
// heap-independent mode, and all strings must be internalized immediately. So // heap-independent mode, and all strings must be internalized immediately. So
// it's ok to get the Handle<String> here. // it's ok to get the Handle<String> here.
...@@ -850,21 +852,21 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name, Scope* cache) { ...@@ -850,21 +852,21 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name, Scope* cache) {
{ {
location = VariableLocation::CONTEXT; location = VariableLocation::CONTEXT;
index = ScopeInfo::ContextSlotIndex(*scope_info_, name_handle, &mode, index =
&init_flag, &maybe_assigned_flag, ScopeInfo::ContextSlotIndex(scope_info, name_handle, &mode, &init_flag,
&is_static_flag); &maybe_assigned_flag, &is_static_flag);
found = index >= 0; found = index >= 0;
} }
if (!found && is_module_scope()) { if (!found && is_module_scope()) {
location = VariableLocation::MODULE; location = VariableLocation::MODULE;
index = scope_info_->ModuleIndex(name_handle, &mode, &init_flag, index = scope_info.ModuleIndex(name_handle, &mode, &init_flag,
&maybe_assigned_flag); &maybe_assigned_flag);
found = index != 0; found = index != 0;
} }
if (!found) { if (!found) {
index = scope_info_->FunctionContextSlotIndex(name_handle); index = scope_info.FunctionContextSlotIndex(name_handle);
if (index < 0) return nullptr; // Nowhere found. if (index < 0) return nullptr; // Nowhere found.
Variable* var = AsDeclarationScope()->DeclareFunctionVar(name, cache); Variable* var = AsDeclarationScope()->DeclareFunctionVar(name, cache);
DCHECK_EQ(VariableMode::kConst, var->mode()); DCHECK_EQ(VariableMode::kConst, var->mode());
...@@ -873,7 +875,7 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name, Scope* cache) { ...@@ -873,7 +875,7 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name, Scope* cache) {
} }
if (!is_module_scope()) { if (!is_module_scope()) {
DCHECK_NE(index, scope_info_->ReceiverContextSlotIndex()); DCHECK_NE(index, scope_info.ReceiverContextSlotIndex());
} }
bool was_added; bool was_added;
...@@ -1220,7 +1222,7 @@ void DeclarationScope::DeserializeReceiver(AstValueFactory* ast_value_factory) { ...@@ -1220,7 +1222,7 @@ void DeclarationScope::DeserializeReceiver(AstValueFactory* ast_value_factory) {
receiver_->AllocateTo(VariableLocation::LOOKUP, -1); receiver_->AllocateTo(VariableLocation::LOOKUP, -1);
} else { } else {
receiver_->AllocateTo(VariableLocation::CONTEXT, receiver_->AllocateTo(VariableLocation::CONTEXT,
scope_info_->ReceiverContextSlotIndex()); scope_info_.get_handle()->ReceiverContextSlotIndex());
} }
} }
...@@ -2449,10 +2451,11 @@ void Scope::AllocateVariablesRecursively() { ...@@ -2449,10 +2451,11 @@ void Scope::AllocateVariablesRecursively() {
}); });
} }
void Scope::AllocateScopeInfosRecursively(Isolate* isolate, template <typename Isolate>
MaybeHandle<ScopeInfo> outer_scope) { void Scope::AllocateScopeInfosRecursively(
Isolate* isolate, MaybeHandleFor<Isolate, ScopeInfo> outer_scope) {
DCHECK(scope_info_.is_null()); DCHECK(scope_info_.is_null());
MaybeHandle<ScopeInfo> next_outer_scope = outer_scope; MaybeHandleFor<Isolate, ScopeInfo> next_outer_scope = outer_scope;
if (NeedsScopeInfo()) { if (NeedsScopeInfo()) {
scope_info_ = ScopeInfo::Create(isolate, zone(), this, outer_scope); scope_info_ = ScopeInfo::Create(isolate, zone(), this, outer_scope);
...@@ -2470,6 +2473,13 @@ void Scope::AllocateScopeInfosRecursively(Isolate* isolate, ...@@ -2470,6 +2473,13 @@ void Scope::AllocateScopeInfosRecursively(Isolate* isolate,
} }
} }
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) void Scope::
AllocateScopeInfosRecursively<Isolate>(Isolate* isolate,
MaybeHandle<ScopeInfo> outer_scope);
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) void Scope::
AllocateScopeInfosRecursively<OffThreadIsolate>(
OffThreadIsolate* isolate, OffThreadHandle<ScopeInfo> outer_scope);
void DeclarationScope::RecalcPrivateNameContextChain() { void DeclarationScope::RecalcPrivateNameContextChain() {
// The outermost scope in a class heritage expression is marked to skip the // The outermost scope in a class heritage expression is marked to skip the
// class scope during private name resolution. It is possible, however, that // class scope during private name resolution. It is possible, however, that
...@@ -2512,14 +2522,16 @@ void DeclarationScope::RecordNeedsPrivateNameContextChainRecalc() { ...@@ -2512,14 +2522,16 @@ void DeclarationScope::RecordNeedsPrivateNameContextChainRecalc() {
} }
// static // static
template <typename Isolate>
void DeclarationScope::AllocateScopeInfos(ParseInfo* info, Isolate* isolate) { void DeclarationScope::AllocateScopeInfos(ParseInfo* info, Isolate* isolate) {
DeclarationScope* scope = info->literal()->scope(); DeclarationScope* scope = info->literal()->scope();
// No one else should have allocated a scope info for this scope yet. // No one else should have allocated a scope info for this scope yet.
DCHECK(scope->scope_info_.is_null()); DCHECK(scope->scope_info_.is_null());
MaybeHandle<ScopeInfo> outer_scope; MaybeHandleFor<Isolate, ScopeInfo> outer_scope;
if (scope->outer_scope_ != nullptr) { if (scope->outer_scope_ != nullptr) {
DCHECK((std::is_same<Isolate, v8::internal::Isolate>::value));
outer_scope = scope->outer_scope_->scope_info_; outer_scope = scope->outer_scope_->scope_info_;
} }
...@@ -2540,11 +2552,15 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* info, Isolate* isolate) { ...@@ -2540,11 +2552,15 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* info, Isolate* isolate) {
// Ensuring that the outer script scope has a scope info avoids having // Ensuring that the outer script scope has a scope info avoids having
// special case for native contexts vs other contexts. // special case for native contexts vs other contexts.
if (info->script_scope() && info->script_scope()->scope_info_.is_null()) { if (info->script_scope() && info->script_scope()->scope_info_.is_null()) {
info->script_scope()->scope_info_ = info->script_scope()->scope_info_ = isolate->factory()->empty_scope_info();
handle(ScopeInfo::Empty(isolate), isolate);
} }
} }
template V8_EXPORT_PRIVATE void DeclarationScope::AllocateScopeInfos<Isolate>(
ParseInfo* info, Isolate* isolate);
template V8_EXPORT_PRIVATE void DeclarationScope::AllocateScopeInfos<
OffThreadIsolate>(ParseInfo* info, OffThreadIsolate* isolate);
int Scope::ContextLocalCount() const { int Scope::ContextLocalCount() const {
if (num_heap_slots() == 0) return 0; if (num_heap_slots() == 0) return 0;
Variable* function = Variable* function =
...@@ -2655,14 +2671,14 @@ Variable* ClassScope::LookupPrivateNameInScopeInfo(const AstRawString* name) { ...@@ -2655,14 +2671,14 @@ Variable* ClassScope::LookupPrivateNameInScopeInfo(const AstRawString* name) {
DCHECK_NULL(LookupLocalPrivateName(name)); DCHECK_NULL(LookupLocalPrivateName(name));
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
String name_handle = *name->string().get<Isolate>(); String name_handle = *name->string().get_handle();
VariableMode mode; VariableMode mode;
InitializationFlag init_flag; InitializationFlag init_flag;
MaybeAssignedFlag maybe_assigned_flag; MaybeAssignedFlag maybe_assigned_flag;
IsStaticFlag is_static_flag; IsStaticFlag is_static_flag;
int index = int index = ScopeInfo::ContextSlotIndex(
ScopeInfo::ContextSlotIndex(*scope_info_, name_handle, &mode, &init_flag, *scope_info_.get_handle(), name_handle, &mode, &init_flag,
&maybe_assigned_flag, &is_static_flag); &maybe_assigned_flag, &is_static_flag);
if (index < 0) { if (index < 0) {
return nullptr; return nullptr;
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "src/base/hashmap.h" #include "src/base/hashmap.h"
#include "src/base/threaded-list.h" #include "src/base/threaded-list.h"
#include "src/common/globals.h" #include "src/common/globals.h"
#include "src/handles/handle-for.h"
#include "src/objects/function-kind.h" #include "src/objects/function-kind.h"
#include "src/objects/objects.h" #include "src/objects/objects.h"
#include "src/utils/pointer-with-payload.h" #include "src/utils/pointer-with-payload.h"
...@@ -520,7 +521,7 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { ...@@ -520,7 +521,7 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
bool HasThisReference() const; bool HasThisReference() const;
// Analyze() must have been called once to create the ScopeInfo. // Analyze() must have been called once to create the ScopeInfo.
Handle<ScopeInfo> scope_info() const { HandleOrOffThreadHandle<ScopeInfo> scope_info() const {
DCHECK(!scope_info_.is_null()); DCHECK(!scope_info_.is_null());
return scope_info_; return scope_info_;
} }
...@@ -670,8 +671,9 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { ...@@ -670,8 +671,9 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
V8_INLINE void AllocateNonParameterLocalsAndDeclaredGlobals(); V8_INLINE void AllocateNonParameterLocalsAndDeclaredGlobals();
void AllocateVariablesRecursively(); void AllocateVariablesRecursively();
void AllocateScopeInfosRecursively(Isolate* isolate, template <typename Isolate>
MaybeHandle<ScopeInfo> outer_scope); void AllocateScopeInfosRecursively(
Isolate* isolate, MaybeHandleFor<Isolate, ScopeInfo> outer_scope);
void AllocateDebuggerScopeInfos(Isolate* isolate, void AllocateDebuggerScopeInfos(Isolate* isolate,
MaybeHandle<ScopeInfo> outer_scope); MaybeHandle<ScopeInfo> outer_scope);
...@@ -691,6 +693,9 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { ...@@ -691,6 +693,9 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
void SetDefaults(); void SetDefaults();
void set_scope_info(Handle<ScopeInfo> scope_info);
void set_scope_info(OffThreadHandle<ScopeInfo> scope_info);
friend class DeclarationScope; friend class DeclarationScope;
friend class ClassScope; friend class ClassScope;
friend class ScopeTestHelper; friend class ScopeTestHelper;
...@@ -718,7 +723,7 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { ...@@ -718,7 +723,7 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
base::ThreadedList<Declaration> decls_; base::ThreadedList<Declaration> decls_;
// Serialized scope info support. // Serialized scope info support.
Handle<ScopeInfo> scope_info_; HandleOrOffThreadHandle<ScopeInfo> scope_info_;
// Debugging support. // Debugging support.
#ifdef DEBUG #ifdef DEBUG
const AstRawString* scope_name_; const AstRawString* scope_name_;
...@@ -1098,7 +1103,9 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope { ...@@ -1098,7 +1103,9 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
// Allocate ScopeInfos for top scope and any inner scopes that need them. // Allocate ScopeInfos for top scope and any inner scopes that need them.
// Does nothing if ScopeInfo is already allocated. // Does nothing if ScopeInfo is already allocated.
static void AllocateScopeInfos(ParseInfo* info, Isolate* isolate); template <typename Isolate>
V8_EXPORT_PRIVATE static void AllocateScopeInfos(ParseInfo* info,
Isolate* isolate);
Handle<StringSet> CollectNonLocals(Isolate* isolate, ParseInfo* info, Handle<StringSet> CollectNonLocals(Isolate* isolate, ParseInfo* info,
Handle<StringSet> non_locals); Handle<StringSet> non_locals);
......
...@@ -58,7 +58,7 @@ class Variable final : public ZoneObject { ...@@ -58,7 +58,7 @@ class Variable final : public ZoneObject {
// parameter initializers. // parameter initializers.
void set_scope(Scope* scope) { scope_ = scope; } void set_scope(Scope* scope) { scope_ = scope; }
Handle<String> name() const { return name_->string(); } HandleOrOffThreadHandle<String> name() const { return name_->string(); }
const AstRawString* raw_name() const { return name_; } const AstRawString* raw_name() const { return name_; }
VariableMode mode() const { return VariableModeField::decode(bit_field_); } VariableMode mode() const { return VariableModeField::decode(bit_field_); }
void set_mode(VariableMode mode) { void set_mode(VariableMode mode) {
......
...@@ -629,6 +629,8 @@ class NewSpace; ...@@ -629,6 +629,8 @@ class NewSpace;
class NewLargeObjectSpace; class NewLargeObjectSpace;
class NumberDictionary; class NumberDictionary;
class Object; class Object;
template <typename T>
class OffThreadHandle;
class OldLargeObjectSpace; class OldLargeObjectSpace;
template <HeapObjectReferenceType kRefType, typename StorageType> template <HeapObjectReferenceType kRefType, typename StorageType>
class TaggedImpl; class TaggedImpl;
......
...@@ -769,7 +769,7 @@ bool ScopeIterator::VisitLocals(const Visitor& visitor, Mode mode) const { ...@@ -769,7 +769,7 @@ bool ScopeIterator::VisitLocals(const Visitor& visitor, Mode mode) const {
for (Variable* var : *current_scope_->locals()) { for (Variable* var : *current_scope_->locals()) {
DCHECK(!var->is_this()); DCHECK(!var->is_this());
if (ScopeInfo::VariableIsSynthetic(*var->name())) continue; if (ScopeInfo::VariableIsSynthetic(*var->name().get_handle())) continue;
int index = var->index(); int index = var->index();
Handle<Object> value; Handle<Object> value;
......
...@@ -663,7 +663,7 @@ bool HasChangedScope(FunctionLiteral* a, FunctionLiteral* b) { ...@@ -663,7 +663,7 @@ bool HasChangedScope(FunctionLiteral* a, FunctionLiteral* b) {
if (!var->IsContextSlot()) continue; if (!var->IsContextSlot()) continue;
auto it = vars.find(var->index()); auto it = vars.find(var->index());
if (it == vars.end()) return true; if (it == vars.end()) return true;
if (*it->second != *var->name()) return true; if (*it->second != *var->name().get_handle()) return true;
} }
scope_a = scope_a->outer_scope(); scope_a = scope_a->outer_scope();
scope_b = scope_b->outer_scope(); scope_b = scope_b->outer_scope();
......
...@@ -11,8 +11,10 @@ ...@@ -11,8 +11,10 @@
#include "src/heap/off-thread-factory-inl.h" #include "src/heap/off-thread-factory-inl.h"
#include "src/heap/read-only-heap.h" #include "src/heap/read-only-heap.h"
#include "src/objects/literal-objects-inl.h" #include "src/objects/literal-objects-inl.h"
#include "src/objects/module-inl.h"
#include "src/objects/oddball.h" #include "src/objects/oddball.h"
#include "src/objects/shared-function-info-inl.h" #include "src/objects/shared-function-info-inl.h"
#include "src/objects/source-text-module.h"
#include "src/objects/template-objects-inl.h" #include "src/objects/template-objects-inl.h"
namespace v8 { namespace v8 {
...@@ -349,6 +351,22 @@ HandleFor<Impl, FreshlyAllocatedBigInt> FactoryBase<Impl>::NewBigInt( ...@@ -349,6 +351,22 @@ HandleFor<Impl, FreshlyAllocatedBigInt> FactoryBase<Impl>::NewBigInt(
return handle(bigint, isolate()); return handle(bigint, isolate());
} }
template <typename Impl>
HandleFor<Impl, ScopeInfo> FactoryBase<Impl>::NewScopeInfo(
int length, AllocationType type) {
DCHECK(type == AllocationType::kOld || type == AllocationType::kReadOnly);
return HandleFor<Impl, ScopeInfo>::cast(
NewFixedArrayWithMap(read_only_roots().scope_info_map(), length, type));
}
template <typename Impl>
HandleFor<Impl, SourceTextModuleInfo>
FactoryBase<Impl>::NewSourceTextModuleInfo() {
return HandleFor<Impl, SourceTextModuleInfo>::cast(NewFixedArrayWithMap(
read_only_roots().module_info_map(), SourceTextModuleInfo::kLength,
AllocationType::kOld));
}
template <typename Impl> template <typename Impl>
HandleFor<Impl, SeqOneByteString> HandleFor<Impl, SeqOneByteString>
FactoryBase<Impl>::AllocateRawOneByteInternalizedString(int length, FactoryBase<Impl>::AllocateRawOneByteInternalizedString(int length,
......
...@@ -21,6 +21,7 @@ class FreshlyAllocatedBigInt; ...@@ -21,6 +21,7 @@ class FreshlyAllocatedBigInt;
class ObjectBoilerplateDescription; class ObjectBoilerplateDescription;
class ArrayBoilerplateDescription; class ArrayBoilerplateDescription;
class TemplateObjectDescription; class TemplateObjectDescription;
class SourceTextModuleInfo;
template <typename Impl> template <typename Impl>
class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) FactoryBase { class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) FactoryBase {
...@@ -120,6 +121,12 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) FactoryBase { ...@@ -120,6 +121,12 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) FactoryBase {
HandleFor<Impl, FreshlyAllocatedBigInt> NewBigInt( HandleFor<Impl, FreshlyAllocatedBigInt> NewBigInt(
int length, AllocationType allocation = AllocationType::kYoung); int length, AllocationType allocation = AllocationType::kYoung);
// Create a serialized scope info.
HandleFor<Impl, ScopeInfo> NewScopeInfo(
int length, AllocationType type = AllocationType::kOld);
HandleFor<Impl, SourceTextModuleInfo> NewSourceTextModuleInfo();
protected: protected:
// Allocate memory for an uninitialized array (e.g., a FixedArray or similar). // Allocate memory for an uninitialized array (e.g., a FixedArray or similar).
HeapObject AllocateRawArray(int size, AllocationType allocation); HeapObject AllocateRawArray(int size, AllocationType allocation);
......
...@@ -2155,18 +2155,6 @@ Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( ...@@ -2155,18 +2155,6 @@ Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
return result; return result;
} }
Handle<ScopeInfo> Factory::NewScopeInfo(int length, AllocationType type) {
DCHECK(type == AllocationType::kOld || type == AllocationType::kReadOnly);
return Handle<ScopeInfo>::cast(
NewFixedArrayWithMap(read_only_roots().scope_info_map(), length, type));
}
Handle<SourceTextModuleInfo> Factory::NewSourceTextModuleInfo() {
return Handle<SourceTextModuleInfo>::cast(NewFixedArrayWithMap(
read_only_roots().module_info_map(), SourceTextModuleInfo::kLength,
AllocationType::kOld));
}
Handle<PreparseData> Factory::NewPreparseData(int data_length, Handle<PreparseData> Factory::NewPreparseData(int data_length,
int children_length) { int children_length) {
int size = PreparseData::SizeFor(data_length, children_length); int size = PreparseData::SizeFor(data_length, children_length);
......
...@@ -60,7 +60,6 @@ class PromiseResolveThenableJobTask; ...@@ -60,7 +60,6 @@ class PromiseResolveThenableJobTask;
class RegExpMatchInfo; class RegExpMatchInfo;
class ScriptContextTable; class ScriptContextTable;
class SourceTextModule; class SourceTextModule;
class SourceTextModuleInfo;
class StackFrameInfo; class StackFrameInfo;
class StackTraceFrame; class StackTraceFrame;
class StoreHandler; class StoreHandler;
...@@ -677,12 +676,6 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> { ...@@ -677,12 +676,6 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
Handle<Map> map, Handle<SharedFunctionInfo> info, Handle<Context> context, Handle<Map> map, Handle<SharedFunctionInfo> info, Handle<Context> context,
AllocationType allocation = AllocationType::kOld); AllocationType allocation = AllocationType::kOld);
// Create a serialized scope info.
Handle<ScopeInfo> NewScopeInfo(int length,
AllocationType type = AllocationType::kOld);
Handle<SourceTextModuleInfo> NewSourceTextModuleInfo();
Handle<PreparseData> NewPreparseData(int data_length, int children_length); Handle<PreparseData> NewPreparseData(int data_length, int children_length);
Handle<UncompiledDataWithoutPreparseData> Handle<UncompiledDataWithoutPreparseData>
......
...@@ -5351,7 +5351,8 @@ void SharedFunctionInfo::InitFromFunctionLiteral( ...@@ -5351,7 +5351,8 @@ void SharedFunctionInfo::InitFromFunctionLiteral(
if (!is_toplevel) { if (!is_toplevel) {
Scope* outer_scope = lit->scope()->GetOuterScopeWithContext(); Scope* outer_scope = lit->scope()->GetOuterScopeWithContext();
if (outer_scope) { if (outer_scope) {
shared_info->set_outer_scope_info(*outer_scope->scope_info()); shared_info->set_outer_scope_info(
*outer_scope->scope_info().get_handle());
shared_info->set_private_name_lookup_skips_outer_class( shared_info->set_private_name_lookup_skips_outer_class(
lit->scope()->private_name_lookup_skips_outer_class()); lit->scope()->private_name_lookup_skips_outer_class());
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "src/objects/module-inl.h" #include "src/objects/module-inl.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"
#include "src/roots/roots.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -60,8 +61,10 @@ bool ScopeInfo::Equals(ScopeInfo other) const { ...@@ -60,8 +61,10 @@ bool ScopeInfo::Equals(ScopeInfo other) const {
#endif #endif
// static // static
Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope, template <typename Isolate>
MaybeHandle<ScopeInfo> outer_scope) { HandleFor<Isolate, ScopeInfo> ScopeInfo::Create(
Isolate* isolate, Zone* zone, Scope* scope,
MaybeHandleFor<Isolate, ScopeInfo> outer_scope) {
// Collect variables. // Collect variables.
int context_local_count = 0; int context_local_count = 0;
int module_vars_count = 0; int module_vars_count = 0;
...@@ -165,7 +168,7 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope, ...@@ -165,7 +168,7 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
? 2 + kModuleVariableEntryLength * module_vars_count ? 2 + kModuleVariableEntryLength * module_vars_count
: 0); : 0);
Handle<ScopeInfo> scope_info_handle = HandleFor<Isolate, ScopeInfo> scope_info_handle =
isolate->factory()->NewScopeInfo(length); isolate->factory()->NewScopeInfo(length);
int index = kVariablePartIndex; int index = kVariablePartIndex;
{ {
...@@ -239,14 +242,15 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope, ...@@ -239,14 +242,15 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
MaybeAssignedFlagField::encode(var->maybe_assigned()) | MaybeAssignedFlagField::encode(var->maybe_assigned()) |
ParameterNumberField::encode(ParameterNumberField::kMax) | ParameterNumberField::encode(ParameterNumberField::kMax) |
IsStaticFlagField::encode(var->is_static_flag()); IsStaticFlagField::encode(var->is_static_flag());
scope_info.set(context_local_base + local_index, *var->name(), mode); scope_info.set(context_local_base + local_index,
*var->name().get<Isolate>(), mode);
scope_info.set(context_local_info_base + local_index, scope_info.set(context_local_info_base + local_index,
Smi::FromInt(info)); Smi::FromInt(info));
break; break;
} }
case VariableLocation::MODULE: { case VariableLocation::MODULE: {
scope_info.set(module_var_entry + kModuleVariableNameOffset, scope_info.set(module_var_entry + kModuleVariableNameOffset,
*var->name(), mode); *var->name().get<Isolate>(), mode);
scope_info.set(module_var_entry + kModuleVariableIndexOffset, scope_info.set(module_var_entry + kModuleVariableIndexOffset,
Smi::FromInt(var->index())); Smi::FromInt(var->index()));
uint32_t properties = uint32_t properties =
...@@ -294,7 +298,8 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope, ...@@ -294,7 +298,8 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
MaybeAssignedFlagField::encode(var->maybe_assigned()) | MaybeAssignedFlagField::encode(var->maybe_assigned()) |
ParameterNumberField::encode(ParameterNumberField::kMax) | ParameterNumberField::encode(ParameterNumberField::kMax) |
IsStaticFlagField::encode(var->is_static_flag()); IsStaticFlagField::encode(var->is_static_flag());
scope_info.set(context_local_base + local_index, *var->name(), mode); scope_info.set(context_local_base + local_index,
*var->name().get<Isolate>(), mode);
scope_info.set(context_local_info_base + local_index, scope_info.set(context_local_info_base + local_index,
Smi::FromInt(info)); Smi::FromInt(info));
} }
...@@ -330,7 +335,7 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope, ...@@ -330,7 +335,7 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
Object name = Smi::zero(); Object name = Smi::zero();
if (var != nullptr) { if (var != nullptr) {
var_index = var->index(); var_index = var->index();
name = *var->name(); name = *var->name().get<Isolate>();
} }
scope_info.set(index++, name, mode); scope_info.set(index++, name, mode);
scope_info.set(index++, Smi::FromInt(var_index)); scope_info.set(index++, Smi::FromInt(var_index));
...@@ -359,8 +364,9 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope, ...@@ -359,8 +364,9 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
// Module-specific information (only for module scopes). // Module-specific information (only for module scopes).
if (scope->is_module_scope()) { if (scope->is_module_scope()) {
Handle<SourceTextModuleInfo> module_info = SourceTextModuleInfo::New( HandleFor<Isolate, SourceTextModuleInfo> module_info =
isolate, zone, scope->AsModuleScope()->module()); SourceTextModuleInfo::New(isolate, zone,
scope->AsModuleScope()->module());
DCHECK_EQ(index, scope_info_handle->ModuleInfoIndex()); DCHECK_EQ(index, scope_info_handle->ModuleInfoIndex());
scope_info_handle->set(index++, *module_info); scope_info_handle->set(index++, *module_info);
DCHECK_EQ(index, scope_info_handle->ModuleVariableCountIndex()); DCHECK_EQ(index, scope_info_handle->ModuleVariableCountIndex());
...@@ -376,6 +382,15 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope, ...@@ -376,6 +382,15 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
return scope_info_handle; return scope_info_handle;
} }
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE)
Handle<ScopeInfo> ScopeInfo::Create<Isolate>(
Isolate* isolate, Zone* zone, Scope* scope,
MaybeHandle<ScopeInfo> outer_scope);
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE)
OffThreadHandle<ScopeInfo> ScopeInfo::Create<OffThreadIsolate>(
OffThreadIsolate* isolate, Zone* zone, Scope* scope,
OffThreadHandle<ScopeInfo> outer_scope);
// static // static
Handle<ScopeInfo> ScopeInfo::CreateForWithScope( Handle<ScopeInfo> ScopeInfo::CreateForWithScope(
Isolate* isolate, MaybeHandle<ScopeInfo> outer_scope) { Isolate* isolate, MaybeHandle<ScopeInfo> outer_scope) {
...@@ -1031,14 +1046,16 @@ std::ostream& operator<<(std::ostream& os, VariableAllocationInfo var_info) { ...@@ -1031,14 +1046,16 @@ std::ostream& operator<<(std::ostream& os, VariableAllocationInfo var_info) {
return os; return os;
} }
Handle<SourceTextModuleInfoEntry> SourceTextModuleInfoEntry::New( template <typename Isolate>
Isolate* isolate, Handle<PrimitiveHeapObject> export_name, HandleFor<Isolate, SourceTextModuleInfoEntry> SourceTextModuleInfoEntry::New(
Handle<PrimitiveHeapObject> local_name, Isolate* isolate, HandleFor<Isolate, PrimitiveHeapObject> export_name,
Handle<PrimitiveHeapObject> import_name, int module_request, int cell_index, HandleFor<Isolate, PrimitiveHeapObject> local_name,
int beg_pos, int end_pos) { HandleFor<Isolate, PrimitiveHeapObject> import_name, int module_request,
Handle<SourceTextModuleInfoEntry> result = int cell_index, int beg_pos, int end_pos) {
Handle<SourceTextModuleInfoEntry>::cast(isolate->factory()->NewStruct( HandleFor<Isolate, SourceTextModuleInfoEntry> result =
SOURCE_TEXT_MODULE_INFO_ENTRY_TYPE, AllocationType::kOld)); HandleFor<Isolate, SourceTextModuleInfoEntry>::cast(
isolate->factory()->NewStruct(SOURCE_TEXT_MODULE_INFO_ENTRY_TYPE,
AllocationType::kOld));
result->set_export_name(*export_name); result->set_export_name(*export_name);
result->set_local_name(*local_name); result->set_local_name(*local_name);
result->set_import_name(*import_name); result->set_import_name(*import_name);
...@@ -1049,12 +1066,27 @@ Handle<SourceTextModuleInfoEntry> SourceTextModuleInfoEntry::New( ...@@ -1049,12 +1066,27 @@ Handle<SourceTextModuleInfoEntry> SourceTextModuleInfoEntry::New(
return result; return result;
} }
Handle<SourceTextModuleInfo> SourceTextModuleInfo::New( template Handle<SourceTextModuleInfoEntry> SourceTextModuleInfoEntry::New(
Isolate* isolate, Handle<PrimitiveHeapObject> export_name,
Handle<PrimitiveHeapObject> local_name,
Handle<PrimitiveHeapObject> import_name, int module_request, int cell_index,
int beg_pos, int end_pos);
template OffThreadHandle<SourceTextModuleInfoEntry>
SourceTextModuleInfoEntry::New(OffThreadIsolate* isolate,
OffThreadHandle<PrimitiveHeapObject> export_name,
OffThreadHandle<PrimitiveHeapObject> local_name,
OffThreadHandle<PrimitiveHeapObject> import_name,
int module_request, int cell_index, int beg_pos,
int end_pos);
template <typename Isolate>
HandleFor<Isolate, SourceTextModuleInfo> SourceTextModuleInfo::New(
Isolate* isolate, Zone* zone, SourceTextModuleDescriptor* descr) { Isolate* isolate, Zone* zone, SourceTextModuleDescriptor* descr) {
// Serialize module requests. // Serialize module requests.
int size = static_cast<int>(descr->module_requests().size()); int size = static_cast<int>(descr->module_requests().size());
Handle<FixedArray> module_requests = isolate->factory()->NewFixedArray(size); HandleFor<Isolate, FixedArray> module_requests =
Handle<FixedArray> module_request_positions = isolate->factory()->NewFixedArray(size);
HandleFor<Isolate, FixedArray> module_request_positions =
isolate->factory()->NewFixedArray(size); isolate->factory()->NewFixedArray(size);
for (const auto& elem : descr->module_requests()) { for (const auto& elem : descr->module_requests()) {
module_requests->set(elem.second.index, module_requests->set(elem.second.index,
...@@ -1064,46 +1096,49 @@ Handle<SourceTextModuleInfo> SourceTextModuleInfo::New( ...@@ -1064,46 +1096,49 @@ Handle<SourceTextModuleInfo> SourceTextModuleInfo::New(
} }
// Serialize special exports. // Serialize special exports.
Handle<FixedArray> special_exports = isolate->factory()->NewFixedArray( HandleFor<Isolate, FixedArray> special_exports =
static_cast<int>(descr->special_exports().size())); isolate->factory()->NewFixedArray(
static_cast<int>(descr->special_exports().size()));
{ {
int i = 0; int i = 0;
for (auto entry : descr->special_exports()) { for (auto entry : descr->special_exports()) {
Handle<SourceTextModuleInfoEntry> serialized_entry = HandleFor<Isolate, SourceTextModuleInfoEntry> serialized_entry =
entry->Serialize(isolate); entry->Serialize(isolate);
special_exports->set(i++, *serialized_entry); special_exports->set(i++, *serialized_entry);
} }
} }
// Serialize namespace imports. // Serialize namespace imports.
Handle<FixedArray> namespace_imports = isolate->factory()->NewFixedArray( HandleFor<Isolate, FixedArray> namespace_imports =
static_cast<int>(descr->namespace_imports().size())); isolate->factory()->NewFixedArray(
static_cast<int>(descr->namespace_imports().size()));
{ {
int i = 0; int i = 0;
for (auto entry : descr->namespace_imports()) { for (auto entry : descr->namespace_imports()) {
Handle<SourceTextModuleInfoEntry> serialized_entry = HandleFor<Isolate, SourceTextModuleInfoEntry> serialized_entry =
entry->Serialize(isolate); entry->Serialize(isolate);
namespace_imports->set(i++, *serialized_entry); namespace_imports->set(i++, *serialized_entry);
} }
} }
// Serialize regular exports. // Serialize regular exports.
Handle<FixedArray> regular_exports = HandleFor<Isolate, FixedArray> regular_exports =
descr->SerializeRegularExports(isolate, zone); descr->SerializeRegularExports(isolate, zone);
// Serialize regular imports. // Serialize regular imports.
Handle<FixedArray> regular_imports = isolate->factory()->NewFixedArray( HandleFor<Isolate, FixedArray> regular_imports =
static_cast<int>(descr->regular_imports().size())); isolate->factory()->NewFixedArray(
static_cast<int>(descr->regular_imports().size()));
{ {
int i = 0; int i = 0;
for (const auto& elem : descr->regular_imports()) { for (const auto& elem : descr->regular_imports()) {
Handle<SourceTextModuleInfoEntry> serialized_entry = HandleFor<Isolate, SourceTextModuleInfoEntry> serialized_entry =
elem.second->Serialize(isolate); elem.second->Serialize(isolate);
regular_imports->set(i++, *serialized_entry); regular_imports->set(i++, *serialized_entry);
} }
} }
Handle<SourceTextModuleInfo> result = HandleFor<Isolate, SourceTextModuleInfo> result =
isolate->factory()->NewSourceTextModuleInfo(); isolate->factory()->NewSourceTextModuleInfo();
result->set(kModuleRequestsIndex, *module_requests); result->set(kModuleRequestsIndex, *module_requests);
result->set(kSpecialExportsIndex, *special_exports); result->set(kSpecialExportsIndex, *special_exports);
...@@ -1113,6 +1148,10 @@ Handle<SourceTextModuleInfo> SourceTextModuleInfo::New( ...@@ -1113,6 +1148,10 @@ Handle<SourceTextModuleInfo> SourceTextModuleInfo::New(
result->set(kModuleRequestPositionsIndex, *module_request_positions); result->set(kModuleRequestPositionsIndex, *module_request_positions);
return result; return result;
} }
template Handle<SourceTextModuleInfo> SourceTextModuleInfo::New(
Isolate* isolate, Zone* zone, SourceTextModuleDescriptor* descr);
template OffThreadHandle<SourceTextModuleInfo> SourceTextModuleInfo::New(
OffThreadIsolate* isolate, Zone* zone, SourceTextModuleDescriptor* descr);
int SourceTextModuleInfo::RegularExportCount() const { int SourceTextModuleInfo::RegularExportCount() const {
DCHECK_EQ(regular_exports().length() % kRegularExportLength, 0); DCHECK_EQ(regular_exports().length() % kRegularExportLength, 0);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define V8_OBJECTS_SCOPE_INFO_H_ #define V8_OBJECTS_SCOPE_INFO_H_
#include "src/common/globals.h" #include "src/common/globals.h"
#include "src/handles/handle-for.h"
#include "src/objects/fixed-array.h" #include "src/objects/fixed-array.h"
#include "src/objects/function-kind.h" #include "src/objects/function-kind.h"
#include "src/objects/objects.h" #include "src/objects/objects.h"
...@@ -218,8 +219,10 @@ class ScopeInfo : public FixedArray, public TorqueGeneratedScopeFlagsFields { ...@@ -218,8 +219,10 @@ class ScopeInfo : public FixedArray, public TorqueGeneratedScopeFlagsFields {
bool Equals(ScopeInfo other) const; bool Equals(ScopeInfo other) const;
#endif #endif
static Handle<ScopeInfo> Create(Isolate* isolate, Zone* zone, Scope* scope, template <typename Isolate>
MaybeHandle<ScopeInfo> outer_scope); static HandleFor<Isolate, ScopeInfo> Create(
Isolate* isolate, Zone* zone, Scope* scope,
MaybeHandleFor<Isolate, ScopeInfo> outer_scope);
static Handle<ScopeInfo> CreateForWithScope( static Handle<ScopeInfo> CreateForWithScope(
Isolate* isolate, MaybeHandle<ScopeInfo> outer_scope); Isolate* isolate, MaybeHandle<ScopeInfo> outer_scope);
V8_EXPORT_PRIVATE static Handle<ScopeInfo> CreateForEmptyFunction( V8_EXPORT_PRIVATE static Handle<ScopeInfo> CreateForEmptyFunction(
......
...@@ -196,8 +196,9 @@ class SourceTextModuleInfo : public FixedArray { ...@@ -196,8 +196,9 @@ class SourceTextModuleInfo : public FixedArray {
public: public:
DECL_CAST(SourceTextModuleInfo) DECL_CAST(SourceTextModuleInfo)
static Handle<SourceTextModuleInfo> New(Isolate* isolate, Zone* zone, template <typename Isolate>
SourceTextModuleDescriptor* descr); static HandleFor<Isolate, SourceTextModuleInfo> New(
Isolate* isolate, Zone* zone, SourceTextModuleDescriptor* descr);
inline FixedArray module_requests() const; inline FixedArray module_requests() const;
inline FixedArray special_exports() const; inline FixedArray special_exports() const;
...@@ -217,7 +218,8 @@ class SourceTextModuleInfo : public FixedArray { ...@@ -217,7 +218,8 @@ class SourceTextModuleInfo : public FixedArray {
#endif #endif
private: private:
friend class Factory; template <typename Impl>
friend class FactoryBase;
friend class SourceTextModuleDescriptor; friend class SourceTextModuleDescriptor;
enum { enum {
kModuleRequestsIndex, kModuleRequestsIndex,
...@@ -250,10 +252,11 @@ class SourceTextModuleInfoEntry ...@@ -250,10 +252,11 @@ class SourceTextModuleInfoEntry
DECL_INT_ACCESSORS(beg_pos) DECL_INT_ACCESSORS(beg_pos)
DECL_INT_ACCESSORS(end_pos) DECL_INT_ACCESSORS(end_pos)
static Handle<SourceTextModuleInfoEntry> New( template <typename Isolate>
Isolate* isolate, Handle<PrimitiveHeapObject> export_name, static HandleFor<Isolate, SourceTextModuleInfoEntry> New(
Handle<PrimitiveHeapObject> local_name, Isolate* isolate, HandleFor<Isolate, PrimitiveHeapObject> export_name,
Handle<PrimitiveHeapObject> import_name, int module_request, HandleFor<Isolate, PrimitiveHeapObject> local_name,
HandleFor<Isolate, PrimitiveHeapObject> import_name, int module_request,
int cell_index, int beg_pos, int end_pos); int cell_index, int beg_pos, int end_pos);
TQ_OBJECT_CONSTRUCTORS(SourceTextModuleInfoEntry) TQ_OBJECT_CONSTRUCTORS(SourceTextModuleInfoEntry)
......
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