@@ -20,12 +20,6 @@ type JsOnlyFeatureFlags = (typeof ReactNativeFeatureFlags)['jsOnly'];
20
20
21
21
type DocblockPragmas = { [ key : string ] : string | string [ ] } ;
22
22
23
- export enum FantomTestConfigMode {
24
- DevelopmentWithBytecode ,
25
- DevelopmentWithSource ,
26
- Optimized ,
27
- }
28
-
29
23
export type FantomTestConfigCommonFeatureFlags = Partial < {
30
24
[ key in keyof CommonFeatureFlags ] : CommonFeatureFlags [ key ] [ 'defaultValue' ] ,
31
25
} > ;
@@ -45,22 +39,27 @@ export type FantomTestConfigFeatureFlags = {
45
39
} ;
46
40
47
41
export type FantomTestConfig = {
48
- mode : FantomTestConfigMode ,
42
+ isNativeOptimized : boolean ,
43
+ isJsOptimized : boolean ,
44
+ isJsBytecode : boolean ,
49
45
hermesVariant : HermesVariant ,
50
46
flags : FantomTestConfigFeatureFlags ,
51
47
} ;
52
48
53
49
export type PartialFantomTestConfig = {
54
- mode ?: FantomTestConfigMode ,
50
+ isNativeOptimized ?: boolean ,
51
+ isJsOptimized ?: boolean ,
52
+ isJsBytecode ?: boolean ,
55
53
hermesVariant ?: HermesVariant ,
56
54
flags ?: Partial < FantomTestConfigFeatureFlags > ,
57
55
} ;
58
56
59
57
export const FantomTestConfigHermesVariant = HermesVariant ;
60
58
61
- export const DEFAULT_MODE : FantomTestConfigMode =
62
- FantomTestConfigMode . DevelopmentWithSource ;
63
-
59
+ export const DEFAULT_IS_OPTIMIZED : boolean = false ;
60
+ export const DEFAULT_IS_NATIVE_OPTIMIZED : boolean = false ;
61
+ export const DEFAULT_IS_JS_OPTIMIZED : boolean = false ;
62
+ export const DEFAULT_IS_JS_BYTECODE : boolean = false ;
64
63
export const DEFAULT_HERMES_VARIANT : HermesVariant = HermesVariant . Hermes ;
65
64
66
65
export const DEFAULT_FEATURE_FLAGS : FantomTestConfigFeatureFlags = {
@@ -77,9 +76,6 @@ const FANTOM_BENCHMARK_FILENAME_RE = /[Bb]enchmark-itest\./g;
77
76
const FANTOM_BENCHMARK_SUITE_RE =
78
77
/ \n ( F a n t o m \. ) ? u n s t a b l e _ b e n c h m a r k ( \s * ) \. s u i t e \( / g;
79
78
80
- const FANTOM_BENCHMARK_DEFAULT_MODE : FantomTestConfigMode =
81
- FantomTestConfigMode . Optimized ;
82
-
83
79
const MAX_FANTOM_CONFIGURATION_VARIATIONS = 12 ;
84
80
85
81
const VALID_FANTOM_PRAGMAS = [
@@ -94,8 +90,16 @@ export function getOverrides(
94
90
) : PartialFantomTestConfig {
95
91
const overrides : PartialFantomTestConfig = { } ;
96
92
97
- if ( config . mode !== DEFAULT_MODE ) {
98
- overrides . mode = config . mode ;
93
+ if ( config . isNativeOptimized !== DEFAULT_IS_NATIVE_OPTIMIZED ) {
94
+ overrides . isNativeOptimized = config . isNativeOptimized ;
95
+ }
96
+
97
+ if ( config . isJsOptimized !== DEFAULT_IS_JS_OPTIMIZED ) {
98
+ overrides . isJsOptimized = config . isJsOptimized ;
99
+ }
100
+
101
+ if ( config . isJsBytecode !== DEFAULT_IS_JS_BYTECODE ) {
102
+ overrides . isJsBytecode = config . isJsBytecode ;
99
103
}
100
104
101
105
if ( config . hermesVariant !== DEFAULT_HERMES_VARIANT ) {
@@ -140,7 +144,7 @@ export function getOverrides(
140
144
*
141
145
* The supported options are:
142
146
* - `fantom_mode`: specifies the level of optimization to compile the test
143
- * with. Valid values are `dev`, `dev-bytecode` and `opt`.
147
+ * with. Valid values are `dev` and `opt`.
144
148
* - `fantom_hermes_variant`: specifies the Hermes variant to use to run the
145
149
* test. Valid values are `hermes`, `static_hermes_stable` and
146
150
* `static_hermes_experimental`.
@@ -162,7 +166,9 @@ export default function getFantomTestConfigs(
162
166
verifyFantomPragmas ( pragmas ) ;
163
167
164
168
const config : FantomTestConfig = {
165
- mode : DEFAULT_MODE ,
169
+ isNativeOptimized : DEFAULT_IS_NATIVE_OPTIMIZED ,
170
+ isJsOptimized : DEFAULT_IS_JS_OPTIMIZED ,
171
+ isJsBytecode : DEFAULT_IS_JS_BYTECODE ,
166
172
hermesVariant : DEFAULT_HERMES_VARIANT ,
167
173
flags : {
168
174
common : {
@@ -190,19 +196,27 @@ export default function getFantomTestConfigs(
190
196
191
197
switch ( mode ) {
192
198
case 'dev' :
193
- config . mode = FantomTestConfigMode . DevelopmentWithSource ;
194
- break ;
195
- case 'dev-bytecode' :
196
- config . mode = FantomTestConfigMode . DevelopmentWithBytecode ;
199
+ config . isNativeOptimized = false ;
200
+ config . isJsOptimized = false ;
201
+ config . isJsBytecode = false ;
197
202
break ;
198
203
case 'opt' :
199
- config . mode = FantomTestConfigMode . Optimized ;
204
+ config . isNativeOptimized = true ;
205
+ config . isJsOptimized = true ;
206
+ config . isJsBytecode = true ;
200
207
break ;
201
208
case '*' :
202
209
configVariations . push ( [
203
- { mode : FantomTestConfigMode . DevelopmentWithSource } ,
204
- { mode : FantomTestConfigMode . DevelopmentWithBytecode } ,
205
- { mode : FantomTestConfigMode . Optimized } ,
210
+ {
211
+ isNativeOptimized : false ,
212
+ isJsOptimized : false ,
213
+ isJsBytecode : false ,
214
+ } ,
215
+ {
216
+ isNativeOptimized : true ,
217
+ isJsOptimized : true ,
218
+ isJsBytecode : true ,
219
+ } ,
206
220
] ) ;
207
221
break ;
208
222
default :
@@ -213,7 +227,9 @@ export default function getFantomTestConfigs(
213
227
FANTOM_BENCHMARK_FILENAME_RE . test ( testPath ) ||
214
228
FANTOM_BENCHMARK_SUITE_RE . test ( testContents )
215
229
) {
216
- config . mode = FANTOM_BENCHMARK_DEFAULT_MODE ;
230
+ config . isNativeOptimized = true ;
231
+ config . isJsOptimized = true ;
232
+ config . isJsBytecode = true ;
217
233
}
218
234
}
219
235
@@ -373,7 +389,11 @@ function getConfigurationVariations(
373
389
374
390
for (const currentConfigVariation of currentConfigVariations) {
375
391
const currentConfigWithVariation = {
376
- mode : currentConfigVariation . mode ?? config . mode ,
392
+ isNativeOptimized :
393
+ currentConfigVariation . isNativeOptimized ?? config . isNativeOptimized ,
394
+ isJsOptimized :
395
+ currentConfigVariation . isJsOptimized ?? config . isJsOptimized ,
396
+ isJsBytecode : currentConfigVariation . isJsBytecode ?? config . isJsBytecode ,
377
397
hermesVariant :
378
398
currentConfigVariation . hermesVariant ?? config . hermesVariant ,
379
399
flags : {
0 commit comments