Promote enableNoAliasOptimizations to stable (remove flag)
Per title, this feature flag is enabled everywhere and is stable enough, let's promote to stable and remove the flag to simplify.
Joe Savona committed
Oct 5, 2023 at 09:20 UTC
3fdb237682513d27a2131663f58cf4a6e3c82305
2 files changed
+12
-22
compiler/packages/babel-plugin-react-forget/src/HIR/Environment.ts
-10
@@ -140,15 +140,6 @@ export type EnvironmentConfig = {
140
*/
141
inlineUseMemo: boolean;
142
143
- /**
144
- * Enable optimizations based on the `noAlias` flag of method signatures. When enabled,
145
- * function signatures can declare that they do not alias their arguments, allowing
146
- * Forget to (in some cases) avoid memoizing arguments if they do not otherwise escape.
147
- *
148
- * Defaults to false
149
- */
150
- enableNoAliasOptimizations: boolean;
151
-
143
/**
144
* When enabled, the compiler assumes that hooks follow the Rules of React:
145
* - Hooks may memoize computation based on any of their parameters, thus
@@ -235,7 +226,6 @@ const DEFAULT_ENVIRONMENT_CONFIG: Readonly<EnvironmentConfig> = {
226
memoizeJsxElements: true,
227
inlineUseMemo: true,
228
validateHooksUsage: true,
238
- enableNoAliasOptimizations: true,
229
230
assertValidMutableRanges: false,
231
bailoutOnHoleyArrays: false,
compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/PruneNonEscapingScopes.ts
+12
-12
@@ -611,9 +611,10 @@ function computeMemoizationInputs(
611
};
612
}
613
case "CallExpression": {
614
- const signature = env.config.enableNoAliasOptimizations
615
- ? getFunctionCallSignature(env, value.callee.identifier.type)
616
- : null;
614
+ const signature = getFunctionCallSignature(
615
+ env,
616
+ value.callee.identifier.type
617
+ );
618
const operands = [...eachReactiveValueOperand(value)];
619
let lvalues = [];
620
if (lvalue !== null) {
@@ -636,9 +637,10 @@ function computeMemoizationInputs(
637
};
638
}
639
case "MethodCall": {
639
- const signature = env.config.enableNoAliasOptimizations
640
- ? getFunctionCallSignature(env, value.property.identifier.type)
641
- : null;
640
+ const signature = getFunctionCallSignature(
641
+ env,
642
+ value.property.identifier.type
643
+ );
644
const operands = [...eachReactiveValueOperand(value)];
645
let lvalues = [];
646
if (lvalue !== null) {
@@ -808,12 +810,10 @@ class CollectDependenciesVisitor extends ReactiveFunctionVisitor<State> {
810
} else if (instruction.value.kind === "CallExpression") {
811
const callee = instruction.value.callee;
812
if (getHookKind(state.env, callee.identifier) != null) {
811
- const signature = this.env.config.enableNoAliasOptimizations
812
- ? getFunctionCallSignature(
813
- this.env,
814
- instruction.value.callee.identifier.type
815
- )
816
- : null;
813
+ const signature = getFunctionCallSignature(
814
+ this.env,
815
+ instruction.value.callee.identifier.type
816
+ );
817
// Hook values are assumed to escape by default since they can be inputs
818
// to reactive scopes in the hook. However if the hook is annotated as
819
// noAlias we know that the arguments cannot escape and don't need to