1. 09 Mar, 2022 1 commit
    • Camillo Bruni's avatar
      [runtime] Clean up runtime function Arguments accesses · cead6573
      Camillo Bruni authored
      Replace all CONVERT_XXX_ARG_XXX() macros from runtime-util.h with direct
      calls to Arguments or the fully expanded equivalent.
      
      - This replaces many of the hard CHECKs with DCHECK (as is common
        practice in most V8 code)
      - Instead of relying on verbose comments we now have readable code
      - Rename Arguments.::xxx_at with Arguments::xxx_value_at since these
        methods don't return the Object but rather their double/int value
      
      - Add Oddball::ToBool helper
      - Add and use v8::internal::PropertyAttributesFromInt helper
      - Add stronger DCHECK for PropertyAttributes returned in
        GetPropertyAttributesWithInterceptorInternal
      
      
      
      Bug: v8:11263
      Change-Id: I8d531857e05d19f3198753b05af28d993a391854
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3497768Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Commit-Queue: Camillo Bruni <cbruni@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#79418}
      cead6573
  2. 17 Jan, 2022 1 commit
    • Benedikt Meurer's avatar
      [debug] Decouple async event delegate instrumentation from PromiseHooks. · b46d5ffb
      Benedikt Meurer authored
      As described in https://crbug.com/1287476, the fact that the
      AsyncEventDelegate is currently implemented on top of the PromiseHooks
      causes performance problems and makes it difficult to reason about the
      exact (observed) semantics; this is because for this we intercept every
      JSPromise creation (via PromiseHook::kInit) and walk the synchronous
      stack at that point to see if we find one of Promise#then(),
      Promise#catch() or Promise#finally() on the stack. And if we do so, we
      report that to the AsyncEventDelegate (which is implemented in the
      inspector and will then do the async stack/stepping logic on top).
      
      This CL introduces dedicated instrumentation for Promise#then(), which
      is also called from Promise#catch() and Promise#finally(), and uses that
      instrumentation for the purpose of the AsyncEventDelegate. It also
      adjusts the stack walk to not always walk the full stack (which might
      lead to wrong results when calls to Promise#then(), which itself can
      call back into user JavaScript, are found deeper in the stack), but
      instead only check the top-most builtin frames and whatever user
      JavaScript frame is underneath it.
      
      On the standalone.js (from https://crbug.com/1287476#c1), when run with
      the DevTools default of maxDepth=200, we go from around 4.00ms to around
      0.36ms. For everything that does not call Promise#then() - either
      explicitly or implicitly - or `await`s, there's now no observable
      performance impact of turning on the AsyncEventDelegate.
      
      Bug: chromium:1280519
      Fixed: chromium:1287476
      Change-Id: I4911bed146381fc46cfeefb763d6dfc32e8f6071
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3386379
      Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
      Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Commit-Queue: Leszek Swirski <leszeks@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#78640}
      b46d5ffb
  3. 13 Jan, 2022 2 commits
    • Benedikt Meurer's avatar
      [async-await] Further simplify `await` and its instrumentation. · 302a5d20
      Benedikt Meurer authored
      Following up on https://crrev.com/c/3383775 we are now able to further
      simplify the implementation of `await` and its instrumentation (for both
      debugger and promise hooks), which aligns the implementation more
      closely with the spec text and removes a whole bunch of unnecessary
      code.
      
      This also moves the `await` instrumentation into runtime-debug.cc along
      with the other instrumentation methods for async functions.
      
      Bug: chromium:1280519, chromium:1277451, chromium:1246867
      Change-Id: I3fb543c76229091b502f3188da962784977158ab
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3386597
      Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
      Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
      Commit-Queue: Maya Lekova <mslekova@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#78610}
      302a5d20
    • Benedikt Meurer's avatar
      [debug] Simplify async function instrumentation. · 41f0c0ba
      Benedikt Meurer authored
      This unifies and simplifies the way we instrument async functions for
      the purpose of async stack traces and async stepping. It does so while
      retaining the observable behavior on the inspector level (for now).
      
      Previously we'd mark the implicit promise of the async function object
      with the async task ID, and whenever we awaited, we'd copy the async
      task ID to the throwaway promise that is created by the `await`. This
      however made things unnecessarily interesting in the following regards:
      
      1. We'd see `DebugDidHandle` and `DebugWillHandle` events after the
      `AsyncFunctionFinished` events, coming from the throwaway promises,
      while the implicit promise is "done". This is especially confusing
      with rejection propagation and requires very complex stepping logic
      for async functions (after this CL it'll be possible to unify and
      simplify the stepping logic).
      2. We have to thread through the "can suspend" information from the
      Parser all the way through AsyncFunctionReject/AsyncFunctionResolve
      to the async function instrumentation to decide whether to cancel the
      pending task when the async function finishes.
      
      This CL changes the instrumentation to only happen (non recurringly) for
      the throwaway promises allocated upon `await`. This solves both problems
      mentioned above, and works because upon the first `await` the stack
      captured for the throwaway promise will include the synchronous part as
      expected, while upon later `await`s the synchronous part will be empty
      and the asynchronous part will be the stack captured for the previous
      throwaway promise (and the V8Debugger automatically short circuits
      stacks with empty synchronous part).
      
      Bug: chromium:1280519, chromium:1277451, chromium:1246867
      Change-Id: Id604dabc19ea133ea2e9dd63181b1fc33ccb5eda
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3383775Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
      Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
      Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#78599}
      41f0c0ba
  4. 05 Jul, 2021 1 commit
  5. 20 Apr, 2021 1 commit
  6. 08 Apr, 2021 3 commits
  7. 12 Nov, 2020 1 commit
  8. 05 Jun, 2020 1 commit
  9. 30 Apr, 2020 1 commit
  10. 20 Apr, 2020 1 commit
  11. 23 May, 2019 2 commits
  12. 22 May, 2019 1 commit
  13. 20 May, 2019 2 commits
  14. 17 May, 2019 3 commits
  15. 16 May, 2019 2 commits
  16. 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
  17. 26 Feb, 2019 1 commit
  18. 25 Jan, 2019 1 commit
    • Mythri's avatar
      Defer inferring language mode as far as possible · 592aeefa
      Mythri authored
      Inferring the language mode involves iterating the stack to find the
      closure. This is an expensive operation and should be done only when
      required. This cl changes the implementation to infer the language
      mode only when we can't defer it any further. Currently, we infer the
      language mode when throwing an exception or when passing this
      information to PropertyCallbackArguments.
      
      This cl also changes the language mode parameter to SetProperty
      related methods to Maybe<ShouldThrow>. We only use the language mode to
      decide if we need to throw and using ShouldThrow instead of language
      mode simplifies the code by avoiding conversions from Maybe<ShouldThrow>
      to Maybe<LanguageMode> and vice-versa.
      
      Bug: v8:8580, chromium:923820, chromium:925289
      Change-Id: I72497497f62fe0d86fcecd57b06b3183b7531f7b
      Reviewed-on: https://chromium-review.googlesource.com/c/1425912
      Commit-Queue: Mythri Alle <mythria@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
      Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#59094}
      592aeefa
  19. 24 Jan, 2019 1 commit
    • Mythri's avatar
      Reland "Change SetProperty/SetSuperProperty to infer language mode when possible" · e2846ea6
      Mythri authored
      This is a reland of 0896599f with a fix for
      failing layout test.
      
      Original change's description:
      > Change SetProperty/SetSuperProperty to infer language mode when possible
      >
      > In most cases, the language mode can be inferred from the closure and
      > the context. Computing the language mode instead of passing it around
      > simplifies the ICs and will make it possible to go towards lazily
      > allocating feedback vectors. Currently ICs obtain the language mode from
      > the feedback vectors and with lazy feedback allocation we may not always
      > have feedback vectors. Since computing language mode is a bit expensive
      > we want to defer it as far as possible.
      >
      > In Array builtins and other builtins like Reflect.Set we need to force a
      > language mode when setting the properties. To support these cases the
      > SetProperty methods allow the language mode to be overridden when needed.
      >
      > This is a first cl in a series of cls, that will defer the language mode
      > computation further and remove language mode where it is not needed.
      >
      > BUG: v8:8580
      > Change-Id: I9c2396e3bcfe77c3c9d6760c46d86954d54744b9
      > Reviewed-on: https://chromium-review.googlesource.com/c/1409426
      > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
      > Reviewed-by: Jakob Gruber <jgruber@chromium.org>
      > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
      > Commit-Queue: Mythri Alle <mythria@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#58893}
      
      TBR: ahaas@chromium.org
      Change-Id: Id5d81eae91b55638dbc72168f0e5203e684869fb
      Reviewed-on: https://chromium-review.googlesource.com/c/1421077
      Commit-Queue: Mythri Alle <mythria@chromium.org>
      Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
      Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#59075}
      e2846ea6
  20. 18 Jan, 2019 1 commit
    • Maya Lekova's avatar
      Revert "Change SetProperty/SetSuperProperty to infer language mode when possible" · 697885b9
      Maya Lekova authored
      This reverts commit 0896599f.
      
      Reason for revert: Speculative revert, seems to cause a layout test failure blocking the LKGR - https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8-Blink%20Linux%2064/29320
      
      Original change's description:
      > Change SetProperty/SetSuperProperty to infer language mode when possible
      > 
      > In most cases, the language mode can be inferred from the closure and
      > the context. Computing the language mode instead of passing it around
      > simplifies the ICs and will make it possible to go towards lazily
      > allocating feedback vectors. Currently ICs obtain the language mode from
      > the feedback vectors and with lazy feedback allocation we may not always
      > have feedback vectors. Since computing language mode is a bit expensive
      > we want to defer it as far as possible.
      > 
      > In Array builtins and other builtins like Reflect.Set we need to force a
      > language mode when setting the properties. To support these cases the
      > SetProperty methods allow the language mode to be overridden when needed.
      > 
      > This is a first cl in a series of cls, that will defer the language mode
      > computation further and remove language mode where it is not needed.
      > 
      > BUG: v8:8580
      > Change-Id: I9c2396e3bcfe77c3c9d6760c46d86954d54744b9
      > Reviewed-on: https://chromium-review.googlesource.com/c/1409426
      > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
      > Reviewed-by: Jakob Gruber <jgruber@chromium.org>
      > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
      > Commit-Queue: Mythri Alle <mythria@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#58893}
      
      TBR=mlippautz@chromium.org,mythria@chromium.org,jgruber@chromium.org,verwaest@chromium.org
      
      Change-Id: I2e0f80a4577a8ca86c05a62205f9dfa488418a52
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Reviewed-on: https://chromium-review.googlesource.com/c/1420758Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
      Commit-Queue: Maya Lekova <mslekova@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#58911}
      697885b9
  21. 17 Jan, 2019 1 commit
    • Mythri's avatar
      Change SetProperty/SetSuperProperty to infer language mode when possible · 0896599f
      Mythri authored
      In most cases, the language mode can be inferred from the closure and
      the context. Computing the language mode instead of passing it around
      simplifies the ICs and will make it possible to go towards lazily
      allocating feedback vectors. Currently ICs obtain the language mode from
      the feedback vectors and with lazy feedback allocation we may not always
      have feedback vectors. Since computing language mode is a bit expensive
      we want to defer it as far as possible.
      
      In Array builtins and other builtins like Reflect.Set we need to force a
      language mode when setting the properties. To support these cases the
      SetProperty methods allow the language mode to be overridden when needed.
      
      This is a first cl in a series of cls, that will defer the language mode
      computation further and remove language mode where it is not needed.
      
      BUG: v8:8580
      Change-Id: I9c2396e3bcfe77c3c9d6760c46d86954d54744b9
      Reviewed-on: https://chromium-review.googlesource.com/c/1409426Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
      Commit-Queue: Mythri Alle <mythria@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#58893}
      0896599f
  22. 19 Dec, 2018 1 commit
  23. 18 Dec, 2018 1 commit
  24. 06 Dec, 2018 1 commit
    • tzik's avatar
      Replace %RunMicrotasks with %PerformMicrotaskCheckpoint · 07011cc4
      tzik authored
      This replaces Runtime_RunMicrotasks with Runtime_PerformMicrotaskCheckpoint.
      
      RunMicrotasks forcibly runs Microtasks even when the microtasks are suppressed,
      and may causes nested Microtasks in a problematic way. E.g. that confuses
      v8::MicrotasksScope::IsRunningMicrotasks() and GetEnteredOrMicrotaskContext().
      
      OTOH, PerformMicrotaskCheckpoint() doesn't run cause the failure as it
      respects the microtask suppressions.
      
      As all existing tests don't call RunMicrotasks() in the suppressed situation
      (like Promise.resolve().then(()=>{%RunMicrotasks();})), this change should
      not affect to these tests.
      
      Change-Id: Ib043a0cc8e482e022d375084d65ea98a6f54ef3d
      Reviewed-on: https://chromium-review.googlesource.com/c/1360095Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
      Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#58068}
      07011cc4
  25. 12 Nov, 2018 1 commit
  26. 07 Nov, 2018 1 commit
  27. 15 Oct, 2018 1 commit
    • Maya Lekova's avatar
      [async-await] Fix INIT hook with --harmony-await-optimization · 860ddfc0
      Maya Lekova authored
      Split the runtime function for initializing a promise into AwaitPromisesInit
      and AwaitPromisesInitOld, the former not firing the INIT hook and being used
      by the AwaitOptimized builtin. In addition to this the AsyncHooks now caches
      all the previously inited promises and checks that the init hook is not fired
      twice for the same promise.
      
      Modified test expectations for the new async ids in the async hooks tests.
      
      Bug: v8:8300
      Change-Id: If4a17e501b2a233578fa70b6442f219473f001d9
      Reviewed-on: https://chromium-review.googlesource.com/c/1280442
      Commit-Queue: Maya Lekova <mslekova@chromium.org>
      Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#56642}
      860ddfc0
  28. 10 Oct, 2018 1 commit
  29. 03 Aug, 2018 1 commit
  30. 23 Jul, 2018 1 commit
  31. 09 Jul, 2018 1 commit
  32. 03 Jul, 2018 1 commit