mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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.
This commit is contained in:
@@ -140,15 +140,6 @@ export type EnvironmentConfig = {
|
||||
*/
|
||||
inlineUseMemo: boolean;
|
||||
|
||||
/**
|
||||
* Enable optimizations based on the `noAlias` flag of method signatures. When enabled,
|
||||
* function signatures can declare that they do not alias their arguments, allowing
|
||||
* Forget to (in some cases) avoid memoizing arguments if they do not otherwise escape.
|
||||
*
|
||||
* Defaults to false
|
||||
*/
|
||||
enableNoAliasOptimizations: boolean;
|
||||
|
||||
/**
|
||||
* When enabled, the compiler assumes that hooks follow the Rules of React:
|
||||
* - Hooks may memoize computation based on any of their parameters, thus
|
||||
@@ -235,7 +226,6 @@ const DEFAULT_ENVIRONMENT_CONFIG: Readonly<EnvironmentConfig> = {
|
||||
memoizeJsxElements: true,
|
||||
inlineUseMemo: true,
|
||||
validateHooksUsage: true,
|
||||
enableNoAliasOptimizations: true,
|
||||
|
||||
assertValidMutableRanges: false,
|
||||
bailoutOnHoleyArrays: false,
|
||||
|
||||
+12
-12
@@ -611,9 +611,10 @@ function computeMemoizationInputs(
|
||||
};
|
||||
}
|
||||
case "CallExpression": {
|
||||
const signature = env.config.enableNoAliasOptimizations
|
||||
? getFunctionCallSignature(env, value.callee.identifier.type)
|
||||
: null;
|
||||
const signature = getFunctionCallSignature(
|
||||
env,
|
||||
value.callee.identifier.type
|
||||
);
|
||||
const operands = [...eachReactiveValueOperand(value)];
|
||||
let lvalues = [];
|
||||
if (lvalue !== null) {
|
||||
@@ -636,9 +637,10 @@ function computeMemoizationInputs(
|
||||
};
|
||||
}
|
||||
case "MethodCall": {
|
||||
const signature = env.config.enableNoAliasOptimizations
|
||||
? getFunctionCallSignature(env, value.property.identifier.type)
|
||||
: null;
|
||||
const signature = getFunctionCallSignature(
|
||||
env,
|
||||
value.property.identifier.type
|
||||
);
|
||||
const operands = [...eachReactiveValueOperand(value)];
|
||||
let lvalues = [];
|
||||
if (lvalue !== null) {
|
||||
@@ -808,12 +810,10 @@ class CollectDependenciesVisitor extends ReactiveFunctionVisitor<State> {
|
||||
} else if (instruction.value.kind === "CallExpression") {
|
||||
const callee = instruction.value.callee;
|
||||
if (getHookKind(state.env, callee.identifier) != null) {
|
||||
const signature = this.env.config.enableNoAliasOptimizations
|
||||
? getFunctionCallSignature(
|
||||
this.env,
|
||||
instruction.value.callee.identifier.type
|
||||
)
|
||||
: null;
|
||||
const signature = getFunctionCallSignature(
|
||||
this.env,
|
||||
instruction.value.callee.identifier.type
|
||||
);
|
||||
// Hook values are assumed to escape by default since they can be inputs
|
||||
// to reactive scopes in the hook. However if the hook is annotated as
|
||||
// noAlias we know that the arguments cannot escape and don't need to
|
||||
|
||||
Reference in New Issue
Block a user