@@ -108,7 +108,7 @@ let rec block_size ~recurse ~env p { branch; body; _ } =
108
108
body
109
109
+
110
110
match branch with
111
- | Cond _ -> 2
111
+ | Cond _ | Raise _ -> 2
112
112
| Switch (_ , a1 ) -> Array. length a1
113
113
| _ -> 0
114
114
@@ -143,7 +143,7 @@ let count_init_code info =
143
143
List. fold_left
144
144
~f: (fun n i ->
145
145
match i with
146
- | Let (_ , (Closure _ | Field _ | Constant _ | Block _ )) -> n + 1
146
+ | Let (_ , (Closure _ | Field ( _ , _ , Non_float ) | Constant _ | Block _ )) -> n + 1
147
147
| _ -> n)
148
148
~init: 0
149
149
body)
@@ -246,19 +246,19 @@ let rec small_function ~live_vars ~env p ~enclosing_function info args =
246
246
and should_inline ~live_vars ~env p ~enclosing_function info args =
247
247
(* Don't inline function containing closures in JavaScript, except
248
248
in an enclosing scope, since this can results in memory leaks *)
249
- ( match Config. target () with
250
- | `Wasm -> true
251
- | `JavaScript -> (
252
- match enclosing_function with
253
- | Some f -> Var.Set. mem f info.scopes || closure_count info ~env p = 0
254
- | None -> true ))
255
- && ((live_vars.( Var. idx info.f) = 1 && body_size info ~env p < 150 )
256
- || functor_like ~env p info
257
- || (body_size info ~env p < = 1 && closure_count info ~env p = 0 )
258
- || small_function ~live_vars ~env p ~enclosing_function info args
259
- &&
260
- (* Avoid inlining loops at toplevel *)
261
- not (Option. is_none enclosing_function && contains_loop info p))
249
+ functor_like ~env p info
250
+ || ( match Config. target () with
251
+ | `Wasm -> true
252
+ | `JavaScript -> (
253
+ match enclosing_function with
254
+ | Some f -> Var.Set. mem f info.scopes || closure_count info ~env p = 0
255
+ | None -> true ) )
256
+ && ((live_vars.( Var. idx info.f) = 1 && body_size info ~env p < 100 )
257
+ || (body_size info ~env p < = 1 && closure_count info ~env p = 0 )
258
+ || small_function ~live_vars ~env p ~enclosing_function info args
259
+ &&
260
+ (* Avoid inlining loops at toplevel *)
261
+ not (Option. is_none enclosing_function && contains_loop info p))
262
262
263
263
(* ***)
264
264
0 commit comments