• 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
build_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.flake8 Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
COMMON_OWNERS Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
ENG_REVIEW_OWNERS Loading commit data...
INFRA_OWNERS Loading commit data...
INTL_OWNERS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
MIPS_OWNERS Loading commit data...
OWNERS Loading commit data...
PPC_OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
S390_OWNERS Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...