• Benedikt Meurer's avatar
    [inspector] Implement Debug Proxy API via Interceptors. · c27c167c
    Benedikt Meurer authored
    Previously the Debug Proxy API that's exposed on Wasm frames by
    Runtime.evaluateOnCallFrame() was implemented via actual JSProxy
    instances. That means that all entities such as "memories", "tables",
    "stack", "globals", etc. were JSProxy instances with "get" and "has"
    traps. But that has a couple of down-sides:
    
    1. In DevTools front-end, the proxies are shown as JSProxy, which is not
       very useful to developers, since they cannot interact with them nor
       can they inspect their contents. And the object preview also only
       shows "Proxy {}" for them.
    2. The performance doesn't scale well, which becomes a painful
       bottleneck with larger Wasm modules that contain hundreds of
       thousands of functions or globals.
    3. We cannot use the JSProxy instances in the Scope view (for the
       reasons outlined in 1.) and hence we have different logic to provide
       Scope values than values in the rest of DevTools, which led to subtle
       but annoying bugs and inconsistencies.
    
    This also changes the "locals" implementation by querying the values
    ahead of time, similar to the object exposed to the Scope view, instead
    of on-demand, since the "locals" object might survive the current
    debugger pause and peeking into the stack afterwards would read invalid
    memory (and might even be a security issue). For being able to change
    locals we need to look into a similar solution as what we have for
    JavaScript locals already. The expression stack already works this way.
    
    For performance reasons (especially scaling to huge, realistic Wasm
    modules), we cache the per-instance proxies ("functions", "memories",
    "tables" and "globals") on the WasmInstanceObject and reuse them (which
    is safe since they have a `null` prototype and are non-extensible), and
    we also cache the proxy maps (with the interceptors) on the
    JSGlobalObject per native context.
    
    Doc: http://bit.ly/devtools-wasm-entities
    Bug: chromium:1127914, chromium:1159402, chromium:1071432, chromium:1164241
    Change-Id: I6191035fdfd887835ae533fcdaabb5bbc8e661ae
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2606058
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#71981}
    c27c167c
Name
Last commit
Last update
..
baseline Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
OWNERS Loading commit data...
c-api.cc Loading commit data...
c-api.h Loading commit data...
code-space-access.h Loading commit data...
compilation-environment.h Loading commit data...
decoder.h Loading commit data...
function-body-decoder-impl.h Loading commit data...
function-body-decoder.cc Loading commit data...
function-body-decoder.h Loading commit data...
function-compiler.cc Loading commit data...
function-compiler.h Loading commit data...
graph-builder-interface.cc Loading commit data...
graph-builder-interface.h Loading commit data...
jump-table-assembler.cc Loading commit data...
jump-table-assembler.h Loading commit data...
leb-helper.h Loading commit data...
local-decl-encoder.cc Loading commit data...
local-decl-encoder.h Loading commit data...
memory-tracing.cc Loading commit data...
memory-tracing.h Loading commit data...
module-compiler.cc Loading commit data...
module-compiler.h Loading commit data...
module-decoder.cc Loading commit data...
module-decoder.h Loading commit data...
module-instantiate.cc Loading commit data...
module-instantiate.h Loading commit data...
object-access.h Loading commit data...
signature-map.cc Loading commit data...
signature-map.h Loading commit data...
simd-shuffle.cc Loading commit data...
simd-shuffle.h Loading commit data...
streaming-decoder.cc Loading commit data...
streaming-decoder.h Loading commit data...
struct-types.h Loading commit data...
sync-streaming-decoder.cc Loading commit data...
value-type.h Loading commit data...
wasm-arguments.h Loading commit data...
wasm-code-manager.cc Loading commit data...
wasm-code-manager.h Loading commit data...
wasm-constants.h Loading commit data...
wasm-debug.cc Loading commit data...
wasm-debug.h Loading commit data...
wasm-engine.cc Loading commit data...
wasm-engine.h Loading commit data...
wasm-external-refs.cc Loading commit data...
wasm-external-refs.h Loading commit data...
wasm-feature-flags.h Loading commit data...
wasm-features.cc Loading commit data...
wasm-features.h Loading commit data...
wasm-import-wrapper-cache.cc Loading commit data...
wasm-import-wrapper-cache.h Loading commit data...
wasm-js.cc Loading commit data...
wasm-js.h Loading commit data...
wasm-limits.h Loading commit data...
wasm-linkage.h Loading commit data...
wasm-module-builder.cc Loading commit data...
wasm-module-builder.h Loading commit data...
wasm-module-sourcemap.cc Loading commit data...
wasm-module-sourcemap.h Loading commit data...
wasm-module.cc Loading commit data...
wasm-module.h Loading commit data...
wasm-objects-inl.h Loading commit data...
wasm-objects.cc Loading commit data...
wasm-objects.h Loading commit data...
wasm-objects.tq Loading commit data...
wasm-opcodes-inl.h Loading commit data...
wasm-opcodes.cc Loading commit data...
wasm-opcodes.h Loading commit data...
wasm-result.cc Loading commit data...
wasm-result.h Loading commit data...
wasm-serialization.cc Loading commit data...
wasm-serialization.h Loading commit data...
wasm-subtyping.cc Loading commit data...
wasm-subtyping.h Loading commit data...
wasm-tier.h Loading commit data...
wasm-value.h Loading commit data...