• 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
..
OWNERS Loading commit data...
async-hooks-wrapper.cc Loading commit data...
async-hooks-wrapper.h Loading commit data...
cov.cc Loading commit data...
cov.h Loading commit data...
d8-console.cc Loading commit data...
d8-console.h Loading commit data...
d8-js.cc Loading commit data...
d8-platforms.cc Loading commit data...
d8-platforms.h Loading commit data...
d8-posix.cc Loading commit data...
d8-windows.cc Loading commit data...
d8.cc Loading commit data...
d8.h Loading commit data...