• Seth Brenith's avatar
    [torque] Generate accessors for struct-typed class fields · 6160a767
    Seth Brenith authored
    Torque generates runtime accessor member functions for most class fields
    that are defined in .tq files, but fields with struct types are
    currently omitted. This change adds those accessors. As an example, if a
    .tq file defines the following:
    
      struct InternalClassStructElement {
        a: Smi;
        b: Smi;
      }
    
      class InternalClassWithStructElements extends HeapObject {
        const count: Smi;
        entries[count]: InternalClassStructElement;
      }
    
    Then the following accessors are generated to get and set each struct
    field within the 'entries' field:
    
      inline int entries_a(int i) const;
      inline void set_entries_a(int i, int value);
    
      inline int entries_b(int i) const;
      inline void set_entries_b(int i, int value);
    
    Bug: v8:7793
    Change-Id: Ia40b5918e9d09f53ad8e78bc33f8629b8d6a79fe
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2676926Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
    Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
    Cr-Commit-Position: refs/heads/master@{#72662}
    6160a767
scope-info.tq 5.67 KB