Open eyebrowsoffire opened 2 months ago
Summary: Dart2wasm fails to compile large const data collections due to exceeding the WebAssembly maximum function size limit. This issue arises when compiling large JSON maps, causing Chrome to throw a "CompileError" during instantiation.
The tests in devtools have a few extremely large JSON maps that are built into the application. See https://github.com/flutter/devtools/blob/8aaa762e94c88b760516d70b6b16eddb79f3e5bb/packages/devtools_test/lib/src/test_data/_performance_data.dart#L9C18-L9C18 as well as https://github.com/flutter/devtools/blob/master/packages/devtools_test/lib/src/test_data/_performance_data_large.dart
When trying to instantiate the output wasm module, Chrome complains:
We are going to restructure the tests to not create this pathological code path. However, we probably should have some better handling of this in the compiler. Either emit a hard failure and say that the data structure is too large, or maybe break it up into multiple initialization functions along with a warning that this is a problematic code path.