From 11d03ffbe08e0366dddf04c49668ca6da72b089d Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Thu, 5 Oct 2023 09:20:09 -0700 Subject: [PATCH] Promote enableFunctionCallSignatureOptimizations to stable (remove flag) Per title, this feature flag is enabled everywhere and is clearly stable, let's promote to stable and remove the flag to simplify. --- compiler/apps/playground/components/Editor/index.tsx | 5 ----- .../babel-plugin-react-forget/src/HIR/Environment.ts | 8 -------- .../src/Inference/InferReferenceEffects.ts | 7 +------ .../src/ReactiveScopes/InferReactiveScopeVariables.ts | 5 +---- 4 files changed, 2 insertions(+), 23 deletions(-) diff --git a/compiler/apps/playground/components/Editor/index.tsx b/compiler/apps/playground/components/Editor/index.tsx index 57a5b3334e..341deeeb7e 100644 --- a/compiler/apps/playground/components/Editor/index.tsx +++ b/compiler/apps/playground/components/Editor/index.tsx @@ -116,7 +116,6 @@ function parsePragma(pragma: string) { let enableEmitFreeze = null; let inlineUseMemo = true; let validateHooksUsage = true; - let enableFunctionCallSignatureOptimizations = true; let validateFrozenLambdas = true; let assertValidMutableRanges = true; @@ -141,9 +140,6 @@ function parsePragma(pragma: string) { if (pragma.includes("@inlineUseMemo false")) { inlineUseMemo = false; } - if (pragma.includes("@enableFunctionCallSignatureOptimizations false")) { - enableFunctionCallSignatureOptimizations = false; - } if (pragma.includes("@validateHooksUsage false")) { validateHooksUsage = false; } @@ -156,7 +152,6 @@ function parsePragma(pragma: string) { return { enableAssumeHooksFollowRulesOfReact, - enableFunctionCallSignatureOptimizations, disableAllMemoization, inlineUseMemo, memoizeJsxElements, diff --git a/compiler/packages/babel-plugin-react-forget/src/HIR/Environment.ts b/compiler/packages/babel-plugin-react-forget/src/HIR/Environment.ts index 8b514e76a0..c675872400 100644 --- a/compiler/packages/babel-plugin-react-forget/src/HIR/Environment.ts +++ b/compiler/packages/babel-plugin-react-forget/src/HIR/Environment.ts @@ -140,13 +140,6 @@ export type EnvironmentConfig = { */ inlineUseMemo: boolean; - /** - * Enable optimizations based on the signature of (non-method) built-in function calls. - * - * Defaults to false - */ - enableFunctionCallSignatureOptimizations: 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 @@ -240,7 +233,6 @@ const DEFAULT_ENVIRONMENT_CONFIG: Readonly = { customHooks: null, memoizeJsxElements: true, - enableFunctionCallSignatureOptimizations: true, inlineUseMemo: true, validateHooksUsage: true, enableNoAliasOptimizations: true, diff --git a/compiler/packages/babel-plugin-react-forget/src/Inference/InferReferenceEffects.ts b/compiler/packages/babel-plugin-react-forget/src/Inference/InferReferenceEffects.ts index 98d407521d..ccf080b434 100644 --- a/compiler/packages/babel-plugin-react-forget/src/Inference/InferReferenceEffects.ts +++ b/compiler/packages/babel-plugin-react-forget/src/Inference/InferReferenceEffects.ts @@ -742,15 +742,10 @@ function inferBlock( continue; } case "CallExpression": { - let signature = getFunctionCallSignature( + const signature = getFunctionCallSignature( env, instrValue.callee.identifier.type ); - signature = - env.config.enableFunctionCallSignatureOptimizations || - signature?.hookKind != null - ? signature - : null; const effects = signature !== null ? getFunctionEffects(instrValue, signature) : null; diff --git a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts index 62c87c4f65..ec7a031504 100644 --- a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts +++ b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts @@ -250,10 +250,7 @@ function mayAllocate(env: Environment, instruction: Instruction): boolean { } case "CallExpression": case "MethodCall": { - if (env.config.enableFunctionCallSignatureOptimizations) { - return instruction.lvalue.identifier.type.kind !== "Primitive"; - } - return true; + return instruction.lvalue.identifier.type.kind !== "Primitive"; } case "RegExpLiteral": case "PropertyStore":