• Daniel Clark's avatar
    [modules] Add refactored API to get ModuleRequests and expose import assertions · f588c889
    Daniel Clark authored
    This change refactors the v8.h API as discussed in
    https://docs.google.com/document/d/1yuXgNHSbTAPubT1Mg0JXp5uTrfirkvO1g5cHHCe-LmY/edit#heading=h.q0c9h4p928mn
    such that a v8::Module exposes module requests as a FixedArray of
    ModuleRequest objects, which can then be used to obtain their module
    specifier and source code offset.  This replaces the old functions that
    passed back individual specifier Strings and Locations via repeated
    calls to getters that take an index.  These are marked as deprecated.
    
    The new ModuleRequest interface includes a getter for an
    ImportAssertions FixedArray, which will contain the import assertions
    for the request if --harmony-import-assertions is set, and will be
    empty otherwise.
    
    One notable change here is that the APIs now return source code offsets
    rather than v8::Locations.  The host must then call the new
    Module::SourceOffsetToLocation to convert these offsets into line/column
    numbers. This requires a bit more back-and-forth, but allows the host to
    defer the cost of converting from source offset to line/column numbers
    until an error needs to be reported, potentially skipping the work
    altogether.
    
    Bug: v8:10958
    Change-Id: I181639737c701e467324e6c781aa4d7bdd87ae8c
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2545577
    Commit-Queue: Dan Clark <daniec@microsoft.com>
    Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
    Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#71387}
    f588c889
Name
Last commit
Last update
..
benchmarks Loading commit data...
cctest Loading commit data...
common Loading commit data...
debugger Loading commit data...
debugging Loading commit data...
fuzzer Loading commit data...
fuzzilli Loading commit data...
inspector Loading commit data...
intl Loading commit data...
js-perf-test Loading commit data...
memory Loading commit data...
message Loading commit data...
mjsunit Loading commit data...
mkgrokdump Loading commit data...
mozilla Loading commit data...
test262 Loading commit data...
torque Loading commit data...
unittests Loading commit data...
wasm-api-tests Loading commit data...
wasm-js Loading commit data...
wasm-spec-tests Loading commit data...
webkit Loading commit data...
BUILD.gn Loading commit data...
OWNERS Loading commit data...