[torque] Invert the default for @generateCppClass

Since most Torque-defined extern classes use @generateCppClass, it makes
more sense to instead annotate the small number that don't. This is part
of the cleanup work that Nico recommended in [1].

Classes that still have to opt out:

- Those that can be converted by https://crrev.com/c/3015666
- HeapObject: sort of special since it's the root of the inheritance
  hierarchy. Generated code would include two declarations that don't
  compile until HeapObject is defined:
    bool IsHeapObject_NonInline(HeapObject o);
    explicit TorqueGeneratedHeapObject(
        Address ptr, HeapObject::AllowInlineSmiStorage allow_smi);
- SmallOrdered*: these classes use templates on the C++ side, which is
  not currently representable in Torque.
- SwissNameDictionary: according to a comment, the Torque generation for
  this class is incorrect. I haven't investigated further.

Drive-by fix: make the Torque formatter keep LF on Windows rather than
writing CRLF.

[1] https://docs.google.com/document/d/1q_gZLnXd4bGnCx3IUfbln46K3bSs9UHBGasy9McQtHI/edit#

Bug: v8:8952
Change-Id: I1fbb5290f0c645842b84c53816c09bb3398206a5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3028721
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#75841}
This commit is contained in:
Seth Brenith 2021-07-20 08:32:43 -07:00 committed by V8 LUCI CQ
parent f79eee1f8e
commit f30f481525
70 changed files with 46 additions and 177 deletions

View File

@ -4,7 +4,6 @@
extern class AllocationSite extends Struct;
@generateCppClass
extern class AllocationMemento extends Struct {
allocation_site: AllocationSite;
}

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class CallHandlerInfo extends Struct {
callback: NonNullForeign|Undefined|Zero;
js_callback: NonNullForeign|Undefined|Zero;
@ -17,7 +16,6 @@ bitfield struct InterceptorInfoFlags extends uint31 {
has_no_side_effect: bool: 1 bit;
}
@generateCppClass
@generatePrint
extern class InterceptorInfo extends Struct {
getter: NonNullForeign|Zero|Undefined;
@ -31,7 +29,6 @@ extern class InterceptorInfo extends Struct {
flags: SmiTagged<InterceptorInfoFlags>;
}
@generateCppClass
@generatePrint
extern class AccessCheckInfo extends Struct {
callback: Foreign|Zero|Undefined;
@ -53,7 +50,6 @@ bitfield struct AccessorInfoFlags extends uint31 {
initial_attributes: PropertyAttributes: 3 bit;
}
@generateCppClass
@generatePrint
extern class AccessorInfo extends Struct {
name: Name;

View File

@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class JSArgumentsObject extends JSObject {
}
extern class JSArgumentsObject extends JSObject {}
type JSArgumentsObjectWithLength =
JSSloppyArgumentsObject|JSStrictArgumentsObject;
@ -16,12 +14,14 @@ macro IsJSArgumentsObjectWithLength(implicit context: Context)(o: Object):
}
// Just a starting shape for JSObject; properties can move after initialization.
@doNotGenerateCppClass
extern shape JSSloppyArgumentsObject extends JSArgumentsObject {
length: JSAny;
callee: JSAny;
}
// Just a starting shape for JSObject; properties can move after initialization.
@doNotGenerateCppClass
extern shape JSStrictArgumentsObject extends JSArgumentsObject {
length: JSAny;
}
@ -90,7 +90,6 @@ macro NewSloppyArgumentsElements<Iterator: type>(
SloppyArgumentsElements{length, context, arguments, mapped_entries: ...it};
}
@generateCppClass
@generatePrint
extern class AliasedArgumentsEntry extends Struct {
aliased_context_slot: Smi;

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
@generatePrint
extern class Cell extends HeapObject {
value: Object;

View File

@ -4,7 +4,6 @@
type DependentCode extends WeakFixedArray;
@generateCppClass
extern class BytecodeArray extends FixedArrayBase {
// TODO(v8:8983): bytecode array object sizes vary based on their contents.
constant_pool: FixedArray;

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
@abstract
@generateCppClass
extern class DataHandler extends Struct {
// [smi_handler]: A Smi which encodes a handler or Code object (we still
// use code handlers for accessing lexical environment variables, but soon

View File

@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
@generatePrint
extern class BreakPoint extends Struct {
id: Smi;
condition: String;
}
@generateCppClass
@generatePrint
extern class BreakPointInfo extends Struct {
// The position in the source for the break position.
@ -34,7 +32,6 @@ bitfield struct DebuggerHints extends uint31 {
debugging_id: int32: 20 bit;
}
@generateCppClass
@generatePrint
extern class DebugInfo extends Struct {
shared: SharedFunctionInfo;
@ -69,7 +66,6 @@ struct CoverageInfoSlot {
// CoverageInfo's visitor is included in DATA_ONLY_VISITOR_ID_LIST, so it must
// not contain any HeapObject fields.
@generateCppClass
extern class CoverageInfo extends HeapObject {
const slot_count: int32;
slots[slot_count]: CoverageInfoSlot;

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
@generatePrint
@generateCppClass
extern class EnumCache extends Struct {
keys: FixedArray;
indices: FixedArray;

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class EmbedderDataArray extends HeapObject {
// length of the array in an embedder data slots.
length: Smi;

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class FeedbackCell extends Struct {
value: Undefined|FeedbackVector|FixedArray;
interrupt_budget: int32;

View File

@ -12,7 +12,6 @@ bitfield struct FeedbackVectorFlags extends uint32 {
}
@generateBodyDescriptor
@generateCppClass
extern class FeedbackVector extends HeapObject {
const length: int32;
invocation_count: int32;

View File

@ -3,51 +3,41 @@
// found in the LICENSE file.
@abstract
@generateCppClass
extern class FixedArrayBase extends HeapObject {
// length of the array.
const length: Smi;
}
@generateBodyDescriptor
@generateCppClass
extern class FixedArray extends FixedArrayBase {
objects[length]: Object;
}
type EmptyFixedArray extends FixedArray;
@generateCppClass
extern class FixedDoubleArray extends FixedArrayBase {
floats[length]: float64_or_hole;
}
@generateBodyDescriptor
@generateCppClass
extern class WeakFixedArray extends HeapObject {
const length: Smi;
@cppRelaxedLoad objects[length]: MaybeObject;
}
@generateCppClass
extern class ByteArray extends FixedArrayBase {
bytes[length]: uint8;
}
extern class ByteArray extends FixedArrayBase { bytes[length]: uint8; }
@hasSameInstanceTypeAsParent
@generateCppClass
@doNotGenerateCast
extern class ArrayList extends FixedArray {
}
@hasSameInstanceTypeAsParent
@generateCppClass
@doNotGenerateCast
extern class TemplateList extends FixedArray {
}
@generateBodyDescriptor
@generateCppClass
extern class WeakArrayList extends HeapObject {
const capacity: Smi;
length: Smi;

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
@apiExposedInstanceTypeValue(0x46)
@generateCppClass
extern class Foreign extends HeapObject {
foreign_address: ExternalPointer;
}

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class FreeSpace extends HeapObject {
size: Smi;
next: FreeSpace|Uninitialized;

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class HeapNumber extends PrimitiveHeapObject {
// Marked as a relaxed store because of a race with reading on the
// compiler thread.

View File

@ -4,6 +4,7 @@
@abstract
@doNotGenerateCast
@doNotGenerateCppClass
extern class HeapObject extends StrongTagged {
const map: Map;
}

View File

@ -11,7 +11,6 @@ bitfield struct JSArrayBufferFlags extends uint32 {
is_resizable: bool: 1 bit;
}
@generateCppClass
extern class JSArrayBuffer extends JSObject {
byte_length: uintptr;
max_byte_length: uintptr;
@ -42,7 +41,6 @@ macro IsResizableArrayBuffer(buffer: JSArrayBuffer): bool {
}
@abstract
@generateCppClass
extern class JSArrayBufferView extends JSObject {
buffer: JSArrayBuffer;
byte_offset: uintptr;
@ -59,7 +57,6 @@ bitfield struct JSTypedArrayFlags extends uint32 {
is_backed_by_rab: bool: 1 bit;
}
@generateCppClass
extern class JSTypedArray extends JSArrayBufferView {
length: uintptr;
external_pointer: ExternalPointer;
@ -80,7 +77,6 @@ macro IsLengthTrackingTypedArray(array: JSTypedArray): bool {
return array.bit_field.is_length_tracking;
}
@generateCppClass
extern class JSDataView extends JSArrayBufferView {
data_pointer: ExternalPointer;
}

View File

@ -4,6 +4,7 @@
extern enum IterationKind extends uint31 { kKeys, kValues, kEntries }
@doNotGenerateCppClass
extern class JSArrayIterator extends JSObject {
iterated_object: JSReceiver;
next_index: Number;
@ -24,6 +25,7 @@ macro CreateArrayIterator(implicit context: NativeContext)(
};
}
@doNotGenerateCppClass
extern class JSArray extends JSObject {
macro IsEmpty(): bool {
return this.length == 0;

View File

@ -4,7 +4,6 @@
#include 'src/objects/js-break-iterator.h'
@generateCppClass
extern class JSV8BreakIterator extends JSObject {
locale: String;
break_iterator: Foreign; // Managed<icu::BreakIterator>;

View File

@ -4,7 +4,6 @@
#include 'src/objects/js-collator.h'
@generateCppClass
extern class JSCollator extends JSObject {
icu_collator: Foreign; // Managed<icu::Collator>
bound_compare: Undefined|JSFunction;

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
@abstract
extern class JSCollectionIterator extends JSObject {
// The backing hash table mapping keys to values.

View File

@ -3,30 +3,20 @@
// found in the LICENSE file.
@abstract
@generateCppClass
extern class JSCollection extends JSObject {
// The backing hash table.
table: Object;
}
@generateCppClass
extern class JSSet extends JSCollection {
}
@generateCppClass
extern class JSMap extends JSCollection {
}
extern class JSSet extends JSCollection {}
extern class JSMap extends JSCollection {}
@abstract
@generateCppClass
extern class JSWeakCollection extends JSObject {
// The backing hash table mapping keys to values.
table: Object;
}
@generateCppClass
extern class JSWeakSet extends JSWeakCollection {
}
@generateCppClass
extern class JSWeakMap extends JSWeakCollection {
}
extern class JSWeakSet extends JSWeakCollection {}
extern class JSWeakMap extends JSWeakCollection {}
@abstract extern class JSMapIterator extends JSCollectionIterator;
extern class JSMapKeyIterator extends JSMapIterator

View File

@ -13,7 +13,6 @@ bitfield struct JSDateTimeFormatFlags extends uint31 {
iso8601: bool: 1bit;
}
@generateCppClass
extern class JSDateTimeFormat extends JSObject {
locale: String;
icu_locale: Foreign; // Managed<icu::Locale>

View File

@ -15,7 +15,6 @@ bitfield struct JSDisplayNamesFlags extends uint31 {
language_display: JSDisplayNamesLanguageDisplay: 1 bit;
}
@generateCppClass
extern class JSDisplayNames extends JSObject {
internal: Foreign; // Managed<DisplayNamesInternal>
flags: SmiTagged<JSDisplayNamesFlags>;

View File

@ -3,11 +3,9 @@
// found in the LICENSE file.
@abstract
@generateCppClass
extern class JSFunctionOrBoundFunction extends JSObject {
}
@generateCppClass
extern class JSBoundFunction extends JSFunctionOrBoundFunction {
// The wrapped function object.
bound_target_function: Callable;
@ -20,6 +18,7 @@ extern class JSBoundFunction extends JSFunctionOrBoundFunction {
}
@highestInstanceTypeWithinParentClassRange
@doNotGenerateCppClass
extern class JSFunction extends JSFunctionOrBoundFunction {
shared_function_info: SharedFunctionInfo;
context: Context;

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class JSGeneratorObject extends JSObject {
function: JSFunction;
context: Context;
@ -26,12 +25,10 @@ extern class JSGeneratorObject extends JSObject {
parameters_and_registers: FixedArray;
}
@generateCppClass
extern class JSAsyncFunctionObject extends JSGeneratorObject {
promise: JSPromise;
}
@generateCppClass
extern class JSAsyncGeneratorObject extends JSGeneratorObject {
// Pointer to the head of a singly linked list of AsyncGeneratorRequest, or
// undefined.
@ -40,7 +37,6 @@ extern class JSAsyncGeneratorObject extends JSGeneratorObject {
is_awaiting: Smi;
}
@generateCppClass
extern class AsyncGeneratorRequest extends Struct {
next: AsyncGeneratorRequest|Undefined;
resume_mode: Smi;

View File

@ -11,7 +11,6 @@ bitfield struct JSListFormatFlags extends uint31 {
Type: JSListFormatType: 2 bit; // "type" is a reserved word.
}
@generateCppClass
extern class JSListFormat extends JSObject {
locale: String;
icu_formatter: Foreign; // Managed<icu::ListFormatter>

View File

@ -4,7 +4,6 @@
#include 'src/objects/js-locale.h'
@generateCppClass
extern class JSLocale extends JSObject {
icu_locale: Foreign; // Managed<icu::Locale>
}

View File

@ -4,7 +4,6 @@
#include 'src/objects/js-number-format.h'
@generateCppClass
extern class JSNumberFormat extends JSObject {
locale: String;
icu_number_formatter:

View File

@ -5,13 +5,13 @@
// JSReceiver corresponds to objects in the JS sense.
@abstract
@highestInstanceTypeWithinParentClassRange
@doNotGenerateCppClass
extern class JSReceiver extends HeapObject {
properties_or_hash: SwissNameDictionary|FixedArrayBase|PropertyArray|Smi;
}
type Constructor extends JSReceiver;
@generateCppClass
@apiExposedInstanceTypeValue(0x421)
@highestInstanceTypeWithinParentClassRange
extern class JSObject extends JSReceiver {
@ -42,13 +42,11 @@ macro NewJSObject(implicit context: Context)(): JSObject {
}
@abstract
@generateCppClass
@lowestInstanceTypeWithinParentClassRange
extern class JSCustomElementsObject extends JSObject {
}
@abstract
@generateCppClass
@lowestInstanceTypeWithinParentClassRange
extern class JSSpecialObject extends JSCustomElementsObject {
}
@ -93,23 +91,21 @@ macro AllocateFastOrSlowJSObjectFromMap(implicit context: Context)(map: Map):
SlackTrackingMode::kWithSlackTracking);
}
@generateCppClass
extern class JSGlobalProxy extends JSSpecialObject {
// [native_context]: the owner native context of this global proxy object.
// It is null value if this object is not used by any context.
native_context: Object;
}
@doNotGenerateCppClass
extern class JSGlobalObject extends JSSpecialObject {
native_context: NativeContext;
global_proxy: JSGlobalProxy;
}
@generateCppClass
extern class JSPrimitiveWrapper extends JSCustomElementsObject {
value: JSAny;
}
extern class JSPrimitiveWrapper extends JSCustomElementsObject { value: JSAny; }
@doNotGenerateCppClass
extern class JSMessageObject extends JSObject {
// Tagged fields.
message_type: Smi;
@ -126,7 +122,6 @@ extern class JSMessageObject extends JSObject {
error_level: Smi;
}
@generateCppClass
extern class JSDate extends JSObject {
// If one component is NaN, all of them are, indicating a NaN time value.
@ -147,7 +142,6 @@ extern class JSDate extends JSObject {
cache_stamp: Undefined|Smi|NaN;
}
@generateCppClass
extern class JSAsyncFromSyncIterator extends JSObject {
sync_iterator: JSReceiver;
// The "next" method is loaded during GetIterator, and is not reloaded for
@ -155,7 +149,6 @@ extern class JSAsyncFromSyncIterator extends JSObject {
next: Object;
}
@generateCppClass
extern class JSStringIterator extends JSObject {
// The [[IteratedString]] slot.
string: String;

View File

@ -9,7 +9,6 @@ bitfield struct JSPluralRulesFlags extends uint31 {
Type: JSPluralRulesType: 1 bit; // "type" is a reserved word.
}
@generateCppClass
extern class JSPluralRules extends JSObject {
locale: String;
flags: SmiTagged<JSPluralRulesFlags>;

View File

@ -10,7 +10,6 @@ bitfield struct JSPromiseFlags extends uint31 {
async_task_id: int32: 22 bit;
}
@generateCppClass
extern class JSPromise extends JSObject {
macro Status(): PromiseState {
return this.flags.status;

View File

@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class JSProxy extends JSReceiver {
target: JSReceiver|Null;
handler: JSReceiver|Null;
}
@doNotGenerateCppClass
extern shape JSProxyRevocableResult extends JSObject {
proxy: JSAny;
revoke: JSAny;

View File

@ -8,7 +8,6 @@ bitfield struct JSRegExpStringIteratorFlags extends uint31 {
unicode: bool: 1 bit;
}
@generateCppClass
extern class JSRegExpStringIterator extends JSObject {
// The [[IteratingRegExp]] internal property.
iterating_reg_exp: JSReceiver;

View File

@ -13,7 +13,6 @@ bitfield struct JSRegExpFlags extends uint31 {
has_indices: bool: 1 bit;
}
@generateCppClass
extern class JSRegExp extends JSObject {
data: FixedArray|Undefined;
source: String|Undefined;
@ -39,6 +38,7 @@ RegExpBuiltinsAssembler::FastStoreLastIndex(FastJSRegExp, Smi): void;
extern class JSRegExpConstructor extends JSFunction
generates 'TNode<JSFunction>';
@doNotGenerateCppClass
extern shape JSRegExpResult extends JSArray {
// In-object properties:
// The below fields are externally exposed.
@ -52,10 +52,12 @@ extern shape JSRegExpResult extends JSArray {
regexp_last_index: Smi;
}
@doNotGenerateCppClass
extern shape JSRegExpResultWithIndices extends JSRegExpResult {
indices: JSAny;
}
@doNotGenerateCppClass
extern shape JSRegExpResultIndices extends JSArray {
// In-object properties:
// The groups field is externally exposed.

View File

@ -10,7 +10,6 @@ bitfield struct JSRelativeTimeFormatFlags extends uint31 {
numeric: JSRelativeTimeFormatNumeric: 1 bit;
}
@generateCppClass
extern class JSRelativeTimeFormat extends JSObject {
locale: String;
numberingSystem: String;

View File

@ -8,7 +8,6 @@ bitfield struct JSSegmentIteratorFlags extends uint31 {
granularity: JSSegmenterGranularity: 2 bit;
}
@generateCppClass
extern class JSSegmentIterator extends JSObject {
icu_break_iterator: Foreign; // Managed<icu::BreakIterator>
unicode_string: Foreign; // Managed<icu::UnicodeString>

View File

@ -10,7 +10,6 @@ bitfield struct JSSegmenterFlags extends uint31 {
granularity: JSSegmenterGranularity: 2 bit;
}
@generateCppClass
extern class JSSegmenter extends JSObject {
locale: String;
icu_break_iterator: Foreign; // Managed<icu::BreakIterator>

View File

@ -8,7 +8,6 @@ bitfield struct JSSegmentsFlags extends uint31 {
granularity: JSSegmenterGranularity: 2 bit;
}
@generateCppClass
extern class JSSegments extends JSObject {
icu_break_iterator: Foreign; // Managed<icu::BreakIterator>
unicode_string: Foreign; // Managed<icu::UnicodeString>

View File

@ -6,6 +6,7 @@ bitfield struct FinalizationRegistryFlags extends uint31 {
scheduled_for_cleanup: bool: 1 bit;
}
@doNotGenerateCppClass
extern class JSFinalizationRegistry extends JSObject {
native_context: NativeContext;
cleanup: Callable;
@ -18,7 +19,6 @@ extern class JSFinalizationRegistry extends JSObject {
flags: SmiTagged<FinalizationRegistryFlags>;
}
@generateCppClass
extern class WeakCell extends HeapObject {
finalization_registry: Undefined|JSFinalizationRegistry;
target: Undefined|JSReceiver;
@ -40,7 +40,4 @@ extern class WeakCell extends HeapObject {
key_list_next: Undefined|WeakCell;
}
@generateCppClass
extern class JSWeakRef extends JSObject {
target: Undefined|JSReceiver;
}
extern class JSWeakRef extends JSObject { target: Undefined|JSReceiver; }

View File

@ -2,13 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class ArrayBoilerplateDescription extends Struct {
flags: Smi;
constant_elements: FixedArrayBase;
}
@generateCppClass
extern class RegExpBoilerplateDescription extends Struct {
data: FixedArray;
source: String;

View File

@ -34,7 +34,6 @@ bitfield struct MapBitFields3 extends uint32 {
construction_counter: int32: 3 bit;
}
@generateCppClass
extern class Map extends HeapObject {
macro PrototypeInfo(): PrototypeInfo labels HasNoPrototypeInfo {
typeswitch (this.transitions_or_prototype_info) {

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
@generatePrint
@generateBodyDescriptor
extern class MegaDomHandler extends HeapObject {

View File

@ -3,17 +3,14 @@
// found in the LICENSE file.
@abstract
@generateCppClass
extern class Microtask extends Struct {
}
@generateCppClass
extern class CallbackTask extends Microtask {
callback: Foreign;
data: Foreign;
}
@generateCppClass
extern class CallableTask extends Microtask {
callable: JSReceiver;
context: Context;

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
@abstract
@generateCppClass
extern class Module extends HeapObject {
// The complete export table, mapping an export name to its cell.
exports: ObjectHashTable;
@ -18,7 +17,4 @@ extern class Module extends HeapObject {
top_level_capability: JSPromise|Undefined;
}
@generateCppClass
extern class JSModuleNamespace extends JSSpecialObject {
module: Module;
}
extern class JSModuleNamespace extends JSSpecialObject { module: Module; }

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
@abstract
@generateCppClass
extern class Name extends PrimitiveHeapObject {
raw_hash_field: NameHash;
}
@ -28,7 +27,6 @@ bitfield struct SymbolFlags extends uint32 {
is_private_brand: bool: 1 bit;
}
@generateCppClass
extern class Symbol extends Name {
flags: SymbolFlags;
description: String|Undefined;

View File

@ -16,6 +16,7 @@ const kSmallOrderedHashTableLoadFactor: constexpr int31
@noVerifier
@abstract
@doNotGenerateCppClass
extern class SmallOrderedHashTable extends HeapObject
generates 'TNode<HeapObject>' {
}
@ -23,6 +24,7 @@ extern class SmallOrderedHashTable extends HeapObject
extern macro SmallOrderedHashSetMapConstant(): Map;
const kSmallOrderedHashSetMap: Map = SmallOrderedHashSetMapConstant();
@doNotGenerateCppClass
extern class SmallOrderedHashSet extends SmallOrderedHashTable {
number_of_elements: uint8;
number_of_deleted_elements: uint8;
@ -61,6 +63,7 @@ struct HashMapEntry {
extern macro SmallOrderedHashMapMapConstant(): Map;
const kSmallOrderedHashMapMap: Map = SmallOrderedHashMapMapConstant();
@doNotGenerateCppClass
extern class SmallOrderedHashMap extends SmallOrderedHashTable {
number_of_elements: uint8;
number_of_deleted_elements: uint8;
@ -97,6 +100,7 @@ struct NameDictionaryEntry {
property_details: Smi|TheHole;
}
@doNotGenerateCppClass
extern class SmallOrderedNameDictionary extends SmallOrderedHashTable {
hash: int32;
@if(TAGGED_SIZE_8_BYTES) padding_0: int32;

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
@abstract
extern class PrimitiveHeapObject extends HeapObject {
}

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class PromiseCapability extends Struct {
promise: JSReceiver|Undefined;
// TODO(joshualitt): Can these be typed more specifically.
@ -25,7 +24,6 @@ const kPromiseReactionPromiseOrCapabilityOffset: constexpr int31
const kPromiseReactionContinuationPreservedEmbedderDataOffset: constexpr int31
generates 'PromiseReaction::kContinuationPreservedEmbedderDataOffset';
@generateCppClass
extern class PromiseReaction extends Struct {
next: PromiseReaction|Zero;
reject_handler: Callable|Undefined;
@ -49,7 +47,6 @@ const kPromiseReactionJobTaskContinuationPreservedEmbedderDataOffset:
;
@abstract
@generateCppClass
extern class PromiseReactionJobTask extends Microtask {
argument: Object;
context: Context;
@ -60,15 +57,10 @@ extern class PromiseReactionJobTask extends Microtask {
continuation_preserved_embedder_data: Object|Undefined;
}
@generateCppClass
extern class PromiseFulfillReactionJobTask extends PromiseReactionJobTask {
}
extern class PromiseFulfillReactionJobTask extends PromiseReactionJobTask {}
@generateCppClass
extern class PromiseRejectReactionJobTask extends PromiseReactionJobTask {
}
extern class PromiseRejectReactionJobTask extends PromiseReactionJobTask {}
@generateCppClass
extern class PromiseResolveThenableJobTask extends Microtask {
context: Context;
promise_to_resolve: JSPromise;

View File

@ -2,7 +2,4 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class PropertyArray extends HeapObject {
length_and_hash: Smi;
}
extern class PropertyArray extends HeapObject { length_and_hash: Smi; }

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class PropertyCell extends HeapObject {
name: AnyName;
property_details_raw: Smi;

View File

@ -16,7 +16,6 @@ bitfield struct PropertyDescriptorObjectFlags extends uint31 {
has_set: bool: 1 bit;
}
@generateCppClass
@generatePrint
extern class PropertyDescriptorObject extends Struct {
flags: SmiTagged<PropertyDescriptorObjectFlags>;

View File

@ -6,7 +6,6 @@ bitfield struct PrototypeInfoFlags extends uint31 {
should_be_fast: bool: 1 bit;
}
@generateCppClass
extern class PrototypeInfo extends Struct {
// [module_namespace]: A backpointer to JSModuleNamespace from its
// PrototypeInfo (or undefined). This field is only used for JSModuleNamespace

View File

@ -4,7 +4,6 @@
@hasSameInstanceTypeAsParent
@doNotGenerateCast
@generateCppClass
extern class RegExpMatchInfo extends FixedArray {
macro GetStartOfCapture(implicit context: Context)(captureIndex:
constexpr int31): Smi {

View File

@ -97,7 +97,6 @@ struct ModuleVariable {
properties: SmiTagged<VariableProperties>;
}
@generateCppClass
@generateBodyDescriptor
extern class ScopeInfo extends HeapObject {
const flags: SmiTagged<ScopeFlags>;

View File

@ -14,7 +14,6 @@ bitfield struct ScriptFlags extends uint31 {
break_on_entry: bool: 1 bit;
}
@generateCppClass
extern class Script extends Struct {
// [source]: the script source.
source: String|Undefined;

View File

@ -2,21 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class PreparseData extends HeapObject {
// TODO(v8:8983): Add declaration for variable-sized region.
data_length: int32;
children_length: int32;
}
@generateCppClass
extern class InterpreterData extends Struct {
bytecode_array: BytecodeArray;
@if(V8_EXTERNAL_CODE_SPACE) interpreter_trampoline: CodeDataContainer;
@ifnot(V8_EXTERNAL_CODE_SPACE) interpreter_trampoline: Code;
}
@generateCppClass
@generatePrint
extern class BaselineData extends Struct {
@if(V8_EXTERNAL_CODE_SPACE) baseline_code: CodeDataContainer;

View File

@ -9,7 +9,6 @@ bitfield struct SourceTextModuleFlags extends uint31 {
async_evaluating_ordinal: uint32: 30 bit;
}
@generateCppClass
extern class SourceTextModule extends Module {
// The code representing this module, or an abstraction thereof.
code: SharedFunctionInfo|JSFunction|JSGeneratorObject;
@ -48,7 +47,6 @@ extern class SourceTextModule extends Module {
flags: SmiTagged<SourceTextModuleFlags>;
}
@generateCppClass
@generatePrint
extern class ModuleRequest extends Struct {
specifier: String;
@ -61,7 +59,6 @@ extern class ModuleRequest extends Struct {
position: Smi;
}
@generateCppClass
extern class SourceTextModuleInfoEntry extends Struct {
export_name: String|Undefined;
local_name: String|Undefined;

View File

@ -14,7 +14,6 @@ bitfield struct StackFrameInfoFlags extends uint31 {
is_source_position_computed: bool: 1 bit;
}
@generateCppClass
extern class StackFrameInfo extends Struct {
receiver_or_instance: JSAny;
function: JSFunction|Smi;

View File

@ -5,7 +5,6 @@
#include 'src/builtins/builtins-string-gen.h'
@abstract
@generateCppClass
@reserveBitsInInstanceType(6)
extern class String extends Name {
macro StringInstanceType(): StringInstanceType {
@ -31,7 +30,6 @@ bitfield struct StringInstanceType extends uint16 {
is_not_internalized: bool: 1 bit;
}
@generateCppClass
@generateBodyDescriptor
@doNotGenerateCast
extern class ConsString extends String {
@ -50,7 +48,6 @@ extern class ConsString extends String {
@abstract
@doNotGenerateCast
@generateCppClass
extern class ExternalString extends String {
resource: ExternalPointer;
// WARNING: This field is missing for uncached external strings.
@ -72,7 +69,6 @@ extern macro ExternalTwoByteStringGetChars(ExternalTwoByteString):
RawPtr<char16>;
@doNotGenerateCast
@generateCppClass
extern class ExternalOneByteString extends ExternalString {
macro GetChars(): RawPtr<char8> {
if (this.StringInstanceType().is_uncached) {
@ -84,7 +80,6 @@ extern class ExternalOneByteString extends ExternalString {
}
@doNotGenerateCast
@generateCppClass
extern class ExternalTwoByteString extends ExternalString {
macro GetChars(): RawPtr<char16> {
if (this.StringInstanceType().is_uncached) {
@ -95,30 +90,25 @@ extern class ExternalTwoByteString extends ExternalString {
}
}
@generateCppClass
@doNotGenerateCast
extern class InternalizedString extends String {
}
@abstract
@generateCppClass
@doNotGenerateCast
extern class SeqString extends String {
}
@generateCppClass
@generateBodyDescriptor
@doNotGenerateCast
extern class SeqOneByteString extends SeqString {
const chars[length]: char8;
}
@generateCppClass
@generateBodyDescriptor
@doNotGenerateCast
extern class SeqTwoByteString extends SeqString {
const chars[length]: char16;
}
@generateCppClass
@generateBodyDescriptor
@doNotGenerateCast
extern class SlicedString extends String {
@ -126,7 +116,6 @@ extern class SlicedString extends String {
offset: Smi;
}
@generateCppClass
@generateBodyDescriptor
@doNotGenerateCast
extern class ThinString extends String {

View File

@ -4,24 +4,20 @@
@abstract
@generatePrint
@generateCppClass
extern class Struct extends HeapObject {
}
@generatePrint
@generateCppClass
extern class Tuple2 extends Struct {
value1: Object;
value2: Object;
}
@generateCppClass
extern class ClassPositions extends Struct {
start: Smi;
end: Smi;
}
@generateCppClass
extern class AccessorPair extends Struct {
getter: Object;
setter: Object;

View File

@ -5,6 +5,7 @@
#include 'src/objects/swiss-name-dictionary.h'
@noVerifier
@doNotGenerateCppClass
extern class SwissNameDictionary extends HeapObject {
hash: uint32;
const capacity: int32;

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@generateCppClass
extern class SyntheticModule extends Module {
name: String;
export_names: FixedArray;

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
@generatePrint
@generateCppClass
extern class CachedTemplateObject extends Struct {
slot_id: Smi;
template_object: JSArray;
@ -11,7 +10,6 @@ extern class CachedTemplateObject extends Struct {
}
@generatePrint
@generateCppClass
extern class TemplateObjectDescription extends Struct {
raw_strings: FixedArray;
cooked_strings: FixedArray;

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
@abstract
@generateCppClass
extern class TemplateInfo extends Struct {
tag: Smi;
serial_number: Smi;
@ -12,7 +11,6 @@ extern class TemplateInfo extends Struct {
property_accessors: TemplateList|Undefined;
}
@generateCppClass
@generatePrint
extern class FunctionTemplateRareData extends Struct {
// See DECL_RARE_ACCESSORS in FunctionTemplateInfo.
@ -41,7 +39,6 @@ bitfield struct FunctionTemplateInfoFlags extends uint31 {
allowed_receiver_range_end: int32: 12 bit;
}
@generateCppClass
extern class FunctionTemplateInfo extends TemplateInfo {
// Handler invoked when calling an instance of this FunctionTemplateInfo.
// Either CallHandlerInfo or Undefined.
@ -78,7 +75,6 @@ bitfield struct ObjectTemplateInfoFlags extends uint31 {
embedder_field_count: int32: 28 bit;
}
@generateCppClass
extern class ObjectTemplateInfo extends TemplateInfo {
constructor: FunctionTemplateInfo|Undefined;
data: SmiTagged<ObjectTemplateInfoFlags>;

View File

@ -88,7 +88,8 @@ static const char* const ANNOTATION_NO_VERIFIER = "@noVerifier";
static const char* const ANNOTATION_ABSTRACT = "@abstract";
static const char* const ANNOTATION_HAS_SAME_INSTANCE_TYPE_AS_PARENT =
"@hasSameInstanceTypeAsParent";
static const char* const ANNOTATION_GENERATE_CPP_CLASS = "@generateCppClass";
static const char* const ANNOTATION_DO_NOT_GENERATE_CPP_CLASS =
"@doNotGenerateCppClass";
static const char* const ANNOTATION_CUSTOM_MAP = "@customMap";
static const char* const ANNOTATION_CUSTOM_CPP_CLASS = "@customCppClass";
static const char* const ANNOTATION_HIGHEST_INSTANCE_TYPE_WITHIN_PARENT =

View File

@ -889,7 +889,7 @@ base::Optional<ParseResult> MakeClassDeclaration(
child_results,
{ANNOTATION_GENERATE_PRINT, ANNOTATION_NO_VERIFIER, ANNOTATION_ABSTRACT,
ANNOTATION_HAS_SAME_INSTANCE_TYPE_AS_PARENT,
ANNOTATION_GENERATE_CPP_CLASS, ANNOTATION_CUSTOM_CPP_CLASS,
ANNOTATION_DO_NOT_GENERATE_CPP_CLASS, ANNOTATION_CUSTOM_CPP_CLASS,
ANNOTATION_CUSTOM_MAP, ANNOTATION_GENERATE_BODY_DESCRIPTOR,
ANNOTATION_EXPORT, ANNOTATION_DO_NOT_GENERATE_CAST,
ANNOTATION_HIGHEST_INSTANCE_TYPE_WITHIN_PARENT,
@ -907,9 +907,8 @@ base::Optional<ParseResult> MakeClassDeclaration(
if (annotations.Contains(ANNOTATION_HAS_SAME_INSTANCE_TYPE_AS_PARENT)) {
flags |= ClassFlag::kHasSameInstanceTypeAsParent;
}
if (annotations.Contains(ANNOTATION_GENERATE_CPP_CLASS)) {
flags |= ClassFlag::kGenerateCppClassDefinitions;
}
bool do_not_generate_cpp_class =
annotations.Contains(ANNOTATION_DO_NOT_GENERATE_CPP_CLASS);
if (annotations.Contains(ANNOTATION_CUSTOM_CPP_CLASS)) {
flags |= ClassFlag::kCustomCppClass;
}
@ -964,6 +963,14 @@ base::Optional<ParseResult> MakeClassDeclaration(
flags |= ClassFlag::kUndefinedLayout;
}
if (is_extern && body.has_value()) {
if (!do_not_generate_cpp_class) {
flags |= ClassFlag::kGenerateCppClassDefinitions;
}
} else if (do_not_generate_cpp_class) {
Lint("Annotation @doNotGenerateCppClass has no effect");
}
// Filter to only include fields that should be present based on decoration.
std::vector<ClassFieldExpression> fields;
std::copy_if(

View File

@ -11,7 +11,6 @@ type ManagedWasmNativeModule extends Foreign
extern class WasmInstanceObject extends JSObject;
@generateCppClass
extern class WasmFunctionData extends Foreign {
// This is the "reference" value that must be passed along in the "instance"
// register when calling the given function. It is either the target instance,
@ -26,7 +25,6 @@ extern class WasmFunctionData extends Foreign {
@ifnot(V8_EXTERNAL_CODE_SPACE) wrapper_code: Code;
}
@generateCppClass
extern class WasmExportedFunctionData extends WasmFunctionData {
// This is the instance that exported the function (which in case of
// imported and re-exported functions is different from the instance
@ -42,7 +40,6 @@ extern class WasmExportedFunctionData extends WasmFunctionData {
packed_args_size: Smi;
}
@generateCppClass
extern class WasmJSFunctionData extends WasmFunctionData {
@if(V8_EXTERNAL_CODE_SPACE) wasm_to_js_wrapper_code: CodeDataContainer;
@ifnot(V8_EXTERNAL_CODE_SPACE) wasm_to_js_wrapper_code: Code;
@ -51,13 +48,11 @@ extern class WasmJSFunctionData extends WasmFunctionData {
serialized_signature: PodArrayOfWasmValueType;
}
@generateCppClass
extern class WasmCapiFunctionData extends WasmFunctionData {
embedder_data: Foreign; // Managed<wasm::FuncData>
serialized_signature: PodArrayOfWasmValueType;
}
@generateCppClass
extern class WasmIndirectFunctionTable extends Struct {
size: uint32;
@if(TAGGED_SIZE_8_BYTES) optional_padding: uint32;
@ -68,7 +63,6 @@ extern class WasmIndirectFunctionTable extends Struct {
refs: FixedArray;
}
@generateCppClass
extern class WasmExceptionTag extends Struct {
// Note that this index is only useful for debugging purposes and it is not
// unique across modules. The GC however does not allow objects without at
@ -76,14 +70,12 @@ extern class WasmExceptionTag extends Struct {
index: Smi;
}
@generateCppClass
extern class WasmModuleObject extends JSObject {
managed_native_module: ManagedWasmNativeModule;
export_wrappers: FixedArray;
script: Script;
}
@generateCppClass
extern class WasmTableObject extends JSObject {
// The instance in which this WasmTableObject is defined.
// This field is undefined if the global is defined outside any Wasm module,
@ -99,14 +91,12 @@ extern class WasmTableObject extends JSObject {
raw_type: Smi;
}
@generateCppClass
extern class WasmMemoryObject extends JSObject {
array_buffer: JSArrayBuffer;
maximum_pages: Smi;
instances: WeakArrayList|Undefined;
}
@generateCppClass
extern class WasmGlobalObject extends JSObject {
// The instance in which this WasmGlobalObject is defined.
// This field is undefined if the global is defined outside any Wasm module,
@ -122,7 +112,6 @@ extern class WasmGlobalObject extends JSObject {
is_mutable: Smi;
}
@generateCppClass
extern class WasmExceptionObject extends JSObject {
serialized_signature: PodArrayOfWasmValueType;
exception_tag: HeapObject;
@ -130,14 +119,12 @@ extern class WasmExceptionObject extends JSObject {
type WasmExportedFunction extends JSFunction;
@generateCppClass
extern class AsmWasmData extends Struct {
managed_native_module: ManagedWasmNativeModule;
export_wrappers: FixedArray;
uses_bitset: HeapNumber;
}
@generateCppClass
extern class WasmTypeInfo extends Foreign {
supertypes: FixedArray;
subtypes: ArrayList;
@ -147,16 +134,13 @@ extern class WasmTypeInfo extends Foreign {
// WasmObject corresponds to data ref types which are WasmStruct and WasmArray.
@abstract
@generateCppClass
extern class WasmObject extends JSReceiver {
}
@generateCppClass
@highestInstanceTypeWithinParentClassRange
extern class WasmStruct extends WasmObject {
}
@generateCppClass
@lowestInstanceTypeWithinParentClassRange
extern class WasmArray extends WasmObject {
length: uint32;

View File

@ -49,6 +49,7 @@ type TaggedIndex extends StrongTagged;
type TaggedZeroPattern extends TaggedIndex;
@abstract
@doNotGenerateCppClass
extern class HeapObject extends StrongTagged {
map: Map;
}

View File

@ -115,7 +115,7 @@ def process(filename, lint, should_format):
print(filename + ' requires formatting', file=sys.stderr)
if should_format:
output_file = open(filename, 'w')
output_file = open(filename, 'wb')
output_file.write(output);
output_file.close()