-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
Expand file tree
/
Copy pathbase.tq
More file actions
3162 lines (2775 loc) Β· 104 KB
/
base.tq
File metadata and controls
3162 lines (2775 loc) Β· 104 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include 'src/builtins/builtins-regexp-gen.h'
#include 'src/builtins/builtins-utils-gen.h'
#include 'src/builtins/builtins.h'
#include 'src/codegen/code-factory.h'
#include 'src/heap/factory-inl.h'
#include 'src/objects/arguments.h'
#include 'src/objects/bigint.h'
#include 'src/objects/elements-kind.h'
#include 'src/objects/free-space.h'
#include 'src/objects/js-generator.h'
#include 'src/objects/js-promise.h'
#include 'src/objects/js-regexp-string-iterator.h'
#include 'src/objects/js-weak-refs.h'
#include 'src/objects/objects.h'
#include 'src/objects/source-text-module.h'
#include 'src/objects/stack-frame-info.h'
#include 'src/objects/synthetic-module.h'
#include 'src/objects/template-objects.h'
type void;
type never;
type Tagged generates 'TNode<Object>' constexpr 'ObjectPtr';
type Smi extends Tagged generates 'TNode<Smi>' constexpr 'Smi';
// A Smi that is greater than or equal to 0. See TaggedIsPositiveSmi.
type PositiveSmi extends Smi;
// The Smi value zero, which is often used as null for HeapObject types.
type Zero extends PositiveSmi;
// A value with the size of Tagged which may contain arbitrary data.
type Uninitialized extends Tagged;
@abstract
extern class HeapObject extends Tagged {
map: Map;
}
type Object = Smi | HeapObject;
type int32 generates 'TNode<Int32T>' constexpr 'int32_t';
type uint32 generates 'TNode<Uint32T>' constexpr 'uint32_t';
type int31 extends int32
generates 'TNode<Int32T>' constexpr 'int31_t';
type uint31 extends uint32
generates 'TNode<Uint32T>' constexpr 'uint31_t';
type int16 extends int31
generates 'TNode<Int16T>' constexpr 'int16_t';
type uint16 extends uint31
generates 'TNode<Uint16T>' constexpr 'uint16_t';
type int8 extends int16 generates 'TNode<Int8T>' constexpr 'int8_t';
type uint8 extends uint16
generates 'TNode<Uint8T>' constexpr 'uint8_t';
type int64 generates 'TNode<Int64T>' constexpr 'int64_t';
type intptr generates 'TNode<IntPtrT>' constexpr 'intptr_t';
type uintptr generates 'TNode<UintPtrT>' constexpr 'uintptr_t';
type float32 generates 'TNode<Float32T>' constexpr 'float';
type float64 generates 'TNode<Float64T>' constexpr 'double';
type bool generates 'TNode<BoolT>' constexpr 'bool';
type bint generates 'TNode<BInt>' constexpr 'BInt';
type string constexpr 'const char*';
type NameDictionary extends FixedArray;
type RawPtr generates 'TNode<RawPtrT>' constexpr 'void*';
type Code extends HeapObject generates 'TNode<Code>';
type BuiltinPtr extends Smi generates 'TNode<BuiltinPtr>';
extern class Context extends HeapObject {
length: Smi;
scope_info: ScopeInfo;
previous: Object;
extension: Object;
native_context: Object;
}
type NativeContext extends Context;
@generateCppClass
extern class Oddball extends HeapObject {
to_number_raw: float64;
to_string: String;
to_number: Number;
type_of: String;
kind: Smi;
}
extern class HeapNumber extends HeapObject { value: float64; }
type Number = Smi | HeapNumber;
type Numeric = Number | BigInt;
@abstract
@generateCppClass
extern class Name extends HeapObject {
hash_field: uint32;
}
@generateCppClass
extern class Symbol extends Name {
flags: int32;
name: Object; // The print name of a symbol, or undefined if none.
}
@abstract
@generateCppClass
extern class String extends Name {
length: int32;
}
@generateCppClass
extern class ConsString extends String {
first: String;
second: String;
}
@abstract
extern class ExternalString extends String {
resource: RawPtr;
resource_data: RawPtr;
}
extern class ExternalOneByteString extends ExternalString {}
extern class ExternalTwoByteString extends ExternalString {}
@generateCppClass
extern class InternalizedString extends String {
}
// TODO(v8:8983): Add declaration for variable-sized region.
@abstract
@generateCppClass
extern class SeqString extends String {
}
@generateCppClass
extern class SeqOneByteString extends SeqString {
}
@generateCppClass
extern class SeqTwoByteString extends SeqString {
}
@generateCppClass
extern class SlicedString extends String {
parent: String;
offset: Smi;
}
@generateCppClass
extern class ThinString extends String {
actual: String;
}
// The HeapNumber value NaN
type NaN extends HeapNumber;
@abstract
@generatePrint
@generateCppClass
extern class Struct extends HeapObject {
}
@abstract
@dirtyInstantiatedAbstractClass
@generatePrint
@generateCppClass
extern class Tuple2 extends Struct {
value1: Object;
value2: Object;
}
@abstract
@dirtyInstantiatedAbstractClass
@generatePrint
@generateCppClass
extern class Tuple3 extends Tuple2 {
value3: Object;
}
// A direct string can be accessed directly through CSA without going into the
// C++ runtime. See also: ToDirectStringAssembler.
type DirectString extends String;
type RootIndex generates 'TNode<Int32T>' constexpr 'RootIndex';
@abstract
@generateCppClass
extern class FixedArrayBase extends HeapObject {
length: Smi;
}
extern class FixedArray extends FixedArrayBase { objects[length]: Object; }
extern class FixedDoubleArray extends FixedArrayBase {
floats[length]: float64;
}
extern class WeakFixedArray extends HeapObject { length: Smi; }
extern class ByteArray extends FixedArrayBase {}
type LayoutDescriptor extends ByteArray
generates 'TNode<LayoutDescriptor>';
type TransitionArray extends WeakFixedArray
generates 'TNode<TransitionArray>';
type InstanceType extends uint16 constexpr 'InstanceType';
extern class Map extends HeapObject {
instance_size_in_words: uint8;
in_object_properties_start_or_constructor_function_index: uint8;
used_or_unused_instance_size_in_words: uint8;
visitor_id: uint8;
instance_type: InstanceType;
bit_field: uint8;
bit_field2: uint8;
bit_field3: uint32;
@if(TAGGED_SIZE_8_BYTES) optional_padding: uint32;
@ifnot(TAGGED_SIZE_8_BYTES) optional_padding: void;
prototype: HeapObject;
constructor_or_back_pointer: Object;
instance_descriptors: DescriptorArray;
@if(V8_DOUBLE_FIELDS_UNBOXING) layout_descriptor: LayoutDescriptor;
@ifnot(V8_DOUBLE_FIELDS_UNBOXING) layout_descriptor: void;
dependent_code: DependentCode;
prototype_validity_cell: Smi | Cell;
// TODO(v8:9108): Misusing "weak" keyword; type should be
// Map | Weak<Map> | TransitionArray | PrototypeInfo | Smi.
weak transitions_or_prototype_info: Map | TransitionArray |
PrototypeInfo | Smi;
}
@generatePrint
@generateCppClass
extern class EnumCache extends Struct {
keys: FixedArray;
indices: FixedArray;
}
@generatePrint
@generateCppClass
extern class SourcePositionTableWithFrameCache extends Struct {
source_position_table: ByteArray;
stack_frame_cache: Object;
}
// We make this class abstract because it is missing the variable-sized part,
// which is still impossible to express in Torque.
@abstract
extern class DescriptorArray extends HeapObject {
number_of_all_descriptors: uint16;
number_of_descriptors: uint16;
raw_number_of_marked_descriptors: uint16;
filler16_bits: uint16;
enum_cache: EnumCache;
// DescriptorEntry needs to be a struct with three fields.
// desriptors : DescriptorEntry[number_of_all_descriptors]
}
// These intrinsics should never be called from Torque code. They're used
// internally by the 'new' operator and only declared here because it's simpler
// than building the definition from C++.
intrinsic %GetAllocationBaseSize<Class: type>(map: Map): intptr;
intrinsic %Allocate<Class: type>(size: intptr): Class;
intrinsic %GetStructMap(instanceKind: constexpr InstanceType): Map;
intrinsic %AddIndexedFieldSizeToObjectSize<T: type>(
baseSize: intptr, indexSize: T, fieldSize: int32): intptr {
const convertedIndexSize = Convert<int32>(indexSize);
const variableSize: int32 =
TryInt32Mul(convertedIndexSize, fieldSize) otherwise unreachable;
const convertedVariableSize = Convert<intptr>(variableSize);
return TryIntPtrAdd(baseSize, convertedVariableSize) otherwise unreachable;
}
intrinsic
%InitializeFieldsFromIterator<Container: type, Index: type, Iterator: type>(
c: Container, length: Index, i: Iterator) {
try {
let mutableIterator = i;
let current: Index = 0;
while (current < length) {
// TODO(danno): The indexed accessor on the container requires that the
// '[]=' operator be defined explicitly for the Container
// (e.g. FixedArray). We should change this to use slice references
// once they are implemented.
c[current++] = mutableIterator.Next() otherwise NoMore;
}
}
label NoMore deferred {
unreachable;
}
}
@abstract
extern class JSReceiver extends HeapObject {
properties_or_hash: FixedArrayBase | PropertyArray | Smi;
}
type Constructor extends JSReceiver;
@abstract
@dirtyInstantiatedAbstractClass
@generateCppClass
extern class JSObject extends JSReceiver {
// [elements]: The elements (properties with names that are integers).
//
// Elements can be in two general modes: fast and slow. Each mode
// corresponds to a set of object representations of elements that
// have something in common.
//
// In the fast mode elements is a FixedArray and so each element can be
// quickly accessed. The elements array can have one of several maps in this
// mode: fixed_array_map, fixed_double_array_map,
// sloppy_arguments_elements_map or fixed_cow_array_map (for copy-on-write
// arrays). In the latter case the elements array may be shared by a few
// objects and so before writing to any element the array must be copied. Use
// EnsureWritableFastElements in this case.
//
// In the slow mode the elements is either a NumberDictionary or a
// FixedArray parameter map for a (sloppy) arguments object.
elements: FixedArrayBase;
}
macro NewJSObject(implicit context: Context)(): JSObject {
const objectFunction: JSFunction = GetObjectFunction();
const map: Map = Cast<Map>(objectFunction.prototype_or_initial_map)
otherwise unreachable;
return new JSObject{
map,
properties_or_hash: kEmptyFixedArray,
elements: kEmptyFixedArray
};
}
extern macro HasPrototypeSlot(JSFunction): bool;
macro GetDerivedMap(implicit context: Context)(
target: JSFunction, newTarget: JSReceiver): Map {
try {
const constructor = Cast<JSFunction>(newTarget) otherwise SlowPath;
if (!HasPrototypeSlot(constructor)) {
goto SlowPath;
}
assert(IsConstructor(constructor));
const map =
Cast<Map>(constructor.prototype_or_initial_map) otherwise SlowPath;
if (LoadConstructorOrBackPointer(map) != target) {
goto SlowPath;
}
return map;
}
label SlowPath {
return runtime::GetDerivedMap(context, target, newTarget);
}
}
macro AllocateFastOrSlowJSObjectFromMap(implicit context: Context)(map: Map):
JSObject {
let properties = kEmptyFixedArray;
if (IsDictionaryMap(map)) {
properties = AllocateNameDictionary(kNameDictionaryInitialCapacity);
}
return AllocateJSObjectFromMap(
map, properties, kEmptyFixedArray, kNone, kWithSlackTracking);
}
extern class JSFunction extends JSObject {
shared_function_info: SharedFunctionInfo;
context: Context;
feedback_cell: FeedbackCell;
weak code: Code;
// Space for the following field may or may not be allocated.
@noVerifier weak prototype_or_initial_map: JSReceiver | Map;
}
@generateCppClass
extern class JSProxy extends JSReceiver {
target: JSReceiver | Null;
handler: JSReceiver | Null;
}
// Just a starting shape for JSObject; properties can move after initialization.
@noVerifier
extern class JSProxyRevocableResult extends JSObject {
proxy: Object;
revoke: Object;
}
macro NewJSProxyRevocableResult(implicit context: Context)(
proxy: JSProxy, revoke: JSFunction): JSProxyRevocableResult {
return new JSProxyRevocableResult{
map: GetProxyRevocableResultMap(),
properties_or_hash: kEmptyFixedArray,
elements: kEmptyFixedArray,
proxy,
revoke
};
}
@generateCppClass
extern class JSGlobalProxy extends JSObject {
// [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;
}
@generateCppClass
extern class JSPrimitiveWrapper extends JSObject {
value: Object;
}
extern class JSArgumentsObject extends JSObject {}
// Just a starting shape for JSObject; properties can move after initialization.
@noVerifier
@hasSameInstanceTypeAsParent
extern class JSArgumentsObjectWithLength extends JSArgumentsObject {
length: Object;
}
// Just a starting shape for JSObject; properties can move after initialization.
@hasSameInstanceTypeAsParent
extern class JSSloppyArgumentsObject extends JSArgumentsObjectWithLength {
callee: Object;
}
// Just a starting shape for JSObject; properties can move after initialization.
@hasSameInstanceTypeAsParent
@noVerifier
extern class JSStrictArgumentsObject extends JSArgumentsObjectWithLength {
}
extern class JSArrayIterator extends JSObject {
iterated_object: JSReceiver;
next_index: Number;
kind: Smi;
}
extern class JSArray extends JSObject {
IsEmpty(): bool {
return this.length == 0;
}
length: Number;
}
macro NewJSArray(implicit context: Context)(
map: Map, elements: FixedArrayBase): JSArray {
return new JSArray{
map,
properties_or_hash: kEmptyFixedArray,
elements,
length: elements.length
};
}
macro NewJSArray(implicit context: Context)(): JSArray {
return new JSArray{
map: GetFastPackedSmiElementsJSArrayMap(),
properties_or_hash: kEmptyFixedArray,
elements: kEmptyFixedArray,
length: 0
};
}
// A HeapObject with a JSArray map, and either fast packed elements, or fast
// holey elements when the global NoElementsProtector is not invalidated.
transient type FastJSArray extends JSArray;
// A HeapObject with a JSArray map, and either fast packed elements, or fast
// holey elements or frozen, sealed elements when the global NoElementsProtector
// is not invalidated.
transient type FastJSArrayForRead extends JSArray;
// A FastJSArray when the global ArraySpeciesProtector is not invalidated.
transient type FastJSArrayForCopy extends FastJSArray;
// A FastJSArray when the global ArrayIteratorProtector is not invalidated.
transient type FastJSArrayWithNoCustomIteration extends FastJSArray;
// A FastJSArrayForRead when the global ArrayIteratorProtector is not
// invalidated.
transient type FastJSArrayForReadWithNoCustomIteration extends
FastJSArrayForRead;
type NoSharedNameSentinel extends Smi;
@generateCppClass
extern class CallHandlerInfo extends Struct {
callback: Foreign | Undefined;
js_callback: Foreign | Undefined;
data: Object;
}
type ObjectHashTable extends FixedArray;
@abstract
extern class Module extends HeapObject {
exports: ObjectHashTable;
hash: Smi;
status: Smi;
module_namespace: JSModuleNamespace | Undefined;
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;
}
extern class SyntheticModule extends Module {
name: String;
export_names: FixedArray;
evaluation_steps: Foreign;
}
@abstract
extern class JSModuleNamespace extends JSObject {
module: Module;
}
@hasSameInstanceTypeAsParent
@noVerifier
extern class TemplateList extends FixedArray {
}
@abstract
extern class JSWeakCollection extends JSObject {
table: Object;
}
extern class JSWeakSet extends JSWeakCollection {}
extern class JSWeakMap extends JSWeakCollection {}
extern class JSCollectionIterator extends JSObject {
table: Object;
index: Object;
}
extern class JSMessageObject extends JSObject {
// Tagged fields.
message_type: Smi;
arguments: Object;
script: Script;
stack_frames: Object;
shared_info: SharedFunctionInfo | Undefined;
// Raw data fields.
// TODO(ishell): store as int32 instead of Smi.
bytecode_offset: Smi;
start_position: Smi;
end_position: Smi;
error_level: Smi;
}
extern class WeakArrayList extends HeapObject {
capacity: Smi;
length: Smi;
// TODO(v8:8983): declare variable-sized region for contained MaybeObject's
// objects[length]: MaybeObject;
}
extern class PrototypeInfo extends Struct {
js_module_namespace: JSModuleNamespace | Undefined;
prototype_users: WeakArrayList | Zero;
registry_slot: Smi;
validity_cell: Object;
// TODO(v8:9108): Should be Weak<Map> | Undefined.
@noVerifier object_create_map: Map | Undefined;
bit_field: Smi;
}
extern class Script extends Struct {
source: Object;
name: Object;
line_offset: Smi;
column_offset: Smi;
context: Object;
script_type: Smi;
line_ends: Object;
id: Smi;
eval_from_shared_or_wrapped_arguments: Object;
eval_from_position: Smi;
shared_function_infos: Object;
flags: Smi;
source_url: Object;
source_mapping_url: Object;
host_defined_options: Object;
}
extern class EmbedderDataArray extends HeapObject { length: Smi; }
type ScopeInfo extends HeapObject generates 'TNode<ScopeInfo>';
extern class PreparseData extends HeapObject {
// TODO(v8:8983): Add declaration for variable-sized region.
data_length: int32;
inner_length: int32;
}
extern class InterpreterData extends Struct {
bytecode_array: BytecodeArray;
interpreter_trampoline: Code;
}
extern class SharedFunctionInfo extends HeapObject {
weak function_data: Object;
name_or_scope_info: String | NoSharedNameSentinel | ScopeInfo;
outer_scope_info_or_feedback_metadata: HeapObject;
script_or_debug_info: Script | DebugInfo | Undefined;
length: int16;
formal_parameter_count: uint16;
// Currently set to uint16, can be set to uint8 to save space.
expected_nof_properties: uint16;
function_token_offset: int16;
flags: int32;
function_literal_id: int32;
@if(V8_SFI_HAS_UNIQUE_ID) unique_id: int32;
}
extern class JSBoundFunction extends JSObject {
bound_target_function: Callable;
bound_this: Object;
bound_arguments: FixedArray;
}
// Specialized types. The following three type definitions don't correspond to
// actual C++ classes, but have Is... methods that check additional constraints.
// A Foreign object whose raw pointer is not allowed to be null.
type NonNullForeign extends Foreign;
// A function built with InstantiateFunction for the public API.
type CallableApiObject extends HeapObject;
// A JSProxy with the callable bit set.
type CallableJSProxy extends JSProxy;
type Callable =
JSFunction | JSBoundFunction | CallableJSProxy | CallableApiObject;
extern operator '.length_intptr' macro LoadAndUntagFixedArrayBaseLength(
FixedArrayBase): intptr;
type SloppyArgumentsElements extends FixedArray;
type NumberDictionary extends HeapObject
generates 'TNode<NumberDictionary>';
extern class FreeSpace extends HeapObject {
size: Smi;
next: FreeSpace | Uninitialized;
}
// %RawDownCast should *never* be used anywhere in Torque code except for
// in Torque-based UnsafeCast operators preceeded by an appropriate
// type assert()
intrinsic %RawDownCast<To: type, From: type>(x: From): To;
intrinsic %RawConstexprCast<To: type, From: type>(f: From): To;
type NativeContextSlot generates 'TNode<IntPtrT>' constexpr 'int32_t';
const ARRAY_BUFFER_FUN_INDEX: constexpr NativeContextSlot
generates 'Context::ARRAY_BUFFER_FUN_INDEX';
const ARRAY_BUFFER_NOINIT_FUN_INDEX: constexpr NativeContextSlot
generates 'Context::ARRAY_BUFFER_NOINIT_FUN_INDEX';
const ARRAY_BUFFER_MAP_INDEX: constexpr NativeContextSlot
generates 'Context::ARRAY_BUFFER_MAP_INDEX';
const ARRAY_JOIN_STACK_INDEX: constexpr NativeContextSlot
generates 'Context::ARRAY_JOIN_STACK_INDEX';
const OBJECT_FUNCTION_INDEX: constexpr NativeContextSlot
generates 'Context::OBJECT_FUNCTION_INDEX';
const ITERATOR_RESULT_MAP_INDEX: constexpr NativeContextSlot
generates 'Context::ITERATOR_RESULT_MAP_INDEX';
const JS_ARRAY_PACKED_ELEMENTS_MAP_INDEX: constexpr NativeContextSlot
generates 'Context::JS_ARRAY_PACKED_ELEMENTS_MAP_INDEX';
const JS_ARRAY_PACKED_SMI_ELEMENTS_MAP_INDEX: constexpr NativeContextSlot
generates 'Context::JS_ARRAY_PACKED_SMI_ELEMENTS_MAP_INDEX';
const PROXY_REVOCABLE_RESULT_MAP_INDEX: constexpr NativeContextSlot
generates 'Context::PROXY_REVOCABLE_RESULT_MAP_INDEX';
const REFLECT_APPLY_INDEX: constexpr NativeContextSlot
generates 'Context::REFLECT_APPLY_INDEX';
const REGEXP_LAST_MATCH_INFO_INDEX: constexpr NativeContextSlot
generates 'Context::REGEXP_LAST_MATCH_INFO_INDEX';
const INITIAL_STRING_ITERATOR_MAP_INDEX: constexpr NativeContextSlot
generates 'Context::INITIAL_STRING_ITERATOR_MAP_INDEX';
extern operator '[]' macro LoadContextElement(
NativeContext, NativeContextSlot): Object;
extern operator '[]=' macro StoreContextElement(
NativeContext, NativeContextSlot, Object): void;
type ContextSlot generates 'TNode<IntPtrT>' constexpr 'int32_t';
const PROXY_SLOT: constexpr ContextSlot
generates 'Context::MIN_CONTEXT_SLOTS';
extern operator '[]' macro LoadContextElement(Context, ContextSlot): Object;
extern operator '[]=' macro StoreContextElement(
Context, ContextSlot, Object): void;
extern operator '[]' macro LoadContextElement(Context, intptr): Object;
extern operator '[]' macro LoadContextElement(Context, Smi): Object;
extern class JSArrayBuffer extends JSObject {
byte_length: uintptr;
backing_store: RawPtr;
}
@abstract
extern class JSArrayBufferView extends JSObject {
buffer: JSArrayBuffer;
byte_offset: uintptr;
byte_length: uintptr;
}
extern class JSTypedArray extends JSArrayBufferView {
length: uintptr;
external_pointer: RawPtr;
base_pointer: ByteArray | Smi;
}
@abstract
extern class JSCollection extends JSObject {
table: Object;
}
extern class JSSet extends JSCollection {}
extern class JSMap extends JSCollection {}
extern class JSDate extends JSObject {
value: NumberOrUndefined;
year: Undefined | Smi | NaN;
month: Undefined | Smi | NaN;
day: Undefined | Smi | NaN;
weekday: Undefined | Smi | NaN;
hour: Undefined | Smi | NaN;
min: Undefined | Smi | NaN;
sec: Undefined | Smi | NaN;
cache_stamp: Undefined | Smi | NaN;
}
extern class JSGlobalObject extends JSObject {
native_context: NativeContext;
global_proxy: JSGlobalProxy;
}
extern class JSAsyncFromSyncIterator extends JSObject {
sync_iterator: JSReceiver;
next: Object;
}
extern class JSStringIterator extends JSObject {
string: String;
next_index: Smi;
}
@abstract
extern class TemplateInfo extends Struct {
tag: Object;
serial_number: Object;
number_of_properties: Smi;
property_list: Object;
property_accessors: Object;
}
@generatePrint
extern class TemplateObjectDescription extends Struct {
raw_strings: FixedArray;
cooked_strings: FixedArray;
}
extern class FunctionTemplateRareData extends Struct {
prototype_template: Object;
prototype_provider_template: Object;
parent_template: Object;
named_property_handler: Object;
indexed_property_handler: Object;
instance_template: Object;
instance_call_handler: Object;
access_check_info: Object;
}
extern class FunctionTemplateInfo extends TemplateInfo {
call_code: Object;
class_name: Object;
signature: Object;
function_template_rare_data: Object;
shared_function_info: Object;
flag: Smi;
length: Smi;
cached_property_name: Object;
}
extern class ObjectTemplateInfo extends TemplateInfo {
constructor: Object;
data: Object;
}
extern class PropertyArray extends HeapObject { length_and_hash: Smi; }
type DependentCode extends WeakFixedArray;
extern class PropertyCell extends HeapObject {
name: Name;
property_details_raw: Smi;
value: Object;
dependent_code: DependentCode;
}
extern class JSDataView extends JSArrayBufferView { data_pointer: RawPtr; }
type ElementsKind generates 'TNode<Int32T>' constexpr 'ElementsKind';
type LanguageMode extends Smi constexpr 'LanguageMode';
type ExtractFixedArrayFlags
generates 'TNode<Smi>'
constexpr 'CodeStubAssembler::ExtractFixedArrayFlags';
type WriteBarrierMode
generates 'TNode<Int32T>' constexpr 'WriteBarrierMode';
type MessageTemplate constexpr 'MessageTemplate';
type PrimitiveType constexpr 'PrimitiveType';
type ToIntegerTruncationMode
constexpr 'CodeStubAssembler::ToIntegerTruncationMode';
type AllocationFlags constexpr 'AllocationFlags';
type SlackTrackingMode constexpr 'SlackTrackingMode';
type UnicodeEncoding constexpr 'UnicodeEncoding';
const UTF16:
constexpr UnicodeEncoding generates 'UnicodeEncoding::UTF16';
const UTF32:
constexpr UnicodeEncoding generates 'UnicodeEncoding::UTF32';
extern class Foreign extends HeapObject { foreign_address: RawPtr; }
extern class InterceptorInfo extends Struct {
getter: NonNullForeign | Zero | Undefined;
setter: NonNullForeign | Zero | Undefined;
query: NonNullForeign | Zero | Undefined;
descriptor: NonNullForeign | Zero | Undefined;
deleter: NonNullForeign | Zero | Undefined;
enumerator: NonNullForeign | Zero | Undefined;
definer: NonNullForeign | Zero | Undefined;
data: Object;
flags: Smi;
}
extern class AccessCheckInfo extends Struct {
callback: Foreign | Zero | Undefined;
named_interceptor: InterceptorInfo | Zero | Undefined;
indexed_interceptor: InterceptorInfo | Zero | Undefined;
data: Object;
}
extern class ArrayBoilerplateDescription extends Struct {
flags: Smi;
constant_elements: FixedArrayBase;
}
extern class AliasedArgumentsEntry extends Struct { aliased_context_slot: Smi; }
extern class Cell extends HeapObject { value: Object; }
extern class DataHandler extends Struct {
smi_handler: Smi | Code;
validity_cell: Smi | Cell;
// Space for the following fields may or may not be allocated.
// TODO(v8:9108): Misusing "weak" keyword; should be MaybeObject.
@noVerifier weak data_1: Object;
@noVerifier weak data_2: Object;
@noVerifier weak data_3: Object;
}
@abstract
@dirtyInstantiatedAbstractClass
extern class JSGeneratorObject extends JSObject {
function: JSFunction;
context: Context;
receiver: Object;
input_or_debug_pos: Object;
resume_mode: Smi;
continuation: Smi;
parameters_and_registers: FixedArray;
}
extern class JSAsyncFunctionObject extends JSGeneratorObject {
promise: JSPromise;
}
extern class JSAsyncGeneratorObject extends JSGeneratorObject {
queue: HeapObject;
is_awaiting: Smi;
}
extern class JSPromise extends JSObject {
reactions_or_result: Object;
flags: Smi;
}
@abstract
extern class Microtask extends Struct {
}
extern class CallbackTask extends Microtask {
callback: Foreign;
data: Foreign;
}
extern class CallableTask extends Microtask {
callable: JSReceiver;
context: Context;
}
extern class StackFrameInfo extends Struct {
line_number: Smi;
column_number: Smi;
promise_all_index: Smi;
script_id: Smi;
script_name: String | Null | Undefined;
script_name_or_source_url: String | Null | Undefined;
function_name: String | Null | Undefined;
method_name: String | Null | Undefined;
type_name: String | Null | Undefined;
eval_origin: String | Null | Undefined;
wasm_module_name: String | Null | Undefined;
flag: Smi;
}
type FrameArray extends FixedArray;
extern class StackTraceFrame extends Struct {
frame_array: FrameArray | Undefined;
frame_index: Smi;
frame_info: StackFrameInfo | Undefined;
id: Smi;
}
extern class ClassPositions extends Struct {
start: Smi;
end: Smi;
}
type WasmInstanceObject extends JSObject;
extern class WasmExportedFunctionData extends Struct {
wrapper_code: Code;
instance: WasmInstanceObject;
jump_table_offset: Smi;
function_index: Smi;
// The remaining fields are for fast calling from C++. The contract is
// that they are lazily populated, and either all will be present or none.
c_wrapper_code: Object;
wasm_call_target: Smi; // Pseudo-smi: one-bit shift on all platforms.
packed_args_size: Smi;
}
extern class WasmJSFunctionData extends Struct {
callable: JSReceiver;
wrapper_code: Code;
serialized_return_count: Smi;
serialized_parameter_count: Smi;
serialized_signature: ByteArray; // PodArray<wasm::ValueType>
}
extern class WasmCapiFunctionData extends Struct {
call_target: RawPtr;
embedder_data: RawPtr;
wrapper_code: Code;
serialized_signature: ByteArray; // PodArray<wasm::ValueType>
}
extern class WasmIndirectFunctionTable extends Struct {
size: uint32;
@if(TAGGED_SIZE_8_BYTES) optional_padding: uint32;
@ifnot(TAGGED_SIZE_8_BYTES) optional_padding: void;
sig_ids: RawPtr;
targets: RawPtr;
managed_native_allocations: Foreign | Undefined;
refs: FixedArray;
}
extern class WasmDebugInfo extends Struct {
instance: WasmInstanceObject;
interpreter_handle: Foreign | Undefined;
locals_names: FixedArray | Undefined;
c_wasm_entries: FixedArray | Undefined;
c_wasm_entry_map: Foreign | Undefined; // Managed<wasm::SignatureMap>
}
extern class WasmExceptionTag extends Struct { index: Smi; }
const kSmiTagSize: constexpr int31 generates 'kSmiTagSize';