- Notifications
You must be signed in to change notification settings - Fork 670
/
Copy pathfeature.ts
62 lines (60 loc) · 2.8 KB
/
feature.ts
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
// This file is shared with the compiler and must remain portable
/** Indicates specific features to activate. */
exportconstenumFeature{
/** No additional features. */
None=0,
/** Sign extension operations. */
SignExtension=1<<0,// see: https://github.com/WebAssembly/sign-extension-ops
/** Mutable global imports and exports. */
MutableGlobals=1<<1,// see: https://github.com/WebAssembly/mutable-global
/** Non-trapping float to integer operations. */
NontrappingF2I=1<<2,// see: https://github.com/WebAssembly/nontrapping-float-to-int-conversions
/** Bulk memory operations. */
BulkMemory=1<<3,// see: https://github.com/WebAssembly/bulk-memory-operations
/** SIMD types and operations. */
Simd=1<<4,// see: https://github.com/WebAssembly/simd
/** Threading and atomic operations. */
Threads=1<<5,// see: https://github.com/WebAssembly/threads
/** Exception handling operations. */
ExceptionHandling=1<<6,// see: https://github.com/WebAssembly/exception-handling
/** Tail call operations. */
TailCalls=1<<7,// see: https://github.com/WebAssembly/tail-call
/** Reference types. */
ReferenceTypes=1<<8,// see: https://github.com/WebAssembly/reference-types
/** Multi value types. */
MultiValue=1<<9,// see: https://github.com/WebAssembly/multi-value
/** Garbage collection. */
GC=1<<10,// see: https://github.com/WebAssembly/gc
/** Memory64. */
Memory64=1<<11,// see: https://github.com/WebAssembly/memory64
/** Relaxed SIMD. */
RelaxedSimd=1<<12,// see: https://github.com/WebAssembly/relaxed-simd
/** Extended const expressions. */
ExtendedConst=1<<13,// see: https://github.com/WebAssembly/extended-const
/** Reference typed strings. */
Stringref=1<<14,// see: https://github.com/WebAssembly/stringref
/** All features. */
All=(1<<15)-1
}
/** Gets the name of the specified feature one would specify on the command line. */
exportfunctionfeatureToString(feature: Feature): string{
switch(feature){
caseFeature.SignExtension: return"sign-extension";
caseFeature.MutableGlobals: return"mutable-globals";
caseFeature.NontrappingF2I: return"nontrapping-f2i";
caseFeature.BulkMemory: return"bulk-memory";
caseFeature.Simd: return"simd";
caseFeature.Threads: return"threads";
caseFeature.ExceptionHandling: return"exception-handling";
caseFeature.TailCalls: return"tail-calls";
caseFeature.ReferenceTypes: return"reference-types";
caseFeature.MultiValue: return"multi-value";
caseFeature.GC: return"gc";
caseFeature.Memory64: return"memory64";
caseFeature.RelaxedSimd: return"relaxed-simd";
caseFeature.ExtendedConst: return"extended-const";
caseFeature.Stringref: return"stringref";
}
assert(false);
return"";
}