1. 09 Jul, 2021 1 commit
    • Seth Brenith's avatar
      [torque] Protect against a confusing error case · 2a6b2055
      Seth Brenith authored
      I noticed a case where Torque can generate an invalid .inc file, and I
      think that it's worth adding a check that can emit an error during
      run_torque rather than letting the developer hit a C++ compilation
      failure later.
      
      Example error message, if you add @export to StrongDescriptorArray:
      
      Torque Error: Exported class StrongDescriptorArray cannot be in the same
                    file as its parent extern class DescriptorArray
      
      Bug: v8:7793
      Change-Id: Ia69124a4177bd7a53f95442249fae88cb16e354a
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3015655Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Cr-Commit-Position: refs/heads/master@{#75662}
      2a6b2055
  2. 01 Jul, 2021 1 commit
  3. 16 Jun, 2021 1 commit
    • Seth Brenith's avatar
      [torque] Emit an error if a macro recursively calls itself · 6b158455
      Seth Brenith authored
      Rather than letting a recursive macro expansion cause a stack overflow
      and crash the compiler, this change updates Torque to emit an error as
      soon as the recursion is detected. Eventually it would be nice to make
      Cast macros a little more magical so they don't require so much human
      effort to maintain, but at least this way Torque displays some
      information about what went wrong. An example error message (manually
      wrapped to 72 character width) follows.
      
      src/builtins/cast.tq:157:10: Torque Error: Recursive macro call to
        callable Cast<(class Context | Undefined | Zero)>(implicit class
        Context)(Object): (class Context | Undefined | Zero)
      src/builtins/cast.tq:758:3: Torque Error: Note: in specialization
        Cast<(class Context | Undefined | Zero)> requested here
      src/builtins/cast.tq:764:10: Torque Error: Note: in specialization
        Is<(class Context | Undefined | Zero), Object> requested here
      src/builtins/torque-internal.tq:64:3: Torque Error: Note: in
        specialization UnsafeCast<(class Context | Undefined | Zero)>
        requested here
      src/objects/contexts.tq:75:10: Torque Error: Note: in specialization
        ReferenceCast<(class Context | Undefined | Zero), Object> requested
        here
      src/builtins/iterator.tq:142:16: Torque Error: Note: in specialization
        ContextSlot<class Context, class Context, (class Context | Undefined |
        Zero)> requested here
      
      Bug: v8:11727
      Change-Id: I7b5b1852dee16a6860f593f27783f6b2d9366146
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2965032Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Cr-Commit-Position: refs/heads/master@{#75184}
      6b158455
  4. 14 Jun, 2021 1 commit
    • Peter Kasting's avatar
      Fix -Wdeprecated-copy in V8. · 2af5cfa8
      Peter Kasting authored
      TNode has a templated constructor from TNode<U>, but this doesn't take
      precedence over the auto-generated copy constructor, which results in a
      warning being fired.  Fix by adding an explicit copy constructor that
      does what the templated constructor does, which in turn requires fixing
      some missing #includes that slipped by due to the lack of
      LazyTemplateChecks() in the autogenerated copy constructor.
      
      Bug: chromium:1213098
      Change-Id: Iad40950261af8f88396be9227355e4e013837341
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2953503Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Commit-Queue: Peter Kasting <pkasting@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#75133}
      2af5cfa8
  5. 21 May, 2021 1 commit
  6. 10 May, 2021 1 commit
    • Nico Hartmann's avatar
      [Torque] Finalize torque-generated synchronized accessors · 8da583ee
      Nico Hartmann authored
      Torque-generated relaxed/acquire/release accessors now expect an
      additional Tag argument to be more consistent with handwritten
      accessors.
      
      Torque's annotations are renamed from @relaxedRead, @relaxedWrite,
      @acquireRead and @releaseWrite to @cppRelaxedLoad, @cppRelaxedStore,
      @cppAcquireLoad and @cppReleaseStore, repesectively. This renaming
      shall better reflect the fact that those annotations just generate
      corresponding synchronization on the generated C++ accessors
      (not CSA code) and be more consistent with the C++ side of things
      where "Load" and "Store" is used instead of "Read" and "Write".
      
      This CL uses these new annotations on a few fields in DebugInfo and
      FunctionTemplateInfo to have Torque generate accessors automatically.
      
      Bug: v8:11122
      Change-Id: Ibdf3e6b37a254605ff69ba9a50d7b1646790ea15
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2876857Reviewed-by: 's avatarSeth Brenith <seth.brenith@microsoft.com>
      Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Commit-Queue: Jakob Gruber <jgruber@chromium.org>
      Auto-Submit: Nico Hartmann <nicohartmann@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#74463}
      8da583ee
  7. 07 May, 2021 1 commit
    • Nico Hartmann's avatar
      [Torque] Minimize #includes in torque-generated files (1) · d715a98a
      Nico Hartmann authored
      This is the 1st CL in a series of CLs with the goal to significantly
      reduce the number of includes in torque-generated files to reduce
      the build time of Torque's output.
      
      So far, all torque-generated builtins included all (197) other builtins
      generated by Torque. This CL adds tracking of definition locations to
      Torque's ImplementationVisitor that enables it to only include those
      builtins that are actually needed for compilation. This change reduces
      the number of includes for the majority of builtins by 150-180 files.
      
      Bug: v8:11528
      
      Change-Id: Id6f6dd60c9c0f197d14998e580f0fa5fbd60f194
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2876859Reviewed-by: 's avatarSeth Brenith <seth.brenith@microsoft.com>
      Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#74443}
      d715a98a
  8. 16 Apr, 2021 3 commits
    • Leszek Swirski's avatar
      Reland "[codegen] Add static interface descriptors" · 2871e05c
      Leszek Swirski authored
      This is a reland of ae0752df
      
      Reland fixes:
      
        * Remove UNREACHABLE() from constexpr switch, since we don't have a
          CONSTEXPR_UNREACHABLE() (it's ok, the switch is exhaustive for the
          enum anyway).
        * Fix IsRegisterArray trait to use public inheritance and size_t for
          std::array size.
      
      Original change's description:
      > [codegen] Add static interface descriptors
      >
      > Add a new CRTP StaticCallInterfaceDescriptor class, which provides
      > static constexpr getters for a descriptor's registers, parameter counts,
      > and so on. Each CallInterfaceDescriptor subclass is changed to extend
      > StaticCallInterfaceDescriptor, with StaticCallInterfaceDescriptor itself
      > extending CallInterfaceDescriptor to still provide a dynamic lookup
      > where needed.
      >
      > StaticCallInterfaceDescriptor provides a couple of customisation points,
      > where it reads its CRTP derived descriptor's static fields and
      > functions, with default fallbacks where appropriate. With these
      > customisation points, the definition of CallInterfaceDescriptor
      > subclasses is simplified to:
      >
      >     a) Providing parameter names (as before)
      >     b) Providing parameter types (as before)
      >     c) Optionally setting flags (like kNoContext or kAllowVarArgs) as
      >        static booleans on the class.
      >     d) Optionally providing a `registers()` method that returns a
      >        std::array<Register, N> of registers that may be used for
      >        parameters (if not provided, this defaults to the implementation
      >        specific default register set).
      >
      > Parameter registers (and register count) are automagically set based on
      > the number of parameters and number of given registers, with extra magic
      > to ignore no_reg registers (to reduce ia32 special casing). The
      > CallInterfaceDescriptorData is initialized based on these static
      > functions, rather than manual per-descriptor initializers.
      >
      > This allows us to skip loading descriptors dynamically for CallBuiltin
      > in Sparkplug, and instead lets us use a bit of template magic to
      > statically set up arguments for the calls. Any other users of statically
      > known descriptors will also benefit, thanks to C++ picking the static
      > methods over the dynamic methods on the base class when available.
      >
      > Because we can remove various virtual functions and trigger heavier
      > inlining of constantly known values, binary size slightly decreases with
      > this change.
      >
      > Note that torque-generated descriptors are changed to use the same magic,
      > rather than having Torque-specific magic, for consistency.
      >
      > Bug: v8:11420
      > Change-Id: Icc5e238b6313a08734feb564204a13226b450c22
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2814518
      > Auto-Submit: Leszek Swirski <leszeks@chromium.org>
      > Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
      > Reviewed-by: Clemens Backes <clemensb@chromium.org>
      > Reviewed-by: Igor Sheludko <ishell@chromium.org>
      > Reviewed-by: Jakob Gruber <jgruber@chromium.org>
      > Commit-Queue: Clemens Backes <clemensb@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#73996}
      
      TBR=nicohartmann@chromium.org,clemensb@chromium.org,ishell@chromium.org,clemensb@chromium.org
      
      Bug: v8:11420
      Change-Id: Icd1f6cdb3c178e74460044b1e9623139929ceba8
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2831872Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
      Commit-Queue: Leszek Swirski <leszeks@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#74010}
      2871e05c
    • Leszek Swirski's avatar
      Revert "[codegen] Add static interface descriptors" · 5dea60d6
      Leszek Swirski authored
      This reverts commit ae0752df.
      
      Reason for revert: Predictably, constexpr issues on non-clang compilers.
      
      Original change's description:
      > [codegen] Add static interface descriptors
      >
      > Add a new CRTP StaticCallInterfaceDescriptor class, which provides
      > static constexpr getters for a descriptor's registers, parameter counts,
      > and so on. Each CallInterfaceDescriptor subclass is changed to extend
      > StaticCallInterfaceDescriptor, with StaticCallInterfaceDescriptor itself
      > extending CallInterfaceDescriptor to still provide a dynamic lookup
      > where needed.
      >
      > StaticCallInterfaceDescriptor provides a couple of customisation points,
      > where it reads its CRTP derived descriptor's static fields and
      > functions, with default fallbacks where appropriate. With these
      > customisation points, the definition of CallInterfaceDescriptor
      > subclasses is simplified to:
      >
      >     a) Providing parameter names (as before)
      >     b) Providing parameter types (as before)
      >     c) Optionally setting flags (like kNoContext or kAllowVarArgs) as
      >        static booleans on the class.
      >     d) Optionally providing a `registers()` method that returns a
      >        std::array<Register, N> of registers that may be used for
      >        parameters (if not provided, this defaults to the implementation
      >        specific default register set).
      >
      > Parameter registers (and register count) are automagically set based on
      > the number of parameters and number of given registers, with extra magic
      > to ignore no_reg registers (to reduce ia32 special casing). The
      > CallInterfaceDescriptorData is initialized based on these static
      > functions, rather than manual per-descriptor initializers.
      >
      > This allows us to skip loading descriptors dynamically for CallBuiltin
      > in Sparkplug, and instead lets us use a bit of template magic to
      > statically set up arguments for the calls. Any other users of statically
      > known descriptors will also benefit, thanks to C++ picking the static
      > methods over the dynamic methods on the base class when available.
      >
      > Because we can remove various virtual functions and trigger heavier
      > inlining of constantly known values, binary size slightly decreases with
      > this change.
      >
      > Note that torque-generated descriptors are changed to use the same magic,
      > rather than having Torque-specific magic, for consistency.
      >
      > Bug: v8:11420
      > Change-Id: Icc5e238b6313a08734feb564204a13226b450c22
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2814518
      > Auto-Submit: Leszek Swirski <leszeks@chromium.org>
      > Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
      > Reviewed-by: Clemens Backes <clemensb@chromium.org>
      > Reviewed-by: Igor Sheludko <ishell@chromium.org>
      > Reviewed-by: Jakob Gruber <jgruber@chromium.org>
      > Commit-Queue: Clemens Backes <clemensb@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#73996}
      
      Bug: v8:11420
      Change-Id: Ie5469c9253fc140590ac30b72db6eb1d93f86806
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2831485
      Auto-Submit: Leszek Swirski <leszeks@chromium.org>
      Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
      Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
      Cr-Commit-Position: refs/heads/master@{#74000}
      5dea60d6
    • Leszek Swirski's avatar
      [codegen] Add static interface descriptors · ae0752df
      Leszek Swirski authored
      Add a new CRTP StaticCallInterfaceDescriptor class, which provides
      static constexpr getters for a descriptor's registers, parameter counts,
      and so on. Each CallInterfaceDescriptor subclass is changed to extend
      StaticCallInterfaceDescriptor, with StaticCallInterfaceDescriptor itself
      extending CallInterfaceDescriptor to still provide a dynamic lookup
      where needed.
      
      StaticCallInterfaceDescriptor provides a couple of customisation points,
      where it reads its CRTP derived descriptor's static fields and
      functions, with default fallbacks where appropriate. With these
      customisation points, the definition of CallInterfaceDescriptor
      subclasses is simplified to:
      
          a) Providing parameter names (as before)
          b) Providing parameter types (as before)
          c) Optionally setting flags (like kNoContext or kAllowVarArgs) as
             static booleans on the class.
          d) Optionally providing a `registers()` method that returns a
             std::array<Register, N> of registers that may be used for
             parameters (if not provided, this defaults to the implementation
             specific default register set).
      
      Parameter registers (and register count) are automagically set based on
      the number of parameters and number of given registers, with extra magic
      to ignore no_reg registers (to reduce ia32 special casing). The
      CallInterfaceDescriptorData is initialized based on these static
      functions, rather than manual per-descriptor initializers.
      
      This allows us to skip loading descriptors dynamically for CallBuiltin
      in Sparkplug, and instead lets us use a bit of template magic to
      statically set up arguments for the calls. Any other users of statically
      known descriptors will also benefit, thanks to C++ picking the static
      methods over the dynamic methods on the base class when available.
      
      Because we can remove various virtual functions and trigger heavier
      inlining of constantly known values, binary size slightly decreases with
      this change.
      
      Note that torque-generated descriptors are changed to use the same magic,
      rather than having Torque-specific magic, for consistency.
      
      Bug: v8:11420
      Change-Id: Icc5e238b6313a08734feb564204a13226b450c22
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2814518
      Auto-Submit: Leszek Swirski <leszeks@chromium.org>
      Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#73996}
      ae0752df
  9. 12 Apr, 2021 1 commit
    • Wenyu Zhao's avatar
      Allowing map word to be used for other state in GC header. · 5e0b94c4
      Wenyu Zhao authored
      This CL adds features to pack/unpack map words.
      
      Currently V8 cannot store extra metadata in object headers -- because V8
      objects do not have a proper header, but only a map pointer at the start
      of the object. To store per-object metadata like marking data, a side
      table is required as the per-object metadata storage.
      
      This CL enables V8 to use higher unused bits in a 64-bit map word as
      per-object metadata storage. Map pointer stores come with an extra step
      to encode the metadata into the pointer (we call it "map packing").
      Map pointer loads will also remove the metadata bits as well (we call it
      "map packing").
      
      Since the map word is no longer a valid pointer after packing, we also
      change the tag of the packed map word to make it looks like a Smi. This
      helps various GC and barrier code to correctly skip them instead of
      blindly dereferencing this invalid pointer.
      
      A ninja flag `v8_enable_map_packing` is provided to turn this
      map-packing feature on and off. It is disabled by default.
      
      * Only works on x64 platform, with `v8_enable_pointer_compression`
        set to `false`
      
      Bug: v8:11624
      Change-Id: Ia2bdf79553945e5fc0b0874c87803d2cc733e073
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2247561Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
      Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
      Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#73915}
      5e0b94c4
  10. 06 Apr, 2021 1 commit
    • Shu-yu Guo's avatar
      Reland^2 "[ptr-cage] Rename IsolateRoot to PtrComprCageBase" · 627b6b2f
      Shu-yu Guo authored
      This is a reland of e28dadc2
      
      The original failure was due to a stale Win32 bot. The reland failure
      was due to idempotent task deduplication returning the exact same
      failure. See crbug/1196064
      
      Original change's description:
      > [ptr-cage] Rename IsolateRoot to PtrComprCageBase
      >
      > Currently, IsolateRoot is both the address of the Isolate root and the
      > base address of the pointer compression reservation. This CL teases the
      > two uses apart by renaming IsolateRoot to PtrComprCageBase.
      >
      > - In addition to V8_COMPRESS_POINTERS, add a
      >   V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE (vs SHARED_CAGE).
      >
      > - Rename GetIsolate* helpers to GetPtrComprCageBase. When
      >   V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE is true, the helpers remain as
      >   aliases to GetPtrComprCageBase.
      >
      > - Rename kPtrComprIsolateRootAlignment to kPtrComprCageBaseAlignment.
      >
      > Bug: v8:11460
      > Change-Id: I1d715f678ce9a0b5731895612ca14f56579b1c48
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2783672
      > Commit-Queue: Shu-yu Guo <syg@chromium.org>
      > Auto-Submit: Shu-yu Guo <syg@chromium.org>
      > Reviewed-by: Igor Sheludko <ishell@chromium.org>
      > Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#73790}
      
      Bug: v8:11460
      No-Try: true
      Tbr: ishell@chromium.org
      Tbr: rmcilroy@chromium.org
      Change-Id: Id69311cf3267ebe1297fff159de0be48b15b65a3
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2806546Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
      Commit-Queue: Shu-yu Guo <syg@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#73795}
      627b6b2f
  11. 05 Apr, 2021 4 commits
    • Shu-yu Guo's avatar
      Revert "Reland "[ptr-cage] Rename IsolateRoot to PtrComprCageBase"" · 562c4251
      Shu-yu Guo authored
      This reverts commit 15c78b45.
      
      Reason for revert: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Win32/32277/overview
      
      Original change's description:
      > Reland "[ptr-cage] Rename IsolateRoot to PtrComprCageBase"
      >
      > This is a reland of e28dadc2
      >
      > Relanding to see if Win32 rel failures from
      > https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Win32/32275/overview
      > were infra flakes. Could not repro on try bots.
      >
      > Original change's description:
      > > [ptr-cage] Rename IsolateRoot to PtrComprCageBase
      > >
      > > Currently, IsolateRoot is both the address of the Isolate root and the
      > > base address of the pointer compression reservation. This CL teases the
      > > two uses apart by renaming IsolateRoot to PtrComprCageBase.
      > >
      > > - In addition to V8_COMPRESS_POINTERS, add a
      > >   V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE (vs SHARED_CAGE).
      > >
      > > - Rename GetIsolate* helpers to GetPtrComprCageBase. When
      > >   V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE is true, the helpers remain as
      > >   aliases to GetPtrComprCageBase.
      > >
      > > - Rename kPtrComprIsolateRootAlignment to kPtrComprCageBaseAlignment.
      > >
      > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2783672
      > > Reviewed-by: Igor Sheludko <ishell@chromium.org>
      > > Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
      >
      > No-Try: true
      > Bug: v8:11460
      > Tbr: ishell@chromium.org
      > Tbr: rmcilroy@chromium.org
      > Change-Id: I0a8c3a48999d6737c8c64d2c2703607f14f3fdd0
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2806169
      > Reviewed-by: Shu-yu Guo <syg@chromium.org>
      > Commit-Queue: Shu-yu Guo <syg@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#73792}
      
      Bug: v8:11460
      Change-Id: Ifee92d622c43a91c15f45ef94ff739237bd2024b
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2806545
      Auto-Submit: Shu-yu Guo <syg@chromium.org>
      Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
      Commit-Queue: Shu-yu Guo <syg@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#73793}
      562c4251
    • Shu-yu Guo's avatar
      Reland "[ptr-cage] Rename IsolateRoot to PtrComprCageBase" · 15c78b45
      Shu-yu Guo authored
      This is a reland of e28dadc2
      
      Relanding to see if Win32 rel failures from
      https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Win32/32275/overview
      were infra flakes. Could not repro on try bots.
      
      Original change's description:
      > [ptr-cage] Rename IsolateRoot to PtrComprCageBase
      >
      > Currently, IsolateRoot is both the address of the Isolate root and the
      > base address of the pointer compression reservation. This CL teases the
      > two uses apart by renaming IsolateRoot to PtrComprCageBase.
      >
      > - In addition to V8_COMPRESS_POINTERS, add a
      >   V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE (vs SHARED_CAGE).
      >
      > - Rename GetIsolate* helpers to GetPtrComprCageBase. When
      >   V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE is true, the helpers remain as
      >   aliases to GetPtrComprCageBase.
      >
      > - Rename kPtrComprIsolateRootAlignment to kPtrComprCageBaseAlignment.
      >
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2783672
      > Reviewed-by: Igor Sheludko <ishell@chromium.org>
      > Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
      
      No-Try: true
      Bug: v8:11460
      Tbr: ishell@chromium.org
      Tbr: rmcilroy@chromium.org
      Change-Id: I0a8c3a48999d6737c8c64d2c2703607f14f3fdd0
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2806169Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
      Commit-Queue: Shu-yu Guo <syg@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#73792}
      15c78b45
    • Francis McCabe's avatar
      Revert "[ptr-cage] Rename IsolateRoot to PtrComprCageBase" · 07a9ff4d
      Francis McCabe authored
      This reverts commit e28dadc2.
      
      Reason for revert: failed test262 tests;; see https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Win32/32275/steps?succeeded=true&debug=false
      
      Original change's description:
      > [ptr-cage] Rename IsolateRoot to PtrComprCageBase
      >
      > Currently, IsolateRoot is both the address of the Isolate root and the
      > base address of the pointer compression reservation. This CL teases the
      > two uses apart by renaming IsolateRoot to PtrComprCageBase.
      >
      > - In addition to V8_COMPRESS_POINTERS, add a
      >   V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE (vs SHARED_CAGE).
      >
      > - Rename GetIsolate* helpers to GetPtrComprCageBase. When
      >   V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE is true, the helpers remain as
      >   aliases to GetPtrComprCageBase.
      >
      > - Rename kPtrComprIsolateRootAlignment to kPtrComprCageBaseAlignment.
      >
      > Bug: v8:11460
      > Change-Id: I1d715f678ce9a0b5731895612ca14f56579b1c48
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2783672
      > Commit-Queue: Shu-yu Guo <syg@chromium.org>
      > Auto-Submit: Shu-yu Guo <syg@chromium.org>
      > Reviewed-by: Igor Sheludko <ishell@chromium.org>
      > Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#73790}
      
      Bug: v8:11460
      Change-Id: I19d0e28194fcdb28e89f129a7694ca3fe29fa17a
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2806168
      Auto-Submit: Francis McCabe <fgm@chromium.org>
      Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
      Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
      Cr-Commit-Position: refs/heads/master@{#73791}
      07a9ff4d
    • Shu-yu Guo's avatar
      [ptr-cage] Rename IsolateRoot to PtrComprCageBase · e28dadc2
      Shu-yu Guo authored
      Currently, IsolateRoot is both the address of the Isolate root and the
      base address of the pointer compression reservation. This CL teases the
      two uses apart by renaming IsolateRoot to PtrComprCageBase.
      
      - In addition to V8_COMPRESS_POINTERS, add a
        V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE (vs SHARED_CAGE).
      
      - Rename GetIsolate* helpers to GetPtrComprCageBase. When
        V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE is true, the helpers remain as
        aliases to GetPtrComprCageBase.
      
      - Rename kPtrComprIsolateRootAlignment to kPtrComprCageBaseAlignment.
      
      Bug: v8:11460
      Change-Id: I1d715f678ce9a0b5731895612ca14f56579b1c48
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2783672
      Commit-Queue: Shu-yu Guo <syg@chromium.org>
      Auto-Submit: Shu-yu Guo <syg@chromium.org>
      Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
      Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#73790}
      e28dadc2
  12. 25 Mar, 2021 1 commit
  13. 23 Mar, 2021 1 commit
  14. 22 Mar, 2021 2 commits
  15. 15 Mar, 2021 1 commit
  16. 09 Mar, 2021 2 commits
  17. 24 Feb, 2021 1 commit
    • Seth Brenith's avatar
      [torque] Add a way to specify that a class field is optional · c2d419a3
      Seth Brenith authored
      Currently, some ScopeInfo fields are defined as indexed fields with a
      length of either one or zero, because the field might be present or it
      might not. Based on comments in https://crrev.com/c/v8/v8/+/2601880 ,
      this strategy is not sustainable and we need a better way to represent
      optional fields so that we don't have to pass zero when accessing their
      only element. This change is a proposal to fix that problem.
      
      Syntax:
      
      I'm proposing using a question mark because TypeScript does, and Torque
      syntax looks somewhat like TypeScript. I don't feel strongly about this
      though, and I'm open to other suggestions.
        field_name?[condition_expression]: FieldType;
      
      Internal Torque compiler representation:
      
      Internally, I've updated the Torque compiler to still treat these fields
      as indexed, but with an extra flag saying they're optional. When getting
      a LocationReference for a field access expression on an optional field,
      Torque produces a Slice like it would for any other indexed field and
      subsequently calls AtIndex(0) to get a Reference.
      
      AtIndex can crash the process if the index is out of bounds (which is
      good), so some other parts of the Torque compiler need minor adjustments
      so that it doesn't take references to optional fields unless it actually
      needs them.
      
      Initialization:
      
      This proposal doesn't include any changes to initialization logic, so an
      optional field can still be initialized using '...' and an iterator.
      Perhaps we could introduce an Optional<T> struct for prettier
      initialization in a future change.
      
      Bug: v8:7793
      Change-Id: I37649495f4c259e685261f53e4cf2859da66a31f
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2706306
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#73018}
      c2d419a3
  18. 23 Feb, 2021 2 commits
  19. 19 Feb, 2021 1 commit
    • Seth Brenith's avatar
      Revert "Remove 'length' field from ScopeInfo" · 6c922e39
      Seth Brenith authored
      This reverts commit f731e13f.
      
      Reason for revert: perf regressions, chromium:1179757
      
      Original change's description:
      > Remove 'length' field from ScopeInfo
      >
      > ScopeInfo has a vestigial 'length' field from when it used to be a
      > FixedArray. This change removes that field, which saves some memory.
      >
      > More specifically:
      >
      > - Make ScopeInfo inherit from HeapObject, not FixedArrayBase which
      >   supplied the 'length' field.
      > - Privatize the FixedArray-style functions that provide access to
      >   ScopeInfo fields by index, and move them from scope-info-inl.h to
      >   scope-info.cc. Those functions are still used pretty heavily during
      >   initialization (ScopeInfo::Create, etc.), but at least we can avoid
      >   presenting them to the rest of the world.
      > - Change FactoryBase::NewScopeInfo to allocate the updated object shape.
      >   It maintains the existing behavior of filling the newly-allocated
      >   object with undefined, even though that's not a valid ScopeInfo and
      >   further initialization is required.
      > - Move part of AccessorAssembler::ScriptContextTableLookup into a new
      >   Torque macro, because it used to rely on casting ScopeInfo to
      >   FixedArrayBase.
      > - In V8HeapExplorer::AddEntry, don't claim that ScopeInfo objects are
      >   arrays. I think it makes more sense to list them under "(system)" in
      >   the dev tools, like most other V8 internal types.
      >
      > Bug: v8:8952
      > Change-Id: I8278e3a90027d4409f0d268da0fe7080754c6b8c
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2601880
      > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
      > Reviewed-by: Peter Marshall <petermarshall@chromium.org>
      > Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
      > Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
      > Reviewed-by: Mythri Alle <mythria@chromium.org>
      > Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      > Cr-Commit-Position: refs/heads/master@{#72830}
      
      Bug: v8:8952
      Change-Id: I00a69da79e5ac6aaae4436a41ce773ae014cc775
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2706086
      Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
      Auto-Submit: Seth Brenith <seth.brenith@microsoft.com>
      Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
      Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#72855}
      6c922e39
  20. 17 Feb, 2021 1 commit
    • Seth Brenith's avatar
      Remove 'length' field from ScopeInfo · f731e13f
      Seth Brenith authored
      ScopeInfo has a vestigial 'length' field from when it used to be a
      FixedArray. This change removes that field, which saves some memory.
      
      More specifically:
      
      - Make ScopeInfo inherit from HeapObject, not FixedArrayBase which
        supplied the 'length' field.
      - Privatize the FixedArray-style functions that provide access to
        ScopeInfo fields by index, and move them from scope-info-inl.h to
        scope-info.cc. Those functions are still used pretty heavily during
        initialization (ScopeInfo::Create, etc.), but at least we can avoid
        presenting them to the rest of the world.
      - Change FactoryBase::NewScopeInfo to allocate the updated object shape.
        It maintains the existing behavior of filling the newly-allocated
        object with undefined, even though that's not a valid ScopeInfo and
        further initialization is required.
      - Move part of AccessorAssembler::ScriptContextTableLookup into a new
        Torque macro, because it used to rely on casting ScopeInfo to
        FixedArrayBase.
      - In V8HeapExplorer::AddEntry, don't claim that ScopeInfo objects are
        arrays. I think it makes more sense to list them under "(system)" in
        the dev tools, like most other V8 internal types.
      
      Bug: v8:8952
      Change-Id: I8278e3a90027d4409f0d268da0fe7080754c6b8c
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2601880Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
      Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
      Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
      Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Cr-Commit-Position: refs/heads/master@{#72830}
      f731e13f
  21. 11 Feb, 2021 1 commit
    • 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
  22. 09 Feb, 2021 2 commits
  23. 03 Feb, 2021 1 commit
    • Seth Brenith's avatar
      [torque] Add @relaxedRead annotation · cffd8bc8
      Seth Brenith authored
      When generating getters, Torque needs to decide whether to perform a
      normal or relaxed load. Thus far, it has used the somewhat non-obvious
      logic that any indexed field with tagged non-smi data gets relaxed
      loads. This change adds a new annotation @relaxedRead to be consistent
      with the existing @relaxedWrite annotation. I added @relaxedRead
      annotations on any field that previously had this automatic behavior and
      whose getter is called, except for those in ScopeInfo because I'm
      relatively confident that it doesn't need relaxed access.
      
      Bug: v8:7793
      Change-Id: I9987eea13760b967f1b8a3189b69742e55140c30
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2600113
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#72499}
      cffd8bc8
  24. 26 Jan, 2021 1 commit
  25. 21 Jan, 2021 1 commit
  26. 20 Jan, 2021 1 commit
    • Seth Brenith's avatar
      [torque] Begin porting ScopeInfo to Torque · ecaac329
      Seth Brenith authored
      This change adds Torque field definitions for ScopeInfo and begins to
      use the Torque-generated accessors in some places. It does not change
      the in-memory layout of ScopeInfo.
      
      Torque compiler changes:
      
      - Fix an issue where the parser created constexpr types for classes
        based on the class name rather than the `generates` clause. This meant
        that generated accessors referred to the imaginary type HashTable
        rather than the real C++ type FixedArray.
      - Don't pass Isolate* through the generated runtime functions that
        implement Torque macros. Maybe we'll need it eventually, but we don't
        right now and it complicates a lot of things.
      - Don't emit `kSomeFieldOffset` if some_field has an unknown offset.
        Instead, emit a member function `SomeFieldOffset()` which fetches the
        slice for some_field and returns its offset.
      - Emit an `AllocatedSize()` member function for classes which have
        complex length expressions. It fetches the slice for the last field
        and performs the multiply&add to compute the total object size.
      - Emit field accessors for fields with complex length expressions, using
        the new offset functions.
      - Fix a few minor bugs where Torque can write uncompilable code.
      
      With this change, most code still treats ScopeInfo like a FixedArray, so
      I would like to follow up with some additional changes:
      
      1. Generate a GC visitor for ScopeInfo and use it
      2. Generate accessors for struct-typed fields (indexed or otherwise),
         and use them
      3. Get rid of the FixedArray-style get and set accessors; use
         TaggedField::load and similar instead
      4. Inherit from HeapObject rather than FixedArrayBase to remove the
         unnecessary `length` field
      
      After that, there will only be one ugly part left: initialization. I
      think it's possible to generate a factory function that takes a bunch of
      iterator parameters and returns a fully-formed, verifiably correct
      ScopeInfo instance, but doing so is more complicated than the four
      mostly-mechanical changes listed above.
      
      Bug: v8:7793
      Change-Id: I55fcfe9189e4d1613c68d49e378da5dc02597b36
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2357758Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
      Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
      Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Cr-Commit-Position: refs/heads/master@{#72187}
      ecaac329
  27. 19 Jan, 2021 2 commits
  28. 08 Dec, 2020 1 commit
    • Seth Brenith's avatar
      [torque] Make runtime macros inlinable · 6b5f4208
      Seth Brenith authored
      Currently, all runtime C++ code generated for Torque macros all goes
      into a single .cc file and corresponding header. This is simple, but
      limits how we can use that generated code. For example, field accessors
      are generally expected to be inlinable at compilation time (not relying
      on LTO).
      
      This change updates the Torque compiler to output runtime C++ code into
      the same *-tq-inl.inc files that contain implementations of member
      functions for generated classes. All Torque macros transitively called
      from the top-level macros are included in the same file, to avoid any
      need for these generated files to #include each other. These macros are
      emitted within per-file namespaces to avoid multiple-definition build
      failures.
      
      Bug: v8:7793
      Change-Id: Ic9ac3748c5020a05304773a66d7249efdc56b080
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2565067
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#71664}
      6b5f4208
  29. 30 Nov, 2020 1 commit
  30. 24 Nov, 2020 1 commit