• Daniel Clifford's avatar
    [torque] Implement parameter overloading in generics · 06f2a5c2
    Daniel Clifford authored
    This allows redifinitions of generics with the same name but differing parameter
    type lists, e.g.
    
      macro coerce<Dest: type>(from: HeapObject): Dest;
      coerce<int32>(from: HeapObject): int32 {...}
      macro coerce<Dest: type>(from: Smi): Dest;
      coerce<int32>(from: Smi): int32 {...}
    
    In order to allow multiple overloads of generic macros with the same name,
    a more nuanced lookup of calls has been implemented using the
    ParameterDifference utility class. There is still work to be done to unify
    when ParameterDifference is used for lookup (e.g. removing it from operator
    lookup when operators become simple aliases for macro names), but that work
    will be done in a separate CL.
    
    As part of this CL, the custom handling of "cast<>" operator in the .g4
    grammar has been removed and replaced by a handful of equivalent overloads of
    a generic "cast" macro.
    
    Bug: v8:7793
    Change-Id: Ibb2cdd3d58632b7f7f7ba683499f9688ae07f4f8
    Reviewed-on: https://chromium-review.googlesource.com/1087873
    Commit-Queue: Daniel Clifford <danno@chromium.org>
    Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#53562}
    06f2a5c2
parameter-difference.h 2.42 KB