• Daniel Clark's avatar
    Sort import assertions by code point order of the keys · 73f8a710
    Daniel Clark authored
    Per https://tc39.es/proposal-import-assertions/#sec-assert-clause-to-assertions,
    import assertions should be sorted by the import assertion [[Key]]s,
    in order to prevent hosts from relying on a changing order of the
    assertions to determine behavior.
    
    Prior to this change, the assertions were being sorted by pointer. With
    this CL, the keys are sorted using a code point ordering so that the
    order of the assertions received by the host will be stable and
    non-surprising.
    
    This CL also switches the SourceTextModuleDescriptor's ModuleRequestMap,
    RegularExportMap, and RegularImportMap to use the code point order
    comparison rather than their former shortlex sort.  This change will not
    be externally visible, but it seems best to make these consistent.
    
    In order to avoid #including the fairly large ast-value-factory.h
    into ast/modules.h, I changed ImportAssertions into a separate class
    definition rather than keeping it as a typedef.  The alternative would
    be to define a common AstRawStringComparer in ast-value-factory.h and
    then #include ast-value-factory.h in both ast/modules.h and
    parsing/parser.h so that the ImportAssertions typedef would have a
    full, shared definition of the AstRawStringComparer type.
    
    Bug: v8:10958
    Change-Id: I29c9544aa0a4340c56e1ee631be6cabb2a2eb921
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2533038
    Commit-Queue: Dan Clark <daniec@microsoft.com>
    Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#71165}
    73f8a710
Name
Last commit
Last update
..
DIR_METADATA Loading commit data...
OWNERS Loading commit data...
ast-function-literal-id-reindexer.cc Loading commit data...
ast-function-literal-id-reindexer.h Loading commit data...
ast-source-ranges.h Loading commit data...
ast-traversal-visitor.h Loading commit data...
ast-value-factory.cc Loading commit data...
ast-value-factory.h Loading commit data...
ast.cc Loading commit data...
ast.h Loading commit data...
modules.cc Loading commit data...
modules.h Loading commit data...
prettyprinter.cc Loading commit data...
prettyprinter.h Loading commit data...
scopes.cc Loading commit data...
scopes.h Loading commit data...
source-range-ast-visitor.cc Loading commit data...
source-range-ast-visitor.h Loading commit data...
variables.cc Loading commit data...
variables.h Loading commit data...