1. 08 Jun, 2019 1 commit
    • Benedikt Meurer's avatar
      [interpreter] Do ToObject implicitly as part of CloneObject. · 92c6af8a
      Benedikt Meurer authored
      The CloneObject bytecode was only able to handle objects, null and
      undefined, and explicit bytecode had to be generated to perform the
      ToObject outside the bytecode (unlike the other IC bytecodes that
      just perform the ToObject implicitly). That means the simplest possible
      object cloning would also generate a sequence of 5 bytecodes (at least):
      
      ```
         Mov <register>, a0
         JumpIfNull @1
         JumpIfUndefined @1
         ToObject <register>
      1: CloneObject <register>
      ```
      
      That is quite wasteful and unnecessary, since the core logic in the
      runtime already does the ToObject properly anyways. This change
      refactors the CloneObjectIC slightly to behave more like the other ICs
      and do the ToObject implicitly when necessary.
      
      Bug: v8:7611, v8:9114, v8:9183, v8:9343
      Change-Id: I11973e90bf875f154a5a7739287bee17041e4a7a
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1649554Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
      Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
      Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#62064}
      92c6af8a
  2. 29 Apr, 2019 1 commit
    • Benedikt Meurer's avatar
      [runtime] Optimize general object spread. · 4995c85f
      Benedikt Meurer authored
      This adds a new %_CopyDataProperties intrinsic, that reuses most of the
      existing machinery that we already have in place for Object.assign() and
      computed property names in object literals. This speeds up the general
      case for object spread (where the spread is not the first item in an
      object literal) and brings it on par with Object.assign() at least - in
      most cases it's significantly faster than Object.assign().
      
      In the test case [1] referenced from the bug, the performance goes from
      
        objectSpreadLast: 3624 ms.
        objectAssignLast: 1938 ms.
      
      to
      
        objectSpreadLast: 646 ms.
        objectAssignLast: 1944 ms.
      
      which corresponds to a **5-6x performance boost**, making object spread
      faster than Object.assign() in general.
      
      Drive-by-fix: This refactors the Object.assign() fast-path in a way that
      it can be reused appropriately for object spread, and adds another new
      builtin SetDataProperties, which does the core of the Object.assign()
      work. We can teach TurboFan to inline Object.assign() based on the new
      SetDataProperties builtin at some later point to further optimize
      Object.assign().
      
      [1]: https://gist.github.com/bmeurer/0dae4a6b0e23f43d5a22d7c91476b6c0
      
      Bug: v8:9167
      Change-Id: I57bea7a8781c4a1e8ff3d394873c3cd4c5d73834
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1587376Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
      Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
      Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#61100}
      4995c85f
  3. 25 Oct, 2017 1 commit
  4. 18 Jan, 2017 1 commit
    • gsathya's avatar
      [ESnext] Implement Object Rest · 54b5c4b8
      gsathya authored
      This rewrites the rest property into a runtime call which sets up the
      correct properties in the newly created object.
      
      - Changes flag to --harmony-object-rest-spread
      - Changes pattern rewriter to desugar rest property
      - Adds new runtime function CopyDataPropertiesWithExcludedProperties
      
      BUG=v8:5549
      
      Review-Url: https://codereview.chromium.org/2620943002
      Cr-Commit-Position: refs/heads/master@{#42430}
      54b5c4b8
  5. 05 Jan, 2017 1 commit
    • gsathya's avatar
      [ESnext] Implement Object spread · a40b7172
      gsathya authored
      This patch adds parsing of spread object property.
      
      -- Changes ParsePropertyName to parse Token::ELLIPSIS.
      -- Throws if rest is encountered by setting a pattern error.
      -- Adds a new PropertyKind enum (SPREAD)
      -- Adds a new ObjectLiteralProperty::kind (SPREAD)
      -- Adds a new harmony-object-spread flag and protects the parser code
      with it.
      -- Adds a new runtime function called CopyDataProperties
      -- Does not add any support for this feature in fullcodegen.
      -- Ignition calls out to a runtime function CopyDataProperties to
      perform spread operation.
      -- Move FastAssign from builtins-objects.cc to objects.cc
      -- Refactor Builtin_ObjectAssign to use SetOrCopyDataProperties
      
      Object rest will be implemented in a follow on patch.
      
      BUG=v8:5549
      
      Review-Url: https://codereview.chromium.org/2606833002
      Cr-Commit-Position: refs/heads/master@{#42102}
      a40b7172