1. 30 Jul, 2019 1 commit
    • Sathya Gunasekaran's avatar
      [WeakRefs] Make cleanup callback run as a task · 743ce772
      Sathya Gunasekaran authored
      Previously, this was run as a microtask and this CL changes it to run
      as a separate task as mandated by the current WeakRef spec.
      
      This CL also introduces a FinalizationGroup type to the V8 API
      representing the JSFinalizationGroup. This has a `Cleanup`
      function that runs the cleanup callback associated with it.
      
      SetHostCleanupFinalizationGroupCallback is added to set
      the embedder defined HostCleanupFinalizationGroupCallback.
      
      ClearKeptObject is exposed on the v8::Isolate to reset the strongly
      held set of objects.
      
      The general workflow is the following:
      
      (a) When the GC notices that a given finalization group has dirty
          cells, it calls HostCleanupFinalizationGroupCallback with the given
          finalization group.
      
      (b) As part of HostCleanupFinalizationGroupCallback, the embedder
          enqueues a task that at some point later calls
          FinalizationGroup::Cleanup.
      
      (c) At some point in the future, FinalizationGroup::Cleanup is called,
          which runs the cleanup callback of the finalization group.
      
      This patch also includes d8 changes to use these new APIs. Currently,
      d8 cycles through the enqueued finalization groups after a synchronous
      turn (and it's microtask checkpoint) and runs the cleanup callbacks.
      
      Change-Id: I06eb4da2c103b2792a9c62bc4b98fd4e5c4892fc
      Bug: v8:8179
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1655655
      Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#62984}
      743ce772
  2. 27 May, 2019 1 commit
  3. 24 May, 2019 1 commit
  4. 23 May, 2019 2 commits
  5. 22 May, 2019 1 commit
  6. 11 Apr, 2019 1 commit
  7. 04 Apr, 2019 1 commit
    • tzik's avatar
      Cancel EnqueueMicrotask on detached contexts · a487167c
      tzik authored
      Context::microtask_context can be null after v8::Context::DetachGlobal
      is called, and that should cancel microtasks that are associated to
      the detached context.
      However, there are several callers left without the null check to the
      microtask queue, and that causes crashes.
      
      This CL adds the null check and cancellation as the crash fix.
      
      Bug: chromium:937784
      Change-Id: Ie8d107f28f200cee6e75798e3f72c5ed7a2a461c
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1545139
      Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
      Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#60623}
      a487167c
  8. 28 Mar, 2019 1 commit
    • tzik's avatar
      Use non-primary promise handler as a source of fallback microtask context · 39bfa157
      tzik authored
      A microtask requires a non-detached Context to trigger, and the Context
      is usually pulled from the primary handler.
      On an example below, |on_rejected| is primary, as the attached promise
      is rejected and |on_rejected| will be called as the reaction.
      
        Promise.reject().then(on_fulfilled, on_rejected);
      
      If the primary handler is undefined or invalid, we used to use the
      promise's context as the fallback. E.g. the primary handler is undefined
      on the examlpe below, and the context of |promise| was used.
      
        let promise = Promise.reject();
        promise.then(on_fulfilled);
      
      However, that causes a non-intuitive behavior around a detached
      context:
      
        let DeadPromise = iframe.contentWindow.Promise;
        iframe.src = "http://example.com"; // navigate away.
        // DeadPromise's Context is detached state now.
      
        let p = DeadPromise.reject();
      
        // |on_rejected| is called, as the context is pulled from |on_rejected|.
        p.then(on_fulfilled, on_rejected);
      
        // |on_rejected| was NOT called, as a microtask to settle |q| does not
        // run due to the detached context.
        let q = p.then(on_fulfilled);
        q.catch(on_rejected);
      
      After this CL, we use non-primary handler as a source of fallback context.
      On the last example above, the Context is pulled from |on_fullfilled|,
      so that |q| is settled using that context.
      
      Bug: chromium:941271
      Change-Id: Iff71acf7c3617f3493d100abcd2c5c36bd1bbfd1
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1535916Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
      Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#60499}
      39bfa157
  9. 08 Mar, 2019 1 commit
  10. 27 Feb, 2019 1 commit
    • tzik's avatar
      Reland "Do not enqueue or run a microtask on detached contexts" · a32e37ed
      tzik authored
      This is a reland of 734a6575
      
      Original change's description:
      > Do not enqueue or run a microtask on detached contexts
      >
      > This CL disables EnqueueMicrotask and RunMicrotasks on detached
      > contexts. That is, if an embedder call DetachGlobal() on a v8::Context,
      > EnqueueMicrotask on that context will not take effect, and all Microtask
      > that is enqueued before DetachGlobal will be cancelled.
      >
      > On Blink, this implies that a frame will no longer run a microtask after
      > it's navigated away. OTOH, detached frames in Blink are not affected.
      >
      > Bug: v8:8124
      > Change-Id: I5b00ceef5ea2afb87cf067a65eb95c29bf91176d
      > Reviewed-on: https://chromium-review.googlesource.com/c/1416071
      > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
      > Reviewed-by: Yang Guo <yangguo@chromium.org>
      > Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
      > Reviewed-by: Adam Klein <adamk@chromium.org>
      > Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#59445}
      
      Tbr: adamk@chromium.org, yangguo@chromium.org, verwaest@chromium.org
      Bug: v8:8124
      Change-Id: I959a18ae214f1385d5f453b3ed94772e60f71e0f
      Reviewed-on: https://chromium-review.googlesource.com/c/1469544
      Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
      Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#59884}
      a32e37ed
  11. 26 Feb, 2019 1 commit
  12. 08 Feb, 2019 2 commits
  13. 29 Jan, 2019 1 commit
  14. 23 Jan, 2019 2 commits
  15. 17 Jan, 2019 1 commit
    • tzik's avatar
      Use local MicrotaskQueue in unittests · eebdb0f5
      tzik authored
      MicrotaskQueueTest uses Isolate's default_microtask_queue for testing,
      however the instance is shared between test cases, and causes flaky
      failure of MicrotaskQueueTest.BufferGrowth.
      
      This CL adds a MicrotaskQueue instance for each test fixture, so that
      each test cases use separate ones.
      
      Also, this CL removes the DCHECK that denies non-default MicrotaskQueue
      to run, which is unneeded after https://crrev.com/c/1369906.
      
      Bug: v8:8124
      Change-Id: I4ff236c327bf0be14f582b3ca8c802fd72661b42
      Reviewed-on: https://chromium-review.googlesource.com/c/1417315Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
      Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#58901}
      eebdb0f5
  16. 26 Dec, 2018 1 commit
  17. 17 Dec, 2018 1 commit
  18. 07 Dec, 2018 1 commit
  19. 27 Nov, 2018 1 commit
  20. 22 Nov, 2018 1 commit
  21. 21 Nov, 2018 1 commit