From 1948008a8c7ceca1ca278e76bdca72eebba0dae7 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 12 Feb 2024 13:29:27 -0800 Subject: Precompute: Optimize array.len (#6299) Arrays have immutable length, so we can optimize them like immutable fields. --- src/passes/Precompute.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index 5baf2331f..d2f3543ad 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -178,7 +178,7 @@ public: // Otherwise, we've failed to precompute. return Flow(NONCONSTANT_FLOW); } - Flow visitArrayLen(ArrayLen* curr) { return Flow(NONCONSTANT_FLOW); } + // ArrayLen is not disallowed here as it is an immutable property. Flow visitArrayCopy(ArrayCopy* curr) { return Flow(NONCONSTANT_FLOW); } // Generates heap info for a heap-allocating expression. -- cgit v1.2.3