Reland "[torque] Convert few class layout to torque."
This is a reland of 42fee61a97
The in-object fields of JSModuleNamespace has been excluded from torque.
It is restored back to its existing mechanism on the C++ side and rest
of the class is ported to torque.
Original change's description:
> [torque] Convert few class layout to torque.
>
> 1. Converted Module, JSModuleNameSpace, JSCollator, JSV8BreakIterator,
> TemplateList,
> JSStrictArgumentsObject to torque.
>
> Bug: v8:8952
> Change-Id: I01e88ac36acd7ba18791bec609e5ae737672c731
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1619146
> Commit-Queue: Suraj Sharma <surshar@microsoft.com>
> Reviewed-by: Simon Zünd <szuend@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#61671}
Bug: v8:8952
Change-Id: Ibd41000ad96ae57bd4f452f0c0c1b890e2c6fb5c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1632833
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Suraj Sharma <surshar@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#62005}
This commit is contained in:
parent
437f680e19
commit
8dc7da0c07
@ -373,6 +373,11 @@ extern class JSSloppyArgumentsObject extends JSArgumentsObjectWithLength {
|
||||
callee: Object;
|
||||
}
|
||||
|
||||
@hasSameInstanceTypeAsParent
|
||||
@noVerifier
|
||||
extern class JSStrictArgumentsObject extends JSArgumentsObjectWithLength {
|
||||
}
|
||||
|
||||
extern class JSArrayIterator extends JSObject {
|
||||
iterated_object: JSReceiver;
|
||||
next_index: Number;
|
||||
@ -448,7 +453,35 @@ extern class CallHandlerInfo extends Struct {
|
||||
data: Object;
|
||||
}
|
||||
|
||||
type JSModuleNamespace extends JSObject;
|
||||
type ModuleInfo extends FixedArray;
|
||||
type ObjectHashTable extends FixedArray;
|
||||
|
||||
extern class Module extends Struct {
|
||||
code: SharedFunctionInfo | JSFunction |
|
||||
JSGeneratorObject | ModuleInfo;
|
||||
exports: ObjectHashTable;
|
||||
regular_exports: FixedArray;
|
||||
regular_imports: FixedArray;
|
||||
hash: Smi;
|
||||
status: Smi;
|
||||
module_namespace: JSModuleNamespace | Undefined;
|
||||
requested_modules: FixedArray;
|
||||
dfs_index: Smi;
|
||||
dfs_ancestor_index: Smi;
|
||||
exception: Object;
|
||||
script: Script;
|
||||
@noVerifier import_meta: Hole | JSObject;
|
||||
}
|
||||
|
||||
@abstract
|
||||
extern class JSModuleNamespace extends JSObject {
|
||||
module: Module;
|
||||
}
|
||||
|
||||
@hasSameInstanceTypeAsParent
|
||||
@noVerifier
|
||||
extern class TemplateList extends FixedArray {
|
||||
}
|
||||
|
||||
@abstract
|
||||
extern class JSWeakCollection extends JSObject {
|
||||
|
@ -1569,10 +1569,7 @@ void BigInt::BigIntVerify(Isolate* isolate) {
|
||||
CHECK_IMPLIES(is_zero(), !sign()); // There is no -0n.
|
||||
}
|
||||
|
||||
void JSModuleNamespace::JSModuleNamespaceVerify(Isolate* isolate) {
|
||||
CHECK(IsJSModuleNamespace());
|
||||
VerifyPointer(isolate, module());
|
||||
}
|
||||
USE_TORQUE_VERIFIER(JSModuleNamespace)
|
||||
|
||||
void ModuleInfoEntry::ModuleInfoEntryVerify(Isolate* isolate) {
|
||||
TorqueGeneratedClassVerifiers::ModuleInfoEntryVerify(*this, isolate);
|
||||
@ -1582,17 +1579,7 @@ void ModuleInfoEntry::ModuleInfoEntryVerify(Isolate* isolate) {
|
||||
}
|
||||
|
||||
void Module::ModuleVerify(Isolate* isolate) {
|
||||
CHECK(IsModule());
|
||||
|
||||
VerifyPointer(isolate, code());
|
||||
VerifyPointer(isolate, exports());
|
||||
VerifyPointer(isolate, module_namespace());
|
||||
VerifyPointer(isolate, requested_modules());
|
||||
VerifyPointer(isolate, script());
|
||||
VerifyPointer(isolate, import_meta());
|
||||
VerifyPointer(isolate, exception());
|
||||
VerifySmiField(kHashOffset);
|
||||
VerifySmiField(kStatusOffset);
|
||||
TorqueGeneratedClassVerifiers::ModuleVerify(*this, isolate);
|
||||
|
||||
CHECK((status() >= kEvaluating && code().IsModuleInfo()) ||
|
||||
(status() == kInstantiated && code().IsJSGeneratorObject()) ||
|
||||
@ -1877,25 +1864,10 @@ void UncompiledDataWithoutPreparseData::UncompiledDataWithoutPreparseDataVerify(
|
||||
USE_TORQUE_VERIFIER(InterpreterData)
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
void JSV8BreakIterator::JSV8BreakIteratorVerify(Isolate* isolate) {
|
||||
JSObjectVerify(isolate);
|
||||
VerifyObjectField(isolate, kLocaleOffset);
|
||||
VerifyObjectField(isolate, kTypeOffset);
|
||||
VerifyObjectField(isolate, kBreakIteratorOffset);
|
||||
VerifyObjectField(isolate, kUnicodeStringOffset);
|
||||
VerifyObjectField(isolate, kBoundAdoptTextOffset);
|
||||
VerifyObjectField(isolate, kBoundFirstOffset);
|
||||
VerifyObjectField(isolate, kBoundNextOffset);
|
||||
VerifyObjectField(isolate, kBoundCurrentOffset);
|
||||
VerifyObjectField(isolate, kBoundBreakTypeOffset);
|
||||
}
|
||||
|
||||
void JSCollator::JSCollatorVerify(Isolate* isolate) {
|
||||
CHECK(IsJSCollator());
|
||||
JSObjectVerify(isolate);
|
||||
VerifyObjectField(isolate, kICUCollatorOffset);
|
||||
VerifyObjectField(isolate, kBoundCompareOffset);
|
||||
}
|
||||
USE_TORQUE_VERIFIER(JSV8BreakIterator)
|
||||
|
||||
USE_TORQUE_VERIFIER(JSCollator)
|
||||
|
||||
void JSDateTimeFormat::JSDateTimeFormatVerify(Isolate* isolate) {
|
||||
TorqueGeneratedClassVerifiers::JSDateTimeFormatVerify(*this, isolate);
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include 'src/objects/js-break-iterator.h'
|
||||
#include 'src/objects/js-collator.h'
|
||||
#include 'src/objects/js-number-format.h'
|
||||
#include 'src/objects/js-objects.h'
|
||||
#include 'src/objects/js-plural-rules.h'
|
||||
@ -63,3 +65,20 @@ extern class JSSegmentIterator extends JSObject {
|
||||
unicode_string: Foreign; // Managed<icu::UnicodeString>
|
||||
flags: Smi;
|
||||
}
|
||||
|
||||
extern class JSV8BreakIterator extends JSObject {
|
||||
locale: String;
|
||||
break_iterator: Foreign; // Managed<icu::BreakIterator>;
|
||||
unicode_string: Foreign; // Managed<icu::UnicodeString>;
|
||||
bound_adopt_text: Undefined | JSFunction;
|
||||
bound_first: Undefined | JSFunction;
|
||||
bound_next: Undefined | JSFunction;
|
||||
bound_current: Undefined | JSFunction;
|
||||
bound_break_type: Undefined | JSFunction;
|
||||
break_iterator_type: Smi;
|
||||
}
|
||||
|
||||
extern class JSCollator extends JSObject {
|
||||
icu_collator: Foreign; // Managed<icu::Collator>
|
||||
bound_compare: Undefined | JSFunction;
|
||||
}
|
||||
|
@ -22,11 +22,12 @@ OBJECT_CONSTRUCTORS_IMPL(JSV8BreakIterator, JSObject)
|
||||
|
||||
inline void JSV8BreakIterator::set_type(Type type) {
|
||||
DCHECK_GT(JSV8BreakIterator::Type::COUNT, type);
|
||||
WRITE_FIELD(*this, kTypeOffset, Smi::FromInt(static_cast<int>(type)));
|
||||
WRITE_FIELD(*this, kBreakIteratorTypeOffset,
|
||||
Smi::FromInt(static_cast<int>(type)));
|
||||
}
|
||||
|
||||
inline JSV8BreakIterator::Type JSV8BreakIterator::type() const {
|
||||
Object value = READ_FIELD(*this, kTypeOffset);
|
||||
Object value = READ_FIELD(*this, kBreakIteratorTypeOffset);
|
||||
return static_cast<JSV8BreakIterator::Type>(Smi::ToInt(value));
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "src/objects/intl-objects.h"
|
||||
#include "src/objects/managed.h"
|
||||
#include "src/objects/objects.h"
|
||||
#include "torque-generated/field-offsets-tq.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
@ -70,22 +71,8 @@ class JSV8BreakIterator : public JSObject {
|
||||
DECL_ACCESSORS(bound_break_type, Object)
|
||||
|
||||
// Layout description.
|
||||
#define BREAK_ITERATOR_FIELDS(V) \
|
||||
/* Pointer fields. */ \
|
||||
V(kLocaleOffset, kTaggedSize) \
|
||||
V(kTypeOffset, kTaggedSize) \
|
||||
V(kBreakIteratorOffset, kTaggedSize) \
|
||||
V(kUnicodeStringOffset, kTaggedSize) \
|
||||
V(kBoundAdoptTextOffset, kTaggedSize) \
|
||||
V(kBoundFirstOffset, kTaggedSize) \
|
||||
V(kBoundNextOffset, kTaggedSize) \
|
||||
V(kBoundCurrentOffset, kTaggedSize) \
|
||||
V(kBoundBreakTypeOffset, kTaggedSize) \
|
||||
/* Total Size */ \
|
||||
V(kSize, 0)
|
||||
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, BREAK_ITERATOR_FIELDS)
|
||||
#undef BREAK_ITERATOR_FIELDS
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
|
||||
TORQUE_GENERATED_JSV8BREAK_ITERATOR_FIELDS)
|
||||
|
||||
OBJECT_CONSTRUCTORS(JSV8BreakIterator, JSObject);
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ namespace internal {
|
||||
|
||||
OBJECT_CONSTRUCTORS_IMPL(JSCollator, JSObject)
|
||||
|
||||
ACCESSORS(JSCollator, icu_collator, Managed<icu::Collator>, kICUCollatorOffset)
|
||||
ACCESSORS(JSCollator, icu_collator, Managed<icu::Collator>, kIcuCollatorOffset)
|
||||
ACCESSORS(JSCollator, bound_compare, Object, kBoundCompareOffset)
|
||||
|
||||
CAST_ACCESSOR(JSCollator)
|
||||
|
@ -47,14 +47,8 @@ class JSCollator : public JSObject {
|
||||
DECL_VERIFIER(JSCollator)
|
||||
|
||||
// Layout description.
|
||||
#define JS_COLLATOR_FIELDS(V) \
|
||||
V(kICUCollatorOffset, kTaggedSize) \
|
||||
V(kBoundCompareOffset, kTaggedSize) \
|
||||
/* Total size. */ \
|
||||
V(kSize, 0)
|
||||
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_COLLATOR_FIELDS)
|
||||
#undef JS_COLLATOR_FIELDS
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
|
||||
TORQUE_GENERATED_JSCOLLATOR_FIELDS)
|
||||
|
||||
DECL_ACCESSORS(icu_collator, Managed<icu::Collator>)
|
||||
DECL_ACCESSORS(bound_compare, Object)
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "src/objects/js-objects.h"
|
||||
#include "src/objects/objects.h"
|
||||
#include "src/objects/struct.h"
|
||||
#include "torque-generated/field-offsets-tq.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
@ -126,25 +127,8 @@ class Module : public Struct {
|
||||
Handle<Module> module);
|
||||
|
||||
// Layout description.
|
||||
#define MODULE_FIELDS(V) \
|
||||
V(kCodeOffset, kTaggedSize) \
|
||||
V(kExportsOffset, kTaggedSize) \
|
||||
V(kRegularExportsOffset, kTaggedSize) \
|
||||
V(kRegularImportsOffset, kTaggedSize) \
|
||||
V(kHashOffset, kTaggedSize) \
|
||||
V(kModuleNamespaceOffset, kTaggedSize) \
|
||||
V(kRequestedModulesOffset, kTaggedSize) \
|
||||
V(kStatusOffset, kTaggedSize) \
|
||||
V(kDfsIndexOffset, kTaggedSize) \
|
||||
V(kDfsAncestorIndexOffset, kTaggedSize) \
|
||||
V(kExceptionOffset, kTaggedSize) \
|
||||
V(kScriptOffset, kTaggedSize) \
|
||||
V(kImportMetaOffset, kTaggedSize) \
|
||||
/* Total size. */ \
|
||||
V(kSize, 0)
|
||||
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, MODULE_FIELDS)
|
||||
#undef MODULE_FIELDS
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
|
||||
TORQUE_GENERATED_MODULE_FIELDS)
|
||||
|
||||
private:
|
||||
friend class Factory;
|
||||
@ -250,18 +234,14 @@ class JSModuleNamespace : public JSObject {
|
||||
kInObjectFieldCount,
|
||||
};
|
||||
|
||||
// Layout description.
|
||||
#define JS_MODULE_NAMESPACE_FIELDS(V) \
|
||||
V(kModuleOffset, kTaggedSize) \
|
||||
/* Header size. */ \
|
||||
V(kHeaderSize, 0) \
|
||||
V(kInObjectFieldsOffset, kTaggedSize* kInObjectFieldCount) \
|
||||
/* Total size. */ \
|
||||
V(kSize, 0)
|
||||
|
||||
// Layout description.
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
|
||||
JS_MODULE_NAMESPACE_FIELDS)
|
||||
#undef JS_MODULE_NAMESPACE_FIELDS
|
||||
TORQUE_GENERATED_JSMODULE_NAMESPACE_FIELDS)
|
||||
|
||||
// We need to include in-object fields
|
||||
// TODO(v8:8944): improve handling of in-object fields
|
||||
static constexpr int kSize =
|
||||
kHeaderSize + (kTaggedSize * kInObjectFieldCount);
|
||||
|
||||
OBJECT_CONSTRUCTORS(JSModuleNamespace, JSObject);
|
||||
};
|
||||
@ -309,6 +289,7 @@ class ModuleInfo : public FixedArray {
|
||||
kRegularExportExportNamesOffset,
|
||||
kRegularExportLength
|
||||
};
|
||||
|
||||
OBJECT_CONSTRUCTORS(ModuleInfo, FixedArray);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user