[wasm] Refactor call site patching
For debugging, we are patching call sites to not call other WASM_FUNCTIONs, but call WASM_TO_INTERPRETER stubs instead. When later re-instantiating / cloning this code, the old logic for patching call sites would miss those calls. This CL changes the way we patch callsites by getting the called function index per callsite from the bytecode. This requires iterating both the source position table and the relocation table at the same time to determine the byte position for each call. Instead of looking up the functions to be replaced in a std::map, we now get the function directly from a FixedArray. This reduces the complexity from O(n*n*log(n)) to O(m), where n is the total number of functions and m is the total byte code length (note that each function is patched individually, so we set up the map n times before). Constant factor are unclear though. BUG=v8:5822 R=titzer@chromium.org Review-Url: https://codereview.chromium.org/2627613002 Cr-Commit-Position: refs/heads/master@{#42259}
Showing
Please
register
or
sign in
to comment