[wasm] Initialize parallel jobs with less memory.
Avoid constructing zones and large zone objects when initializing WasmCompilationUnit. The main reason we did that is so we can cache the CEntryStub node, which requires a code object, obtainable only on the main thread. We need that value, however, on background threads, which is also where we need the aforementioned large objects. We only need that for the WasmCompilationUnits being currently compiled, which is a number proportional to the number of background threads provided by the embedder. Specifically, one zone is needed only for the duration of the background compilation, while the second zone needs to survive past that, so the compilation results may be committed to the GC heap as Code objects. The problem with these large objects is that the first allocation in a Zone is at minimum 8KB. We used to allocate 2 zones. For modules with 200K functions, that means 3.2GB of memory pre-allocated before any of it is actually needed. This change attaches a Handle to the CEntryStub on the WasmCompilationUnits, and delays zone creation to when needed. The change also adds a way to cache CEntryStubs in a JSGraph from a given Code handle - limited to the scenario needed by wasm (and removable once we get wasm off the GC heap, which subsumes removing this dependency on CEntryStubs) An additional constraint for this change is that we want it to be easily back-mergeable to address chromium:723899. For the wasm payload in question, collecting the max memory used by d8 using /usr/bin/time --format='(%Xtext+%Ddata %Mmax)', we get the following numbers (in KB): - unchanged: 3307480 - patch 1: 1807140 (45% reduction) - patch 3: 1230320 (62% reduction from first) - patch 5/6: 519368 (84% reduction from first) Bug: chomium:732010, chromium:723899 Change-Id: I45b96792daf8a9c8dc47d45fb52da75945a41401 Reviewed-on: https://chromium-review.googlesource.com/530193 Commit-Queue: Mircea Trofin <mtrofin@chromium.org> Reviewed-by: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#45880}
Showing
This diff is collapsed.
Please
register
or
sign in
to comment