forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJavascriptLibrary.h
More file actions
1424 lines (1243 loc) · 84 KB
/
JavascriptLibrary.h
File metadata and controls
1424 lines (1243 loc) · 84 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 (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
#define InlineSlotCountIncrement (HeapConstants::ObjectGranularity / sizeof(Var))
#define MaxPreInitializedObjectTypeInlineSlotCount 16
#define MaxPreInitializedObjectHeaderInlinedTypeInlineSlotCount \
(Js::DynamicTypeHandler::GetObjectHeaderInlinableSlotCapacity() + MaxPreInitializedObjectTypeInlineSlotCount)
#define PreInitializedObjectTypeCount ((MaxPreInitializedObjectTypeInlineSlotCount / InlineSlotCountIncrement) + 1)
CompileAssert(MaxPreInitializedObjectTypeInlineSlotCount <= USHRT_MAX);
class ScriptSite;
class ActiveScriptExternalLibrary;
class ProjectionExternalLibrary;
class EditAndContinue;
class ChakraHostScriptContext;
#ifdef ENABLE_PROJECTION
namespace Projection
{
class ProjectionContext;
class WinRTPromiseEngineInterfaceExtensionObject;
}
#endif
namespace Js
{
static const unsigned int EvalMRUSize = 15;
typedef JsUtil::BaseDictionary<DWORD_PTR, SourceContextInfo *, Recycler, PowerOf2SizePolicy> SourceContextInfoMap;
typedef JsUtil::BaseDictionary<uint, SourceContextInfo *, Recycler, PowerOf2SizePolicy> DynamicSourceContextInfoMap;
typedef JsUtil::BaseDictionary<EvalMapString, ScriptFunction*, RecyclerNonLeafAllocator, PrimeSizePolicy> SecondLevelEvalCache;
typedef TwoLevelHashRecord<FastEvalMapString, ScriptFunction*, SecondLevelEvalCache, EvalMapString> EvalMapRecord;
typedef JsUtil::Cache<FastEvalMapString, EvalMapRecord*, RecyclerNonLeafAllocator, PrimeSizePolicy, JsUtil::MRURetentionPolicy<FastEvalMapString, EvalMRUSize>, FastEvalMapStringComparer> EvalCacheTopLevelDictionary;
typedef JsUtil::Cache<EvalMapString, FunctionInfo*, RecyclerNonLeafAllocator, PrimeSizePolicy, JsUtil::MRURetentionPolicy<EvalMapString, EvalMRUSize>> NewFunctionCache;
typedef JsUtil::BaseDictionary<ParseableFunctionInfo*, ParseableFunctionInfo*, Recycler, PrimeSizePolicy, RecyclerPointerComparer> ParseableFunctionInfoMap;
// This is the dictionary used by script context to cache the eval.
typedef TwoLevelHashDictionary<FastEvalMapString, ScriptFunction*, EvalMapRecord, EvalCacheTopLevelDictionary, EvalMapString> EvalCacheDictionary;
typedef JsUtil::BaseDictionary<JavascriptMethod, JavascriptFunction*, Recycler, PowerOf2SizePolicy> BuiltInLibraryFunctionMap;
// valid if object!= NULL
struct EnumeratedObjectCache
{
static const int kMaxCachedPropStrings = 16;
Field(DynamicObject*) object;
Field(DynamicType*) type;
Field(PropertyString*) propertyStrings[kMaxCachedPropStrings];
Field(int) validPropStrings;
};
struct PropertyStringMap
{
Field(PropertyString*) strLen2[80];
inline static uint PStrMapIndex(char16 ch)
{
Assert(ch >= '0' && ch <= 'z');
return ch - '0';
}
};
struct Cache
{
Field(PropertyStringMap*) propertyStrings[80];
Field(JavascriptString *) lastNumberToStringRadix10String;
Field(EnumeratedObjectCache) enumObjCache;
Field(JavascriptString *) lastUtcTimeFromStrString;
Field(EvalCacheDictionary*) evalCacheDictionary;
Field(EvalCacheDictionary*) indirectEvalCacheDictionary;
Field(NewFunctionCache*) newFunctionCache;
Field(RegexPatternMruMap *) dynamicRegexMap;
Field(SourceContextInfoMap*) sourceContextInfoMap; // maps host provided context cookie to the URL of the script buffer passed.
Field(DynamicSourceContextInfoMap*) dynamicSourceContextInfoMap;
Field(SourceContextInfo*) noContextSourceContextInfo;
Field(SRCINFO*) noContextGlobalSourceInfo;
Field(Field(SRCINFO const *)*) moduleSrcInfo;
Field(BuiltInLibraryFunctionMap*) builtInLibraryFunctions;
#if ENABLE_PROFILE_INFO
#if DBG_DUMP || defined(DYNAMIC_PROFILE_STORAGE) || defined(RUNTIME_DATA_COLLECTION)
Field(DynamicProfileInfoList*) profileInfoList;
#endif
#endif
Field(ConcatStringCache *) concatStringCache;
};
class MissingPropertyTypeHandler;
class SourceTextModuleRecord;
class ArrayBufferBase;
class SharedContents;
typedef RecyclerFastAllocator<JavascriptNumber, LeafBit> RecyclerJavascriptNumberAllocator;
typedef JsUtil::List<Var, Recycler> ListForListIterator;
class UndeclaredBlockVariable : public RecyclableObject
{
friend class JavascriptLibrary;
UndeclaredBlockVariable(Type* type) : RecyclableObject(type) { }
};
class SourceTextModuleRecord;
typedef JsUtil::List<SourceTextModuleRecord*> ModuleRecordList;
#if ENABLE_COPYONACCESS_ARRAY
struct CacheForCopyOnAccessArraySegments
{
static const uint32 MAX_SIZE = 31;
Field(SparseArraySegment<int32> *) cache[MAX_SIZE];
Field(uint32) count;
uint32 AddSegment(SparseArraySegment<int32> *segment)
{
cache[count++] = segment;
return count;
}
SparseArraySegment<int32> *GetSegmentByIndex(byte index)
{
Assert(index <= MAX_SIZE);
return cache[index - 1];
}
bool IsNotOverHardLimit()
{
return count < MAX_SIZE;
}
bool IsNotFull()
{
return count < (uint32) CONFIG_FLAG(CopyOnAccessArraySegmentCacheSize);
}
bool IsValidIndex(uint32 index)
{
return count && index && index <= count;
}
#if ENABLE_DEBUG_CONFIG_OPTIONS
uint32 GetCount()
{
return count;
}
#endif
};
#endif
template <typename T>
struct StringTemplateCallsiteObjectComparer
{
static bool Equals(T x, T y)
{
static_assert(false, "Unexpected type T");
}
static hash_t GetHashCode(T i)
{
static_assert(false, "Unexpected type T");
}
};
template <>
struct StringTemplateCallsiteObjectComparer<ParseNodePtr>
{
static bool Equals(ParseNodePtr x, RecyclerWeakReference<Js::RecyclableObject>* y);
static bool Equals(ParseNodePtr x, ParseNodePtr y);
static hash_t GetHashCode(ParseNodePtr i);
};
template <>
struct StringTemplateCallsiteObjectComparer<RecyclerWeakReference<Js::RecyclableObject>*>
{
static bool Equals(RecyclerWeakReference<Js::RecyclableObject>* x, RecyclerWeakReference<Js::RecyclableObject>* y);
static bool Equals(RecyclerWeakReference<Js::RecyclableObject>* x, ParseNodePtr y);
static hash_t GetHashCode(RecyclerWeakReference<Js::RecyclableObject>* o);
};
class JavascriptLibrary : public JavascriptLibraryBase
{
friend class EditAndContinue;
friend class ScriptSite;
friend class GlobalObject;
friend class ScriptContext;
friend class EngineInterfaceObject;
friend class ExternalLibraryBase;
friend class ActiveScriptExternalLibrary;
friend class IntlEngineInterfaceExtensionObject;
friend class ChakraHostScriptContext;
#ifdef ENABLE_PROJECTION
friend class ProjectionExternalLibrary;
friend class Projection::WinRTPromiseEngineInterfaceExtensionObject;
friend class Projection::ProjectionContext;
#endif
static const char16* domBuiltinPropertyNames[];
public:
#if ENABLE_COPYONACCESS_ARRAY
Field(CacheForCopyOnAccessArraySegments *) cacheForCopyOnAccessArraySegments;
#endif
static DWORD GetScriptContextOffset() { return offsetof(JavascriptLibrary, scriptContext); }
static DWORD GetUndeclBlockVarOffset() { return offsetof(JavascriptLibrary, undeclBlockVarSentinel); }
static DWORD GetEmptyStringOffset() { return offsetof(JavascriptLibrary, emptyString); }
static DWORD GetUndefinedValueOffset() { return offsetof(JavascriptLibrary, undefinedValue); }
static DWORD GetNullValueOffset() { return offsetof(JavascriptLibrary, nullValue); }
static DWORD GetBooleanTrueOffset() { return offsetof(JavascriptLibrary, booleanTrue); }
static DWORD GetBooleanFalseOffset() { return offsetof(JavascriptLibrary, booleanFalse); }
static DWORD GetNegativeZeroOffset() { return offsetof(JavascriptLibrary, negativeZero); }
static DWORD GetNumberTypeStaticOffset() { return offsetof(JavascriptLibrary, numberTypeStatic); }
static DWORD GetStringTypeStaticOffset() { return offsetof(JavascriptLibrary, stringTypeStatic); }
static DWORD GetObjectTypesOffset() { return offsetof(JavascriptLibrary, objectTypes); }
static DWORD GetObjectHeaderInlinedTypesOffset() { return offsetof(JavascriptLibrary, objectHeaderInlinedTypes); }
static DWORD GetRegexTypeOffset() { return offsetof(JavascriptLibrary, regexType); }
static DWORD GetArrayConstructorOffset() { return offsetof(JavascriptLibrary, arrayConstructor); }
static DWORD GetPositiveInfinityOffset() { return offsetof(JavascriptLibrary, positiveInfinite); }
static DWORD GetNaNOffset() { return offsetof(JavascriptLibrary, nan); }
static DWORD GetNativeIntArrayTypeOffset() { return offsetof(JavascriptLibrary, nativeIntArrayType); }
#if ENABLE_COPYONACCESS_ARRAY
static DWORD GetCopyOnAccessNativeIntArrayTypeOffset() { return offsetof(JavascriptLibrary, copyOnAccessNativeIntArrayType); }
#endif
static DWORD GetNativeFloatArrayTypeOffset() { return offsetof(JavascriptLibrary, nativeFloatArrayType); }
static DWORD GetVTableAddressesOffset() { return offsetof(JavascriptLibrary, vtableAddresses); }
static DWORD GetConstructorCacheDefaultInstanceOffset() { return offsetof(JavascriptLibrary, constructorCacheDefaultInstance); }
static DWORD GetAbsDoubleCstOffset() { return offsetof(JavascriptLibrary, absDoubleCst); }
static DWORD GetUintConvertConstOffset() { return offsetof(JavascriptLibrary, uintConvertConst); }
static DWORD GetBuiltinFunctionsOffset() { return offsetof(JavascriptLibrary, builtinFunctions); }
static DWORD GetCharStringCacheOffset() { return offsetof(JavascriptLibrary, charStringCache); }
static DWORD GetCharStringCacheAOffset() { return GetCharStringCacheOffset() + CharStringCache::GetCharStringCacheAOffset(); }
const JavascriptLibraryBase* GetLibraryBase() const { return static_cast<const JavascriptLibraryBase*>(this); }
void SetGlobalObject(GlobalObject* globalObject) {this->globalObject = globalObject; }
static DWORD GetRandSeed0Offset() { return offsetof(JavascriptLibrary, randSeed0); }
static DWORD GetRandSeed1Offset() { return offsetof(JavascriptLibrary, randSeed1); }
static DWORD GetTypeDisplayStringsOffset() { return offsetof(JavascriptLibrary, typeDisplayStrings); }
typedef bool (CALLBACK *PromiseContinuationCallback)(Var task, void *callbackState);
Var GetUndeclBlockVar() const { return undeclBlockVarSentinel; }
bool IsUndeclBlockVar(Var var) const { return var == undeclBlockVarSentinel; }
static bool IsTypedArrayConstructor(Var constructor, ScriptContext* scriptContext);
private:
FieldNoBarrier(Recycler *) recycler;
Field(ExternalLibraryBase*) externalLibraryList;
Field(UndeclaredBlockVariable*) undeclBlockVarSentinel;
Field(DynamicType *) generatorConstructorPrototypeObjectType;
Field(DynamicType *) constructorPrototypeObjectType;
Field(DynamicType *) heapArgumentsType;
Field(DynamicType *) activationObjectType;
Field(DynamicType *) arrayType;
Field(DynamicType *) nativeIntArrayType;
#if ENABLE_COPYONACCESS_ARRAY
Field(DynamicType *) copyOnAccessNativeIntArrayType;
#endif
Field(DynamicType *) nativeFloatArrayType;
Field(DynamicType *) arrayBufferType;
Field(DynamicType *) sharedArrayBufferType;
Field(DynamicType *) dataViewType;
Field(DynamicType *) typedArrayType;
Field(DynamicType *) int8ArrayType;
Field(DynamicType *) uint8ArrayType;
Field(DynamicType *) uint8ClampedArrayType;
Field(DynamicType *) int16ArrayType;
Field(DynamicType *) uint16ArrayType;
Field(DynamicType *) int32ArrayType;
Field(DynamicType *) uint32ArrayType;
Field(DynamicType *) float32ArrayType;
Field(DynamicType *) float64ArrayType;
Field(DynamicType *) int64ArrayType;
Field(DynamicType *) uint64ArrayType;
Field(DynamicType *) boolArrayType;
Field(DynamicType *) charArrayType;
Field(StaticType *) booleanTypeStatic;
Field(DynamicType *) booleanTypeDynamic;
Field(DynamicType *) dateType;
Field(StaticType *) variantDateType;
Field(DynamicType *) symbolTypeDynamic;
Field(StaticType *) symbolTypeStatic;
Field(DynamicType *) iteratorResultType;
Field(DynamicType *) arrayIteratorType;
Field(DynamicType *) mapIteratorType;
Field(DynamicType *) setIteratorType;
Field(DynamicType *) stringIteratorType;
Field(DynamicType *) promiseType;
Field(DynamicType *) listIteratorType;
Field(JavascriptFunction*) builtinFunctions[BuiltinFunction::Count];
Field(INT_PTR) vtableAddresses[VTableValue::Count];
Field(JavascriptString*) typeDisplayStrings[TypeIds_Limit];
Field(ConstructorCache *) constructorCacheDefaultInstance;
__declspec(align(16)) Field(const BYTE *) absDoubleCst;
Field(double const *) uintConvertConst;
// Function Types
Field(DynamicTypeHandler *) anonymousFunctionTypeHandler;
Field(DynamicTypeHandler *) anonymousFunctionWithPrototypeTypeHandler;
Field(DynamicTypeHandler *) functionTypeHandler;
Field(DynamicTypeHandler *) functionWithPrototypeTypeHandler;
Field(DynamicType *) externalFunctionWithDeferredPrototypeType;
Field(DynamicType *) wrappedFunctionWithDeferredPrototypeType;
Field(DynamicType *) stdCallFunctionWithDeferredPrototypeType;
Field(DynamicType *) idMappedFunctionWithPrototypeType;
Field(DynamicType *) externalConstructorFunctionWithDeferredPrototypeType;
Field(DynamicType *) defaultExternalConstructorFunctionWithDeferredPrototypeType;
Field(DynamicType *) boundFunctionType;
Field(DynamicType *) regexConstructorType;
Field(DynamicType *) crossSiteDeferredPrototypeFunctionType;
Field(DynamicType *) crossSiteIdMappedFunctionWithPrototypeType;
Field(DynamicType *) crossSiteExternalConstructFunctionWithPrototypeType;
Field(StaticType *) enumeratorType;
Field(DynamicType *) errorType;
Field(DynamicType *) evalErrorType;
Field(DynamicType *) rangeErrorType;
Field(DynamicType *) referenceErrorType;
Field(DynamicType *) syntaxErrorType;
Field(DynamicType *) typeErrorType;
Field(DynamicType *) uriErrorType;
Field(DynamicType *) webAssemblyCompileErrorType;
Field(DynamicType *) webAssemblyRuntimeErrorType;
Field(DynamicType *) webAssemblyLinkErrorType;
Field(StaticType *) numberTypeStatic;
Field(StaticType *) int64NumberTypeStatic;
Field(StaticType *) uint64NumberTypeStatic;
Field(DynamicType *) webAssemblyModuleType;
Field(DynamicType *) webAssemblyInstanceType;
Field(DynamicType *) webAssemblyMemoryType;
Field(DynamicType *) webAssemblyTableType;
// SIMD_JS
Field(DynamicType *) simdBool8x16TypeDynamic;
Field(DynamicType *) simdBool16x8TypeDynamic;
Field(DynamicType *) simdBool32x4TypeDynamic;
Field(DynamicType *) simdInt8x16TypeDynamic;
Field(DynamicType *) simdInt16x8TypeDynamic;
Field(DynamicType *) simdInt32x4TypeDynamic;
Field(DynamicType *) simdUint8x16TypeDynamic;
Field(DynamicType *) simdUint16x8TypeDynamic;
Field(DynamicType *) simdUint32x4TypeDynamic;
Field(DynamicType *) simdFloat32x4TypeDynamic;
Field(StaticType *) simdFloat32x4TypeStatic;
Field(StaticType *) simdInt32x4TypeStatic;
Field(StaticType *) simdInt8x16TypeStatic;
Field(StaticType *) simdFloat64x2TypeStatic;
Field(StaticType *) simdInt16x8TypeStatic;
Field(StaticType *) simdBool32x4TypeStatic;
Field(StaticType *) simdBool16x8TypeStatic;
Field(StaticType *) simdBool8x16TypeStatic;
Field(StaticType *) simdUint32x4TypeStatic;
Field(StaticType *) simdUint16x8TypeStatic;
Field(StaticType *) simdUint8x16TypeStatic;
Field(DynamicType *) numberTypeDynamic;
Field(DynamicType *) objectTypes[PreInitializedObjectTypeCount];
Field(DynamicType *) objectHeaderInlinedTypes[PreInitializedObjectTypeCount];
Field(DynamicType *) regexPrototypeType;
Field(DynamicType *) regexType;
Field(DynamicType *) regexResultType;
Field(StaticType *) stringTypeStatic;
Field(DynamicType *) stringTypeDynamic;
Field(DynamicType *) mapType;
Field(DynamicType *) setType;
Field(DynamicType *) weakMapType;
Field(DynamicType *) weakSetType;
Field(DynamicType *) proxyType;
Field(StaticType *) withType;
Field(DynamicType *) SpreadArgumentType;
Field(DynamicType *) moduleNamespaceType;
Field(PropertyDescriptor) defaultPropertyDescriptor;
Field(JavascriptString*) nullString;
Field(JavascriptString*) emptyString;
Field(JavascriptString*) quotesString;
Field(JavascriptString*) whackString;
Field(JavascriptString*) objectArgumentsDisplayString;
Field(JavascriptString*) objectArrayDisplayString;
Field(JavascriptString*) objectBooleanDisplayString;
Field(JavascriptString*) objectDateDisplayString;
Field(JavascriptString*) objectErrorDisplayString;
Field(JavascriptString*) objectFunctionDisplayString;
Field(JavascriptString*) objectDisplayString;
Field(JavascriptString*) objectNumberDisplayString;
Field(JavascriptString*) objectRegExpDisplayString;
Field(JavascriptString*) objectStringDisplayString;
Field(JavascriptString*) stringTypeDisplayString;
Field(JavascriptString*) functionPrefixString;
Field(JavascriptString*) generatorFunctionPrefixString;
Field(JavascriptString*) asyncFunctionPrefixString;
Field(JavascriptString*) functionDisplayString;
Field(JavascriptString*) xDomainFunctionDisplayString;
Field(JavascriptString*) undefinedDisplayString;
Field(JavascriptString*) nanDisplayString;
Field(JavascriptString*) nullDisplayString;
Field(JavascriptString*) unknownDisplayString;
Field(JavascriptString*) commaDisplayString;
Field(JavascriptString*) commaSpaceDisplayString;
Field(JavascriptString*) trueDisplayString;
Field(JavascriptString*) falseDisplayString;
Field(JavascriptString*) invalidDateString;
Field(JavascriptString*) objectTypeDisplayString;
Field(JavascriptString*) functionTypeDisplayString;
Field(JavascriptString*) booleanTypeDisplayString;
Field(JavascriptString*) numberTypeDisplayString;
Field(JavascriptString*) moduleTypeDisplayString;
Field(JavascriptString*) variantDateTypeDisplayString;
// SIMD_JS
Field(JavascriptString*) simdFloat32x4DisplayString;
Field(JavascriptString*) simdFloat64x2DisplayString;
Field(JavascriptString*) simdInt32x4DisplayString;
Field(JavascriptString*) simdInt16x8DisplayString;
Field(JavascriptString*) simdInt8x16DisplayString;
Field(JavascriptString*) simdBool32x4DisplayString;
Field(JavascriptString*) simdBool16x8DisplayString;
Field(JavascriptString*) simdBool8x16DisplayString;
Field(JavascriptString*) simdUint32x4DisplayString;
Field(JavascriptString*) simdUint16x8DisplayString;
Field(JavascriptString*) simdUint8x16DisplayString;
Field(JavascriptString*) symbolTypeDisplayString;
Field(JavascriptString*) debuggerDeadZoneBlockVariableString;
Field(DynamicObject*) missingPropertyHolder;
Field(StaticType*) throwErrorObjectType;
Field(PropertyStringCacheMap*) propertyStringMap;
Field(ConstructorCache*) builtInConstructorCache;
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
Field(JavascriptFunction*) debugObjectFaultInjectionCookieGetterFunction;
Field(JavascriptFunction*) debugObjectFaultInjectionCookieSetterFunction;
#endif
Field(JavascriptFunction*) evalFunctionObject;
Field(JavascriptFunction*) parseIntFunctionObject;
Field(JavascriptFunction*) parseFloatFunctionObject;
Field(JavascriptFunction*) arrayPrototypeToStringFunction;
Field(JavascriptFunction*) arrayPrototypeToLocaleStringFunction;
Field(JavascriptFunction*) identityFunction;
Field(JavascriptFunction*) throwerFunction;
Field(JavascriptFunction*) generatorNextFunction;
Field(JavascriptFunction*) generatorThrowFunction;
Field(JavascriptFunction*) objectValueOfFunction;
Field(JavascriptFunction*) objectToStringFunction;
#ifdef ENABLE_WASM
Field(DynamicObject*) webAssemblyObject;
Field(JavascriptFunction*) webAssemblyQueryResponseFunction;
Field(JavascriptFunction*) webAssemblyCompileFunction;
Field(JavascriptFunction*) webAssemblyInstantiateBoundFunction;
#endif
// SIMD_JS
Field(JavascriptFunction*) simdFloat32x4ToStringFunction;
Field(JavascriptFunction*) simdFloat64x2ToStringFunction;
Field(JavascriptFunction*) simdInt32x4ToStringFunction;
Field(JavascriptFunction*) simdInt16x8ToStringFunction;
Field(JavascriptFunction*) simdInt8x16ToStringFunction;
Field(JavascriptFunction*) simdBool32x4ToStringFunction;
Field(JavascriptFunction*) simdBool16x8ToStringFunction;
Field(JavascriptFunction*) simdBool8x16ToStringFunction;
Field(JavascriptFunction*) simdUint32x4ToStringFunction;
Field(JavascriptFunction*) simdUint16x8ToStringFunction;
Field(JavascriptFunction*) simdUint8x16ToStringFunction;
Field(JavascriptSymbol*) symbolMatch;
Field(JavascriptSymbol*) symbolReplace;
Field(JavascriptSymbol*) symbolSearch;
Field(JavascriptSymbol*) symbolSplit;
Field(UnifiedRegex::RegexPattern *) emptyRegexPattern;
Field(JavascriptFunction*) regexExecFunction;
Field(JavascriptFunction*) regexFlagsGetterFunction;
Field(JavascriptFunction*) regexGlobalGetterFunction;
Field(JavascriptFunction*) regexStickyGetterFunction;
Field(JavascriptFunction*) regexUnicodeGetterFunction;
Field(RuntimeFunction*) sharedArrayBufferConstructor;
Field(DynamicObject*) sharedArrayBufferPrototype;
Field(DynamicObject*) atomicsObject;
Field(DynamicObject*) webAssemblyCompileErrorPrototype;
Field(RuntimeFunction*) webAssemblyCompileErrorConstructor;
Field(DynamicObject*) webAssemblyRuntimeErrorPrototype;
Field(RuntimeFunction*) webAssemblyRuntimeErrorConstructor;
Field(DynamicObject*) webAssemblyLinkErrorPrototype;
Field(RuntimeFunction*) webAssemblyLinkErrorConstructor;
Field(DynamicObject*) webAssemblyMemoryPrototype;
Field(RuntimeFunction*) webAssemblyMemoryConstructor;
Field(DynamicObject*) webAssemblyModulePrototype;
Field(RuntimeFunction*) webAssemblyModuleConstructor;
Field(DynamicObject*) webAssemblyInstancePrototype;
Field(RuntimeFunction*) webAssemblyInstanceConstructor;
Field(DynamicObject*) webAssemblyTablePrototype;
Field(RuntimeFunction*) webAssemblyTableConstructor;
Field(int) regexConstructorSlotIndex;
Field(int) regexExecSlotIndex;
Field(int) regexFlagsGetterSlotIndex;
Field(int) regexGlobalGetterSlotIndex;
Field(int) regexStickyGetterSlotIndex;
Field(int) regexUnicodeGetterSlotIndex;
mutable Field(CharStringCache) charStringCache;
FieldNoBarrier(PromiseContinuationCallback) nativeHostPromiseContinuationFunction;
Field(void *) nativeHostPromiseContinuationFunctionState;
typedef SList<Js::FunctionProxy*, Recycler> FunctionReferenceList;
typedef JsUtil::WeakReferenceDictionary<uintptr_t, DynamicType, DictionarySizePolicy<PowerOf2Policy, 1>> JsrtExternalTypesCache;
Field(void *) bindRefChunkBegin;
Field(Field(void*)*) bindRefChunkCurrent;
Field(Field(void*)*) bindRefChunkEnd;
Field(TypePath*) rootPath; // this should be in library instead of ScriptContext::Cache
Field(Js::Cache) cache;
Field(FunctionReferenceList*) dynamicFunctionReference;
Field(uint) dynamicFunctionReferenceDepth;
Field(FinalizableObject*) jsrtContextObject;
Field(JsrtExternalTypesCache*) jsrtExternalTypesCache;
Field(FunctionBody*) fakeGlobalFuncForUndefer;
typedef JsUtil::BaseHashSet<RecyclerWeakReference<RecyclableObject>*, Recycler, PowerOf2SizePolicy, RecyclerWeakReference<RecyclableObject>*, StringTemplateCallsiteObjectComparer> StringTemplateCallsiteObjectList;
// Used to store a list of template callsite objects.
// We use the raw strings in the callsite object (or a string template parse node) to identify unique callsite objects in the list.
// See abstract operation GetTemplateObject in ES6 Spec (RC1) 12.2.8.3
Field(StringTemplateCallsiteObjectList*) stringTemplateCallsiteObjectList;
Field(ModuleRecordList*) moduleRecordList;
// This list contains types ensured to have only writable data properties in it and all objects in its prototype chain
// (i.e., no readonly properties or accessors). Only prototype objects' types are stored in the list. When something
// in the script context adds a readonly property or accessor to an object that is used as a prototype object, this
// list is cleared. The list is also cleared before garbage collection so that it does not keep growing, and so, it can
// hold strong references to the types.
//
// The cache is used by the type-without-property local inline cache. When setting a property on a type that doesn't
// have the property, to determine whether to promote the object like an object of that type was last promoted, we need
// to ensure that objects in the prototype chain have not acquired a readonly property or setter (ideally, only for that
// property ID, but we just check for any such property). This cache is used to avoid doing this many times, especially
// when the prototype chain is not short.
//
// This list is only used to invalidate the status of types. The type itself contains a boolean indicating whether it
// and prototypes contain only writable data properties, which is reset upon invalidating the status.
Field(JsUtil::List<Type *> *) typesEnsuredToHaveOnlyWritableDataPropertiesInItAndPrototypeChain;
Field(uint64) randSeed0, randSeed1;
Field(bool) isPRNGSeeded;
Field(bool) inProfileMode;
Field(bool) inDispatchProfileMode;
Field(bool) arrayObjectHasUserDefinedSpecies;
JavascriptFunction * AddFunctionToLibraryObjectWithPrototype(DynamicObject * object, PropertyId propertyId, FunctionInfo * functionInfo, int length, DynamicObject * prototype = nullptr, DynamicType * functionType = nullptr);
JavascriptFunction * AddFunctionToLibraryObject(DynamicObject* object, PropertyId propertyId, FunctionInfo * functionInfo, int length, PropertyAttributes attributes = PropertyBuiltInMethodDefaults);
JavascriptFunction * AddFunctionToLibraryObjectWithName(DynamicObject* object, PropertyId propertyId, PropertyId nameId, FunctionInfo * functionInfo, int length);
RuntimeFunction* AddGetterToLibraryObject(DynamicObject* object, PropertyId propertyId, FunctionInfo* functionInfo);
void AddAccessorsToLibraryObject(DynamicObject* object, PropertyId propertyId, FunctionInfo * getterFunctionInfo, FunctionInfo * setterFunctionInfo);
void AddAccessorsToLibraryObject(DynamicObject* object, PropertyId propertyId, RecyclableObject * getterFunction, RecyclableObject * setterFunction);
void AddAccessorsToLibraryObjectWithName(DynamicObject* object, PropertyId propertyId, PropertyId nameId, FunctionInfo * getterFunctionInfo, FunctionInfo * setterFunction);
RuntimeFunction * CreateGetterFunction(PropertyId nameId, FunctionInfo* functionInfo);
RuntimeFunction * CreateSetterFunction(PropertyId nameId, FunctionInfo* functionInfo);
template <size_t N>
JavascriptFunction * AddFunctionToLibraryObjectWithPropertyName(DynamicObject* object, const char16(&propertyName)[N], FunctionInfo * functionInfo, int length);
static SimpleTypeHandler<1> SharedPrototypeTypeHandler;
static SimpleTypeHandler<1> SharedFunctionWithoutPrototypeTypeHandler;
static SimpleTypeHandler<1> SharedFunctionWithPrototypeTypeHandlerV11;
static SimpleTypeHandler<2> SharedFunctionWithPrototypeTypeHandler;
static SimpleTypeHandler<1> SharedFunctionWithLengthTypeHandler;
static SimpleTypeHandler<2> SharedFunctionWithLengthAndNameTypeHandler;
static SimpleTypeHandler<1> SharedIdMappedFunctionWithPrototypeTypeHandler;
static SimpleTypeHandler<2> SharedNamespaceSymbolTypeHandler;
static MissingPropertyTypeHandler MissingPropertyHolderTypeHandler;
static SimplePropertyDescriptor const SharedFunctionPropertyDescriptors[2];
static SimplePropertyDescriptor const HeapArgumentsPropertyDescriptors[3];
static SimplePropertyDescriptor const FunctionWithLengthAndPrototypeTypeDescriptors[2];
static SimplePropertyDescriptor const FunctionWithLengthAndNameTypeDescriptors[2];
static SimplePropertyDescriptor const ModuleNamespaceTypeDescriptors[2];
public:
static const ObjectInfoBits EnumFunctionClass = EnumClass_1_Bit;
static void InitializeProperties(ThreadContext * threadContext);
JavascriptLibrary(GlobalObject* globalObject) :
JavascriptLibraryBase(globalObject),
inProfileMode(false),
inDispatchProfileMode(false),
propertyStringMap(nullptr),
parseIntFunctionObject(nullptr),
evalFunctionObject(nullptr),
parseFloatFunctionObject(nullptr),
arrayPrototypeToLocaleStringFunction(nullptr),
arrayPrototypeToStringFunction(nullptr),
identityFunction(nullptr),
throwerFunction(nullptr),
jsrtContextObject(nullptr),
jsrtExternalTypesCache(nullptr),
fakeGlobalFuncForUndefer(nullptr),
externalLibraryList(nullptr),
#if ENABLE_COPYONACCESS_ARRAY
cacheForCopyOnAccessArraySegments(nullptr),
#endif
referencedPropertyRecords(nullptr),
stringTemplateCallsiteObjectList(nullptr),
moduleRecordList(nullptr),
rootPath(nullptr),
bindRefChunkBegin(nullptr),
bindRefChunkCurrent(nullptr),
bindRefChunkEnd(nullptr),
dynamicFunctionReference(nullptr)
{
this->globalObject = globalObject;
}
void Initialize(ScriptContext* scriptContext, GlobalObject * globalObject);
void Uninitialize();
GlobalObject* GetGlobalObject() const { return globalObject; }
ScriptContext* GetScriptContext() const { return scriptContext; }
Recycler * GetRecycler() const { return recycler; }
Var GetTrueOrFalse(BOOL value) { return value ? booleanTrue : booleanFalse; }
JavascriptSymbol* GetSymbolMatch() { return symbolMatch; }
JavascriptSymbol* GetSymbolReplace() { return symbolReplace; }
JavascriptSymbol* GetSymbolSearch() { return symbolSearch; }
JavascriptSymbol* GetSymbolSplit() { return symbolSplit; }
JavascriptSymbol* GetSymbolSpecies() { return symbolSpecies; }
JavascriptString* GetNullString() { return nullString; }
JavascriptString* GetEmptyString() const;
JavascriptString* GetWhackString() { return whackString; }
JavascriptString* GetUndefinedDisplayString() { return undefinedDisplayString; }
JavascriptString* GetNaNDisplayString() { return nanDisplayString; }
JavascriptString* GetQuotesString() { return quotesString; }
JavascriptString* GetNullDisplayString() { return nullDisplayString; }
JavascriptString* GetUnknownDisplayString() { return unknownDisplayString; }
JavascriptString* GetCommaDisplayString() { return commaDisplayString; }
JavascriptString* GetCommaSpaceDisplayString() { return commaSpaceDisplayString; }
JavascriptString* GetTrueDisplayString() { return trueDisplayString; }
JavascriptString* GetFalseDisplayString() { return falseDisplayString; }
JavascriptString* GetObjectDisplayString() { return objectDisplayString; }
JavascriptString* GetObjectArgumentsDisplayString() { return objectArgumentsDisplayString; }
JavascriptString* GetObjectArrayDisplayString() { return objectArrayDisplayString; }
JavascriptString* GetObjectBooleanDisplayString() { return objectBooleanDisplayString; }
JavascriptString* GetObjectDateDisplayString() { return objectDateDisplayString; }
JavascriptString* GetObjectErrorDisplayString() { return objectErrorDisplayString; }
JavascriptString* GetObjectFunctionDisplayString() { return objectFunctionDisplayString; }
JavascriptString* GetObjectNumberDisplayString() { return objectNumberDisplayString; }
JavascriptString* GetObjectRegExpDisplayString() { return objectRegExpDisplayString; }
JavascriptString* GetObjectStringDisplayString() { return objectStringDisplayString; }
JavascriptString* GetStringTypeDisplayString() { return stringTypeDisplayString; }
JavascriptString* GetFunctionPrefixString() { return functionPrefixString; }
JavascriptString* GetGeneratorFunctionPrefixString() { return generatorFunctionPrefixString; }
JavascriptString* GetAsyncFunctionPrefixString() { return asyncFunctionPrefixString; }
JavascriptString* GetFunctionDisplayString() { return functionDisplayString; }
JavascriptString* GetXDomainFunctionDisplayString() { return xDomainFunctionDisplayString; }
JavascriptString* GetInvalidDateString() { return invalidDateString; }
JavascriptString* GetObjectTypeDisplayString() const { return objectTypeDisplayString; }
JavascriptString* GetFunctionTypeDisplayString() const { return functionTypeDisplayString; }
JavascriptString* GetBooleanTypeDisplayString() const { return booleanTypeDisplayString; }
JavascriptString* GetNumberTypeDisplayString() const { return numberTypeDisplayString; }
JavascriptString* GetModuleTypeDisplayString() const { return moduleTypeDisplayString; }
JavascriptString* GetVariantDateTypeDisplayString() const { return variantDateTypeDisplayString; }
// SIMD_JS
JavascriptString* GetSIMDFloat32x4DisplayString() const { return simdFloat32x4DisplayString; }
JavascriptString* GetSIMDFloat64x2DisplayString() const { return simdFloat64x2DisplayString; }
JavascriptString* GetSIMDInt32x4DisplayString() const { return simdInt32x4DisplayString; }
JavascriptString* GetSIMDInt16x8DisplayString() const { return simdInt16x8DisplayString; }
JavascriptString* GetSIMDInt8x16DisplayString() const { return simdInt8x16DisplayString; }
JavascriptString* GetSIMDBool32x4DisplayString() const { return simdBool32x4DisplayString; }
JavascriptString* GetSIMDBool16x8DisplayString() const { return simdBool16x8DisplayString; }
JavascriptString* GetSIMDBool8x16DisplayString() const { return simdBool8x16DisplayString; }
JavascriptString* GetSIMDUint32x4DisplayString() const { return simdUint32x4DisplayString; }
JavascriptString* GetSIMDUint16x8DisplayString() const { return simdUint16x8DisplayString; }
JavascriptString* GetSIMDUint8x16DisplayString() const { return simdUint8x16DisplayString; }
JavascriptString* GetSymbolTypeDisplayString() const { return symbolTypeDisplayString; }
JavascriptString* GetDebuggerDeadZoneBlockVariableString() { Assert(debuggerDeadZoneBlockVariableString); return debuggerDeadZoneBlockVariableString; }
JavascriptRegExp* CreateEmptyRegExp();
JavascriptFunction* GetEvalFunctionObject() { return evalFunctionObject; }
JavascriptFunction* GetArrayIteratorPrototypeBuiltinNextFunction() { return arrayIteratorPrototypeBuiltinNextFunction; }
DynamicObject* GetReflectObject() const { return reflectObject; }
const PropertyDescriptor* GetDefaultPropertyDescriptor() const { return &defaultPropertyDescriptor; }
DynamicObject* GetMissingPropertyHolder() const { return missingPropertyHolder; }
JavascriptFunction* GetSharedArrayBufferConstructor() { return sharedArrayBufferConstructor; }
DynamicObject* GetAtomicsObject() { return atomicsObject; }
DynamicObject* GetWebAssemblyCompileErrorPrototype() const { return webAssemblyCompileErrorPrototype; }
DynamicObject* GetWebAssemblyCompileErrorConstructor() const { return webAssemblyCompileErrorConstructor; }
DynamicObject* GetWebAssemblyRuntimeErrorPrototype() const { return webAssemblyRuntimeErrorPrototype; }
DynamicObject* GetWebAssemblyRuntimeErrorConstructor() const { return webAssemblyRuntimeErrorConstructor; }
DynamicObject* GetWebAssemblyLinkErrorPrototype() const { return webAssemblyLinkErrorPrototype; }
DynamicObject* GetWebAssemblyLinkErrorConstructor() const { return webAssemblyLinkErrorConstructor; }
#if ENABLE_TTD
Js::PropertyId ExtractPrimitveSymbolId_TTD(Var value);
Js::RecyclableObject* CreatePrimitveSymbol_TTD(Js::PropertyId pid);
Js::RecyclableObject* CreatePrimitveSymbol_TTD(Js::JavascriptString* str);
Js::RecyclableObject* CreateDefaultBoxedObject_TTD(Js::TypeId kind);
void SetBoxedObjectValue_TTD(Js::RecyclableObject* obj, Js::Var value);
Js::RecyclableObject* CreateDate_TTD(double value);
Js::RecyclableObject* CreateRegex_TTD(const char16* patternSource, uint32 patternLength, UnifiedRegex::RegexFlags flags, CharCount lastIndex, Js::Var lastVar);
Js::RecyclableObject* CreateError_TTD();
Js::RecyclableObject* CreateES5Array_TTD();
static void SetLengthWritableES5Array_TTD(Js::RecyclableObject* es5Array, bool isLengthWritable);
Js::RecyclableObject* CreateSet_TTD();
Js::RecyclableObject* CreateWeakSet_TTD();
static void AddSetElementInflate_TTD(Js::JavascriptSet* set, Var value);
static void AddWeakSetElementInflate_TTD(Js::JavascriptWeakSet* set, Var value);
Js::RecyclableObject* CreateMap_TTD();
Js::RecyclableObject* CreateWeakMap_TTD();
static void AddMapElementInflate_TTD(Js::JavascriptMap* map, Var key, Var value);
static void AddWeakMapElementInflate_TTD(Js::JavascriptWeakMap* map, Var key, Var value);
Js::RecyclableObject* CreateExternalFunction_TTD(Js::Var fname);
Js::RecyclableObject* CreateBoundFunction_TTD(RecyclableObject* function, Var bThis, uint32 ct, Var* args);
Js::RecyclableObject* CreateProxy_TTD(RecyclableObject* handler, RecyclableObject* target);
Js::RecyclableObject* CreateRevokeFunction_TTD(RecyclableObject* proxy);
Js::RecyclableObject* CreateHeapArguments_TTD(uint32 numOfArguments, uint32 formalCount, ActivationObject* frameObject, byte* deletedArray);
Js::RecyclableObject* CreateES5HeapArguments_TTD(uint32 numOfArguments, uint32 formalCount, ActivationObject* frameObject, byte* deletedArray);
Js::JavascriptPromiseCapability* CreatePromiseCapability_TTD(Var promise, Var resolve, Var reject);
Js::JavascriptPromiseReaction* CreatePromiseReaction_TTD(RecyclableObject* handler, JavascriptPromiseCapability* capabilities);
Js::RecyclableObject* CreatePromise_TTD(uint32 status, Var result, JsUtil::List<Js::JavascriptPromiseReaction*, HeapAllocator>& resolveReactions, JsUtil::List<Js::JavascriptPromiseReaction*, HeapAllocator>& rejectReactions);
JavascriptPromiseResolveOrRejectFunctionAlreadyResolvedWrapper* CreateAlreadyDefinedWrapper_TTD(bool alreadyDefined);
Js::RecyclableObject* CreatePromiseResolveOrRejectFunction_TTD(RecyclableObject* promise, bool isReject, JavascriptPromiseResolveOrRejectFunctionAlreadyResolvedWrapper* alreadyResolved);
Js::RecyclableObject* CreatePromiseReactionTaskFunction_TTD(JavascriptPromiseReaction* reaction, Var argument);
Js::JavascriptPromiseAllResolveElementFunctionRemainingElementsWrapper* CreateRemainingElementsWrapper_TTD(Js::ScriptContext* ctx, uint32 value);
Js::RecyclableObject* CreatePromiseAllResolveElementFunction_TTD(Js::JavascriptPromiseCapability* capabilities, uint32 index, Js::JavascriptPromiseAllResolveElementFunctionRemainingElementsWrapper* wrapper, Js::RecyclableObject* values, bool alreadyCalled);
#endif
#ifdef ENABLE_INTL_OBJECT
void ResetIntlObject();
void EnsureIntlObjectReady();
template <class Fn>
void InitializeIntlForPrototypes(Fn fn);
void InitializeIntlForStringPrototype();
void InitializeIntlForDatePrototype();
void InitializeIntlForNumberPrototype();
#endif
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
DynamicType * GetDebugDisposableObjectType() { return debugDisposableObjectType; }
DynamicType * GetDebugFuncExecutorInDisposeObjectType() { return debugFuncExecutorInDisposeObjectType; }
#endif
DynamicType* GetErrorType(ErrorTypeEnum typeToCreate) const;
StaticType * GetBooleanTypeStatic() const { return booleanTypeStatic; }
DynamicType * GetBooleanTypeDynamic() const { return booleanTypeDynamic; }
DynamicType * GetDateType() const { return dateType; }
DynamicType * GetBoundFunctionType() const { return boundFunctionType; }
DynamicType * GetRegExpConstructorType() const { return regexConstructorType; }
StaticType * GetEnumeratorType() const { return enumeratorType; }
DynamicType * GetSpreadArgumentType() const { return SpreadArgumentType; }
StaticType * GetWithType() const { return withType; }
DynamicType * GetErrorType() const { return errorType; }
DynamicType * GetEvalErrorType() const { return evalErrorType; }
DynamicType * GetRangeErrorType() const { return rangeErrorType; }
DynamicType * GetReferenceErrorType() const { return referenceErrorType; }
DynamicType * GetSyntaxErrorType() const { return syntaxErrorType; }
DynamicType * GetTypeErrorType() const { return typeErrorType; }
DynamicType * GetURIErrorType() const { return uriErrorType; }
DynamicType * GetWebAssemblyCompileErrorType() const { return webAssemblyCompileErrorType; }
DynamicType * GetWebAssemblyRuntimeErrorType() const { return webAssemblyRuntimeErrorType; }
DynamicType * GetWebAssemblyLinkErrorType() const { return webAssemblyLinkErrorType; }
StaticType * GetNumberTypeStatic() const { return numberTypeStatic; }
StaticType * GetInt64TypeStatic() const { return int64NumberTypeStatic; }
StaticType * GetUInt64TypeStatic() const { return uint64NumberTypeStatic; }
DynamicType * GetNumberTypeDynamic() const { return numberTypeDynamic; }
DynamicType * GetPromiseType() const { return promiseType; }
DynamicType * GetWebAssemblyModuleType() const { return webAssemblyModuleType; }
DynamicType * GetWebAssemblyInstanceType() const { return webAssemblyInstanceType; }
DynamicType * GetWebAssemblyMemoryType() const { return webAssemblyMemoryType; }
DynamicType * GetWebAssemblyTableType() const { return webAssemblyTableType; }
#ifdef ENABLE_WASM
JavascriptFunction* GetWebAssemblyQueryResponseFunction() const { return webAssemblyQueryResponseFunction; }
JavascriptFunction* GetWebAssemblyCompileFunction() const { return webAssemblyCompileFunction; }
JavascriptFunction* GetWebAssemblyInstantiateBoundFunction() const { return webAssemblyInstantiateBoundFunction; }
#endif
// SIMD_JS
DynamicType * GetSIMDBool8x16TypeDynamic() const { return simdBool8x16TypeDynamic; }
DynamicType * GetSIMDBool16x8TypeDynamic() const { return simdBool16x8TypeDynamic; }
DynamicType * GetSIMDBool32x4TypeDynamic() const { return simdBool32x4TypeDynamic; }
DynamicType * GetSIMDInt8x16TypeDynamic() const { return simdInt8x16TypeDynamic; }
DynamicType * GetSIMDInt16x8TypeDynamic() const { return simdInt16x8TypeDynamic; }
DynamicType * GetSIMDInt32x4TypeDynamic() const { return simdInt32x4TypeDynamic; }
DynamicType * GetSIMDUint8x16TypeDynamic() const { return simdUint8x16TypeDynamic; }
DynamicType * GetSIMDUint16x8TypeDynamic() const { return simdUint16x8TypeDynamic; }
DynamicType * GetSIMDUint32x4TypeDynamic() const { return simdUint32x4TypeDynamic; }
DynamicType * GetSIMDFloat32x4TypeDynamic() const { return simdFloat32x4TypeDynamic; }
StaticType* GetSIMDFloat32x4TypeStatic() const { return simdFloat32x4TypeStatic; }
StaticType* GetSIMDFloat64x2TypeStatic() const { return simdFloat64x2TypeStatic; }
StaticType* GetSIMDInt32x4TypeStatic() const { return simdInt32x4TypeStatic; }
StaticType* GetSIMDInt16x8TypeStatic() const { return simdInt16x8TypeStatic; }
StaticType* GetSIMDInt8x16TypeStatic() const { return simdInt8x16TypeStatic; }
StaticType* GetSIMDBool32x4TypeStatic() const { return simdBool32x4TypeStatic; }
StaticType* GetSIMDBool16x8TypeStatic() const { return simdBool16x8TypeStatic; }
StaticType* GetSIMDBool8x16TypeStatic() const { return simdBool8x16TypeStatic; }
StaticType* GetSIMDUInt32x4TypeStatic() const { return simdUint32x4TypeStatic; }
StaticType* GetSIMDUint16x8TypeStatic() const { return simdUint16x8TypeStatic; }
StaticType* GetSIMDUint8x16TypeStatic() const { return simdUint8x16TypeStatic; }
DynamicType * GetObjectLiteralType(uint16 requestedInlineSlotCapacity);
DynamicType * GetObjectHeaderInlinedLiteralType(uint16 requestedInlineSlotCapacity);
DynamicType * GetObjectType() const { return objectTypes[0]; }
DynamicType * GetObjectHeaderInlinedType() const { return objectHeaderInlinedTypes[0]; }
StaticType * GetSymbolTypeStatic() const { return symbolTypeStatic; }
DynamicType * GetSymbolTypeDynamic() const { return symbolTypeDynamic; }
DynamicType * GetProxyType() const { return proxyType; }
DynamicType * GetHeapArgumentsObjectType() const { return heapArgumentsType; }
DynamicType * GetActivationObjectType() const { return activationObjectType; }
DynamicType * GetModuleNamespaceType() const { return moduleNamespaceType; }
DynamicType * GetArrayType() const { return arrayType; }
DynamicType * GetNativeIntArrayType() const { return nativeIntArrayType; }
#if ENABLE_COPYONACCESS_ARRAY
DynamicType * GetCopyOnAccessNativeIntArrayType() const { return copyOnAccessNativeIntArrayType; }
#endif
DynamicType * GetNativeFloatArrayType() const { return nativeFloatArrayType; }
DynamicType * GetRegexPrototypeType() const { return regexPrototypeType; }
DynamicType * GetRegexType() const { return regexType; }
DynamicType * GetRegexResultType() const { return regexResultType; }
DynamicType * GetArrayBufferType() const { return arrayBufferType; }
StaticType * GetStringTypeStatic() const { AssertMsg(stringTypeStatic, "Where's stringTypeStatic?"); return stringTypeStatic; }
DynamicType * GetStringTypeDynamic() const { return stringTypeDynamic; }
StaticType * GetVariantDateType() const { return variantDateType; }
void EnsureDebugObject(DynamicObject* newDebugObject);
DynamicObject* GetDebugObject() const { Assert(debugObject != nullptr); return debugObject; }
DynamicType * GetMapType() const { return mapType; }
DynamicType * GetSetType() const { return setType; }
DynamicType * GetWeakMapType() const { return weakMapType; }
DynamicType * GetWeakSetType() const { return weakSetType; }
DynamicType * GetArrayIteratorType() const { return arrayIteratorType; }
DynamicType * GetMapIteratorType() const { return mapIteratorType; }
DynamicType * GetSetIteratorType() const { return setIteratorType; }
DynamicType * GetStringIteratorType() const { return stringIteratorType; }
DynamicType * GetListIteratorType() const { return listIteratorType; }
JavascriptFunction* GetDefaultAccessorFunction() const { return defaultAccessorFunction; }
JavascriptFunction* GetStackTraceAccessorFunction() const { return stackTraceAccessorFunction; }
JavascriptFunction* GetThrowTypeErrorRestrictedPropertyAccessorFunction() const { return throwTypeErrorRestrictedPropertyAccessorFunction; }
JavascriptFunction* Get__proto__getterFunction() const { return __proto__getterFunction; }
JavascriptFunction* Get__proto__setterFunction() const { return __proto__setterFunction; }
JavascriptFunction* GetObjectValueOfFunction() const { return objectValueOfFunction; }
JavascriptFunction* GetObjectToStringFunction() const { return objectToStringFunction; }
// SIMD_JS
JavascriptFunction* GetSIMDFloat32x4ToStringFunction() const { return simdFloat32x4ToStringFunction; }
JavascriptFunction* GetSIMDFloat64x2ToStringFunction() const { return simdFloat64x2ToStringFunction; }
JavascriptFunction* GetSIMDInt32x4ToStringFunction() const { return simdInt32x4ToStringFunction; }
JavascriptFunction* GetSIMDInt16x8ToStringFunction() const { return simdInt16x8ToStringFunction; }
JavascriptFunction* GetSIMDInt8x16ToStringFunction() const { return simdInt8x16ToStringFunction; }
JavascriptFunction* GetSIMDBool32x4ToStringFunction() const { return simdBool32x4ToStringFunction; }
JavascriptFunction* GetSIMDBool16x8ToStringFunction() const { return simdBool16x8ToStringFunction; }
JavascriptFunction* GetSIMDBool8x16ToStringFunction() const { return simdBool8x16ToStringFunction; }
JavascriptFunction* GetSIMDUint32x4ToStringFunction() const { return simdUint32x4ToStringFunction; }
JavascriptFunction* GetSIMDUint16x8ToStringFunction() const { return simdUint16x8ToStringFunction; }
JavascriptFunction* GetSIMDUint8x16ToStringFunction() const { return simdUint8x16ToStringFunction; }
JavascriptFunction* GetDebugObjectNonUserGetterFunction() const { return debugObjectNonUserGetterFunction; }
JavascriptFunction* GetDebugObjectNonUserSetterFunction() const { return debugObjectNonUserSetterFunction; }
UnifiedRegex::RegexPattern * GetEmptyRegexPattern() const { return emptyRegexPattern; }
JavascriptFunction* GetRegexExecFunction() const { return regexExecFunction; }
JavascriptFunction* GetRegexFlagsGetterFunction() const { return regexFlagsGetterFunction; }
JavascriptFunction* GetRegexGlobalGetterFunction() const { return regexGlobalGetterFunction; }
JavascriptFunction* GetRegexStickyGetterFunction() const { return regexStickyGetterFunction; }
JavascriptFunction* GetRegexUnicodeGetterFunction() const { return regexUnicodeGetterFunction; }
int GetRegexConstructorSlotIndex() const { return regexConstructorSlotIndex; }
int GetRegexExecSlotIndex() const { return regexExecSlotIndex; }
int GetRegexFlagsGetterSlotIndex() const { return regexFlagsGetterSlotIndex; }
int GetRegexGlobalGetterSlotIndex() const { return regexGlobalGetterSlotIndex; }
int GetRegexStickyGetterSlotIndex() const { return regexStickyGetterSlotIndex; }
int GetRegexUnicodeGetterSlotIndex() const { return regexUnicodeGetterSlotIndex; }
TypePath* GetRootPath() const { return rootPath; }
void BindReference(void * addr);
void CleanupForClose();
void BeginDynamicFunctionReferences();
void EndDynamicFunctionReferences();
void RegisterDynamicFunctionReference(FunctionProxy* func);
void SetDebugObjectNonUserAccessor(FunctionInfo *funcGetter, FunctionInfo *funcSetter);
JavascriptFunction* GetDebugObjectDebugModeGetterFunction() const { return debugObjectDebugModeGetterFunction; }
void SetDebugObjectDebugModeAccessor(FunctionInfo *funcGetter);
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
JavascriptFunction* GetDebugObjectFaultInjectionCookieGetterFunction() const { return debugObjectFaultInjectionCookieGetterFunction; }
JavascriptFunction* GetDebugObjectFaultInjectionCookieSetterFunction() const { return debugObjectFaultInjectionCookieSetterFunction; }
void SetDebugObjectFaultInjectionCookieGetterAccessor(FunctionInfo *funcGetter, FunctionInfo *funcSetter);
#endif
JavascriptFunction* GetArrayPrototypeToStringFunction() const { return arrayPrototypeToStringFunction; }
JavascriptFunction* GetArrayPrototypeToLocaleStringFunction() const { return arrayPrototypeToLocaleStringFunction; }
JavascriptFunction* GetIdentityFunction() const { return identityFunction; }
JavascriptFunction* GetThrowerFunction() const { return throwerFunction; }
void SetNativeHostPromiseContinuationFunction(PromiseContinuationCallback function, void *state);
void SetJsrtContext(FinalizableObject* jsrtContext);
FinalizableObject* GetJsrtContext();
void EnqueueTask(Var taskVar);
HeapArgumentsObject* CreateHeapArguments(Var frameObj, uint formalCount, bool isStrictMode = false);
JavascriptArray* CreateArray();
JavascriptArray* CreateArray(uint32 length);
JavascriptArray *CreateArrayOnStack(void *const stackAllocationPointer);
JavascriptNativeIntArray* CreateNativeIntArray();
JavascriptNativeIntArray* CreateNativeIntArray(uint32 length);
#if ENABLE_COPYONACCESS_ARRAY
JavascriptCopyOnAccessNativeIntArray* CreateCopyOnAccessNativeIntArray();
JavascriptCopyOnAccessNativeIntArray* CreateCopyOnAccessNativeIntArray(uint32 length);
#endif
JavascriptNativeFloatArray* CreateNativeFloatArray();
JavascriptNativeFloatArray* CreateNativeFloatArray(uint32 length);
JavascriptArray* CreateArray(uint32 length, uint32 size);
ArrayBuffer* CreateArrayBuffer(uint32 length);
ArrayBuffer* CreateArrayBuffer(byte* buffer, uint32 length);
class WebAssemblyArrayBuffer* CreateWebAssemblyArrayBuffer(uint32 length);
class WebAssemblyArrayBuffer* CreateWebAssemblyArrayBuffer(byte* buffer, uint32 length);
SharedArrayBuffer* CreateSharedArrayBuffer(uint32 length);
SharedArrayBuffer* CreateSharedArrayBuffer(SharedContents *contents);
ArrayBuffer* CreateProjectionArraybuffer(uint32 length);
ArrayBuffer* CreateProjectionArraybuffer(byte* buffer, uint32 length);
DataView* CreateDataView(ArrayBufferBase* arrayBuffer, uint32 offSet, uint32 mappedLength);
template <typename TypeName, bool clamped>
inline DynamicType* GetTypedArrayType(TypeName);
template<> inline DynamicType* GetTypedArrayType<int8,false>(int8) { return int8ArrayType; };
template<> inline DynamicType* GetTypedArrayType<uint8,false>(uint8) { return uint8ArrayType; };
template<> inline DynamicType* GetTypedArrayType<uint8,true>(uint8) { return uint8ClampedArrayType; };
template<> inline DynamicType* GetTypedArrayType<int16,false>(int16) { return int16ArrayType; };
template<> inline DynamicType* GetTypedArrayType<uint16,false>(uint16) { return uint16ArrayType; };
template<> inline DynamicType* GetTypedArrayType<int32,false>(int32) { return int32ArrayType; };
template<> inline DynamicType* GetTypedArrayType<uint32,false>(uint32) { return uint32ArrayType; };
template<> inline DynamicType* GetTypedArrayType<float,false>(float) { return float32ArrayType; };
template<> inline DynamicType* GetTypedArrayType<double,false>(double) { return float64ArrayType; };
template<> inline DynamicType* GetTypedArrayType<int64,false>(int64) { return int64ArrayType; };
template<> inline DynamicType* GetTypedArrayType<uint64,false>(uint64) { return uint64ArrayType; };
template<> inline DynamicType* GetTypedArrayType<bool,false>(bool) { return boolArrayType; };
DynamicType* GetCharArrayType() { return charArrayType; };
//
// This method would be used for creating array literals, when we really need to create a huge array
// Avoids checks at runtime.
//
JavascriptArray* CreateArrayLiteral(uint32 length);
JavascriptNativeIntArray* CreateNativeIntArrayLiteral(uint32 length);
#if ENABLE_PROFILE_INFO
JavascriptNativeIntArray* CreateCopyOnAccessNativeIntArrayLiteral(ArrayCallSiteInfo *arrayInfo, FunctionBody *functionBody, const Js::AuxArray<int32> *ints);
#endif
JavascriptNativeFloatArray* CreateNativeFloatArrayLiteral(uint32 length);
JavascriptBoolean* CreateBoolean(BOOL value);
JavascriptDate* CreateDate();
JavascriptDate* CreateDate(double value);
JavascriptDate* CreateDate(SYSTEMTIME* pst);
JavascriptMap* CreateMap();
JavascriptSet* CreateSet();
JavascriptWeakMap* CreateWeakMap();
JavascriptWeakSet* CreateWeakSet();
JavascriptError* CreateError();