Torquify SourceTextModuleRecord
Convert the new class SourceTextModuleRecord to use Torque to define its fields. Bug: v8:9292 Change-Id: Iddad3b266dd0dc122aee510cc41c69be27988c4a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1668011 Commit-Queue: Dan Clark <daniec@microsoft.com> Reviewed-by: Georg Neis <neis@chromium.org> Auto-Submit: Dan Clark <daniec@microsoft.com> Cr-Commit-Position: refs/heads/master@{#62318}
This commit is contained in:
parent
76c1e829e3
commit
3f2df833bb
@ -447,9 +447,9 @@ extern class CallHandlerInfo extends Struct {
|
||||
data: Object;
|
||||
}
|
||||
|
||||
type ModuleInfo extends FixedArray;
|
||||
type ObjectHashTable extends FixedArray;
|
||||
|
||||
@abstract
|
||||
extern class Module extends HeapObject {
|
||||
exports: ObjectHashTable;
|
||||
hash: Smi;
|
||||
@ -458,6 +458,20 @@ extern class Module extends HeapObject {
|
||||
exception: Object;
|
||||
}
|
||||
|
||||
type SourceTextModuleInfo extends FixedArray;
|
||||
|
||||
extern class SourceTextModule extends Module {
|
||||
code: SharedFunctionInfo | JSFunction |
|
||||
JSGeneratorObject | SourceTextModuleInfo;
|
||||
regular_exports: FixedArray;
|
||||
regular_imports: FixedArray;
|
||||
requested_modules: FixedArray;
|
||||
script: Script;
|
||||
import_meta: TheHole | JSObject;
|
||||
dfs_index: Smi;
|
||||
dfs_ancestor_index: Smi;
|
||||
}
|
||||
|
||||
@abstract
|
||||
extern class JSModuleNamespace extends JSObject {
|
||||
module: Module;
|
||||
|
@ -1555,32 +1555,23 @@ void SourceTextModuleInfoEntry::SourceTextModuleInfoEntryVerify(
|
||||
local_name().IsUndefined(isolate));
|
||||
}
|
||||
|
||||
static void ModuleVerify(Module module, Isolate* isolate) {
|
||||
TorqueGeneratedClassVerifiers::ModuleVerify(module, isolate);
|
||||
void Module::ModuleVerify(Isolate* isolate) {
|
||||
TorqueGeneratedClassVerifiers::ModuleVerify(*this, isolate);
|
||||
|
||||
CHECK_EQ(module.status() == Module::kErrored,
|
||||
!module.exception().IsTheHole(isolate));
|
||||
CHECK_EQ(status() == Module::kErrored, !exception().IsTheHole(isolate));
|
||||
|
||||
CHECK(module.module_namespace().IsUndefined(isolate) ||
|
||||
module.module_namespace().IsJSModuleNamespace());
|
||||
if (module.module_namespace().IsJSModuleNamespace()) {
|
||||
CHECK_LE(Module::kInstantiating, module.status());
|
||||
CHECK_EQ(JSModuleNamespace::cast(module.module_namespace()).module(),
|
||||
module);
|
||||
CHECK(module_namespace().IsUndefined(isolate) ||
|
||||
module_namespace().IsJSModuleNamespace());
|
||||
if (module_namespace().IsJSModuleNamespace()) {
|
||||
CHECK_LE(Module::kInstantiating, status());
|
||||
CHECK_EQ(JSModuleNamespace::cast(module_namespace()).module(), *this);
|
||||
}
|
||||
|
||||
CHECK_NE(module.hash(), 0);
|
||||
CHECK_NE(hash(), 0);
|
||||
}
|
||||
|
||||
void SourceTextModule::SourceTextModuleVerify(Isolate* isolate) {
|
||||
ModuleVerify(*this, isolate);
|
||||
|
||||
CHECK(IsSourceTextModule());
|
||||
|
||||
VerifyPointer(isolate, code());
|
||||
VerifyPointer(isolate, requested_modules());
|
||||
VerifyPointer(isolate, script());
|
||||
VerifyPointer(isolate, import_meta());
|
||||
TorqueGeneratedClassVerifiers::SourceTextModuleVerify(*this, isolate);
|
||||
|
||||
CHECK((status() >= kEvaluating && code().IsSourceTextModuleInfo()) ||
|
||||
(status() == kInstantiated && code().IsJSGeneratorObject()) ||
|
||||
@ -1588,8 +1579,6 @@ void SourceTextModule::SourceTextModuleVerify(Isolate* isolate) {
|
||||
(code().IsSharedFunctionInfo()));
|
||||
|
||||
CHECK_EQ(requested_modules().length(), info().module_requests().length());
|
||||
|
||||
CHECK(import_meta().IsTheHole(isolate) || import_meta().IsJSObject());
|
||||
}
|
||||
|
||||
void PrototypeInfo::PrototypeInfoVerify(Isolate* isolate) {
|
||||
|
@ -34,6 +34,7 @@ class Module : public HeapObject {
|
||||
public:
|
||||
NEVER_READ_ONLY_SPACE
|
||||
DECL_CAST(Module)
|
||||
DECL_VERIFIER(Module)
|
||||
DECL_PRINTER(Module)
|
||||
|
||||
// The complete export table, mapping an export name to its cell.
|
||||
@ -83,7 +84,8 @@ class Module : public HeapObject {
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
|
||||
TORQUE_GENERATED_MODULE_FIELDS)
|
||||
|
||||
using BodyDescriptor = FixedBodyDescriptor<kExportsOffset, kSize, kSize>;
|
||||
using BodyDescriptor =
|
||||
FixedBodyDescriptor<kExportsOffset, kHeaderSize, kHeaderSize>;
|
||||
|
||||
protected:
|
||||
friend class Factory;
|
||||
|
@ -27,7 +27,7 @@ class SourceTextModule : public Module {
|
||||
// The code representing this module, or an abstraction thereof.
|
||||
// This is either a SharedFunctionInfo, a JSFunction, a JSGeneratorObject, or
|
||||
// a SourceTextModuleInfo, depending on the state (status) the module is in.
|
||||
// See Module::ModuleVerify() for the precise invariant.
|
||||
// See SourceTextModule::SourceTextModuleVerify() for the precise invariant.
|
||||
DECL_ACCESSORS(code, Object)
|
||||
|
||||
// Arrays of cells corresponding to regular exports and regular imports.
|
||||
@ -73,20 +73,8 @@ class SourceTextModule : public Module {
|
||||
Isolate* isolate, Handle<SourceTextModule> module, int module_request);
|
||||
|
||||
// Layout description.
|
||||
#define SOURCE_TEXT_MODULE_FIELDS(V) \
|
||||
V(kCodeOffset, kTaggedSize) \
|
||||
V(kRegularExportsOffset, kTaggedSize) \
|
||||
V(kRegularImportsOffset, kTaggedSize) \
|
||||
V(kRequestedModulesOffset, kTaggedSize) \
|
||||
V(kScriptOffset, kTaggedSize) \
|
||||
V(kImportMetaOffset, kTaggedSize) \
|
||||
V(kDfsIndexOffset, kTaggedSize) \
|
||||
V(kDfsAncestorIndexOffset, kTaggedSize) \
|
||||
/* Total size. */ \
|
||||
V(kSize, 0)
|
||||
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(Module::kSize, SOURCE_TEXT_MODULE_FIELDS)
|
||||
#undef SOURCE_TEXT_MODULE_FIELDS
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(Module::kHeaderSize,
|
||||
TORQUE_GENERATED_SOURCE_TEXT_MODULE_FIELDS)
|
||||
|
||||
using BodyDescriptor =
|
||||
SubclassBodyDescriptor<Module::BodyDescriptor,
|
||||
|
Loading…
Reference in New Issue
Block a user