1. 21 Jul, 2022 1 commit
  2. 18 Jul, 2022 1 commit
  3. 09 Jun, 2022 1 commit
  4. 30 May, 2022 1 commit
  5. 03 May, 2022 1 commit
  6. 02 May, 2022 1 commit
    • Benedikt Meurer's avatar
      [inspector] Fix mapping between location and offset. · d821a6a3
      Benedikt Meurer authored
      We weren't really translating between location (line and column number)
      and source position (character offset) consistently, especially when it
      came to inline <script>s. There were also inconsistencies between what
      Debugger.getPossibleBreakpoints and Debugger.setBreakpointByUrl would
      do.
      
      With this CL, we are now consistently operating under the following
      assumptions:
      
      (1) For inline <scripts>s with a //@ sourceURL annotation, we assume
          that the line and column number that comes in via the protocol is
          in terms of the source text of the script.
      (2) For inline <script>s without said annotation, we assume that the
          line and column numbers are in terms of the surrounding document.
      
      This is finally aligned with how the DevTools front-end operates.
      
      Fixed: chromium:1319828
      Change-Id: I98c4ef04b34a97caf060ff4f32690b135edb6ee6
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3610622Reviewed-by: 's avatarKim-Anh Tran <kimanh@chromium.org>
      Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
      Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#80292}
      d821a6a3
  7. 24 Mar, 2022 1 commit
    • Benedikt Meurer's avatar
      [debug] Hold on to promises weakly from the debugger's promise stack. · 3eb6b7ac
      Benedikt Meurer authored
      The debugger maintains a stack of promises used for catch prediction
      with promise builtins and async functions. Previously this stack would
      hold on to the individual promises strongly, and subtle bugs that lead
      to not properly cleaning up the stack in some corner cases would often
      lead to significant memory issues (e.g. leaking whole iframes).
      
      This refactors the PromiseOnStack to be
      
        (a) on the V8 heap, rather than allocating C++ structs with global
            handles pointing to the promises, and
        (b) hold on to the promises only weakly.
      
      While this will not guarantee proper promise stack management, it will
      at least ensure that edge cases don't lead to catastrophic (debugger
      only) leaks.
      
      Bug: chromium:1292063
      Change-Id: I9c293ca2032de3a59e1e9624f132d37187805567
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3545176
      Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
      Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
      Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#79594}
      3eb6b7ac
  8. 23 Mar, 2022 1 commit
  9. 21 Mar, 2022 1 commit
  10. 04 Mar, 2022 1 commit
  11. 12 Jan, 2022 1 commit
    • Simon Zünd's avatar
      [debug] Add new 'CreateMessageFromException' function · c0682832
      Simon Zünd authored
      CDP has a "ExceptionDetails" structure that is attached to various
      CDP commands, e.g. "Runtime#exceptionThrown" or "Runtime#evaluate".
      The stack trace in the "ExceptionDetails" structure is used in
      various places in DevTools. The information in the "ExceptionDetails"
      structure is extracted from a v8::Message object. Message objects
      are normally created at the exception throw site and may augment
      the error with manually inspecting the stack (both to capture a fresh
      stack trace in some cases, as well as to calculate location info).
      
      The problem is that in some cases we want to get an "ExceptionDetails"
      structure after the fact, e.g. when logging a JS "Error" object in
      a catch block. This means we can't reuse Isolate::CreateMessage as
      the JS stack at call time is unrelated to the time when an Error
      object was thrown.
      
      To re-use some of the code, this CL introduces a new
      "CreateMessageFromException" method that is only available from the
      debugging interface (not public V8 API!). The new method works
      similar to Isolate::CreateMessage, but:
        1) Does not look at the current JS stack, neither for a fresh
           stack trace nor for location information.
        2) Only uses the "detailed" stack trace for location info.
           This is because the "simple" stack trace could have already
           been serialized by accessing Error#stack.
      
      Bug: chromium:1278650
      Doc: https://bit.ly/runtime-get-exception-details
      Change-Id: I0144516001c71786b9f76ae4dec4442fa1468c5b
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3337257Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
      Commit-Queue: Simon Zünd <szuend@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#78586}
      c0682832
  12. 16 Dec, 2021 1 commit
  13. 02 Dec, 2021 1 commit
  14. 29 Nov, 2021 1 commit
  15. 09 Nov, 2021 1 commit
  16. 27 Oct, 2021 1 commit
    • Camillo Bruni's avatar
      [api] Deprecate v8::ScriptCompiler::CompileFunctionInContext · 78387ca7
      Camillo Bruni authored
      - Introduce v8::ScriptCompiler::CompileFunction
      - Deprecate v8::ScriptCompiler::CompileFunctionInContext
      - Add v8::Function::GetUnboundScript
      - Add v8::Script::GetResourceName
      
      The ScriptOrModule out-parameter is only used by NodeJS since we don't
      allow arbitrary objects has host-defined options and they need a way to
      keep the options alive.
      
      This CL deprecates the out-parameter and adds helper methods to
      address the most common use-cases.
      
      The final fix still requires more fundamental changes on how host-defined
      options are handled.
      
      Bug: chromium:1244145
      Change-Id: Id29de53521ad626c41391b8300146ee37a1b8a51
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3245117Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Commit-Queue: Jakob Gruber <jgruber@chromium.org>
      Auto-Submit: Camillo Bruni <cbruni@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#77564}
      78387ca7
  17. 27 Sep, 2021 1 commit
  18. 16 Sep, 2021 1 commit
  19. 24 Aug, 2021 1 commit
    • Dan Elphick's avatar
      Reland "[include] Split out v8.h" · ec06bb6c
      Dan Elphick authored
      This is a reland of d1b27019
      
      Fixes include:
      Adding missing file to bazel build
      Forward-declaring classing before friend-classing them to fix win/gcc
      Add missing v8-isolate.h include for vtune builds
      
      Original change's description:
      > [include] Split out v8.h
      >
      > This moves every single class/function out of include/v8.h into a
      > separate header in include/, which v8.h then includes so that
      > externally nothing appears to have changed.
      >
      > Every include of v8.h from inside v8 has been changed to a more
      > fine-grained include.
      >
      > Previously inline functions defined at the bottom of v8.h would call
      > private non-inline functions in the V8 class. Since that class is now
      > in v8-initialization.h and is rarely included (as that would create
      > dependency cycles), this is not possible and so those methods have been
      > moved out of the V8 class into the namespace v8::api_internal.
      >
      > None of the previous files in include/ now #include v8.h, which means
      > if embedders were relying on this transitive dependency then it will
      > give compile failures.
      >
      > v8-inspector.h does depend on v8-scripts.h for the time being to ensure
      > that Chrome continue to compile but that change will be reverted once
      > those transitive #includes in chrome are changed to include it directly.
      >
      > Full design:
      > https://docs.google.com/document/d/1rTD--I8hCAr-Rho1WTumZzFKaDpEp0IJ8ejZtk4nJdA/edit?usp=sharing
      >
      > Bug: v8:11965
      > Change-Id: I53b84b29581632710edc80eb11f819c2097a2877
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3097448
      > Reviewed-by: Yang Guo <yangguo@chromium.org>
      > Reviewed-by: Camillo Bruni <cbruni@chromium.org>
      > Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
      > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
      > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
      > Commit-Queue: Dan Elphick <delphick@chromium.org>
      > Cr-Commit-Position: refs/heads/main@{#76424}
      
      Cq-Include-Trybots: luci.v8.try:v8_linux_vtunejit
      Bug: v8:11965
      Change-Id: I99f5d3a73bf8fe25b650adfaf9567dc4e44a09e6
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3113629Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
      Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
      Commit-Queue: Dan Elphick <delphick@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#76460}
      ec06bb6c
  20. 23 Aug, 2021 2 commits
    • Dan Elphick's avatar
      Revert "[include] Split out v8.h" · 44fe02ce
      Dan Elphick authored
      This reverts commit d1b27019.
      
      Reason for revert: Broke vtune build, tsan build and possibly others
      
      Original change's description:
      > [include] Split out v8.h
      >
      > This moves every single class/function out of include/v8.h into a
      > separate header in include/, which v8.h then includes so that
      > externally nothing appears to have changed.
      >
      > Every include of v8.h from inside v8 has been changed to a more
      > fine-grained include.
      >
      > Previously inline functions defined at the bottom of v8.h would call
      > private non-inline functions in the V8 class. Since that class is now
      > in v8-initialization.h and is rarely included (as that would create
      > dependency cycles), this is not possible and so those methods have been
      > moved out of the V8 class into the namespace v8::api_internal.
      >
      > None of the previous files in include/ now #include v8.h, which means
      > if embedders were relying on this transitive dependency then it will
      > give compile failures.
      >
      > v8-inspector.h does depend on v8-scripts.h for the time being to ensure
      > that Chrome continue to compile but that change will be reverted once
      > those transitive #includes in chrome are changed to include it directly.
      >
      > Full design:
      > https://docs.google.com/document/d/1rTD--I8hCAr-Rho1WTumZzFKaDpEp0IJ8ejZtk4nJdA/edit?usp=sharing
      >
      > Bug: v8:11965
      > Change-Id: I53b84b29581632710edc80eb11f819c2097a2877
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3097448
      > Reviewed-by: Yang Guo <yangguo@chromium.org>
      > Reviewed-by: Camillo Bruni <cbruni@chromium.org>
      > Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
      > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
      > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
      > Commit-Queue: Dan Elphick <delphick@chromium.org>
      > Cr-Commit-Position: refs/heads/main@{#76424}
      
      Bug: v8:11965
      Change-Id: Id57313ae992e720c8b19abc975cd69729e1344aa
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3113627
      Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
      Commit-Queue: Leszek Swirski <leszeks@chromium.org>
      Owners-Override: Leszek Swirski <leszeks@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#76428}
      44fe02ce
    • Dan Elphick's avatar
      [include] Split out v8.h · d1b27019
      Dan Elphick authored
      This moves every single class/function out of include/v8.h into a
      separate header in include/, which v8.h then includes so that
      externally nothing appears to have changed.
      
      Every include of v8.h from inside v8 has been changed to a more
      fine-grained include.
      
      Previously inline functions defined at the bottom of v8.h would call
      private non-inline functions in the V8 class. Since that class is now
      in v8-initialization.h and is rarely included (as that would create
      dependency cycles), this is not possible and so those methods have been
      moved out of the V8 class into the namespace v8::api_internal.
      
      None of the previous files in include/ now #include v8.h, which means
      if embedders were relying on this transitive dependency then it will
      give compile failures.
      
      v8-inspector.h does depend on v8-scripts.h for the time being to ensure
      that Chrome continue to compile but that change will be reverted once
      those transitive #includes in chrome are changed to include it directly.
      
      Full design:
      https://docs.google.com/document/d/1rTD--I8hCAr-Rho1WTumZzFKaDpEp0IJ8ejZtk4nJdA/edit?usp=sharing
      
      Bug: v8:11965
      Change-Id: I53b84b29581632710edc80eb11f819c2097a2877
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3097448Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
      Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
      Commit-Queue: Dan Elphick <delphick@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#76424}
      d1b27019
  21. 16 Aug, 2021 1 commit
  22. 22 Jun, 2021 1 commit
  23. 18 Jun, 2021 1 commit
  24. 14 Jun, 2021 1 commit
  25. 07 Jun, 2021 1 commit
  26. 01 Jun, 2021 1 commit
  27. 30 Apr, 2021 1 commit
    • Jakob Kummerow's avatar
      [cctest] Make sure FLAG_stack_size settings have effect · a43f3818
      Jakob Kummerow authored
      Using the default cctest TEST(...) macro causes later writes to
      FLAG_stack_size to have no effect, because the StackGuard reads
      that flag's value during Isolate initialization, which is done
      before the test body is executed. This patch changes the two
      existing tests that accidentally did this to UNINITIALIZED_TEST,
      putting them in charge of Isolate creation, thereby ensuring that
      the intended stack size is configured correctly.
      
      Change-Id: Ib030795ef46f23d576f6dbbd26b347ac804b5085
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2862778Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
      Commit-Queue: Yang Guo <yangguo@chromium.org>
      Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#74309}
      a43f3818
  28. 16 Mar, 2021 1 commit
  29. 09 Mar, 2021 1 commit
  30. 03 Mar, 2021 1 commit
    • Benedikt Meurer's avatar
      [debug] Instantiate accessors only once. · e9873bf1
      Benedikt Meurer authored
      When retrieving an API accessor function (i.e. either the getter or the
      setter) for which the lazy accessor mechanism is used (i.e. where the
      actual JSFunction is created lazily and only the FunctionTemplateInfo)
      is around, we thus far created a fresh JSFunction every time the
      accessor function is requested, but that's observably wrong behavior,
      since the accessors are JavaScript objects with identity. We currently
      rely on the instantiation cache to guarantee identity, but there's no
      reason why we couldn't instead just put the instantiated JSFunction into
      the AccessorPair.
      
      Fixing this to only instantiate the lazy accessor pair only once, upon
      first time it's requested, coincidentally also simplifies (and fixes)
      the API accessor breakpoint machinery. This was previously lacking
      support for walking dictionary prototype objects and forcibly
      instantiating the lazy accessor pairs with break points. However, all
      this magic in the debugger is no longer necessary when we ensure that
      the lazy accessor pair component is generally only instantiated once.
      
      Bug: v8:178, v8:7596, chromium:986063, chromium:496666
      Change-Id: I41d28378010716c96c8ecf7c3f1247765f8bc669
      Fixed: chromium:1163547
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2731527Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
      Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
      Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#73163}
      e9873bf1
  31. 14 Jan, 2021 1 commit
  32. 24 Nov, 2020 1 commit
  33. 20 Nov, 2020 1 commit
  34. 12 Nov, 2020 1 commit
  35. 28 Sep, 2020 1 commit
    • Alex Kodat's avatar
      [debug] Restore StepNext on correct frame for RestoreDebug · 9329f558
      Alex Kodat authored
      When an Isolate in a multi-threaded environment is being debugged
      and a thread does a Step Over (StepNext internally) one-shot
      breaks are created in the code at the stack frame where the
      StepNext occurred. However, if the stepped-over statement had
      a function call and the called function (or some function that
      it called) unlocked the Isolate (via a C++ function call) and
      another thread then locked the Isolate, an ArchiveDebug would
      be done which would save the fact that a StepNext is active and
      the call frame depth of the StepNext. The one-shot breaks would
      then be cleared to avoid stopping the now running thread.
      
      When the original thread that did the StepNext relocks the Isolate,
      a RestoreDebug is done which, seeing that a StepNext was active
      calls PrepareDebug which assumes that the StepNext must be for
      the current JS frame which is usually correct, but not in this
      case. This results in the StepNext break actually occurring in the
      function that called the C++ function not in the function where
      the StepNext was originally done. In addition, the function where
      the break now happens must necessarily be deoptimized if
      optimized, and debug code and a source map table created if one
      doesn't already exists though this is largely invisible to the
      user.
      
      Occasionally, a crash/core dump also occurs because the stack
      guard is restored after the debugging environment is restored in
      the RestoreThread code which can prevent the compiler from being
      called to generate the source map table (for the incorrect
      function) since the stack guard is another thread's stack guard,
      and so might appear that the stack guard has been gone past so
      the compiler is not called, resulting in there being no source
      map table. But PrepareStep ends up calling the BreakIterator
      (via the DebugInfo constructor) which assumes there is a source
      map table so we get a crash.
      
      The fix is to have PrepareStep to skip to the frame where the
      StepNext was done before doing its thing. Since the only
      PrepareStepcaller that requires a frame other than the current
      frame, is RestoreDebug, a target frame parameter was added to
      PrepareStep that's set by RestoreDebug and defaults to -1
      indicating to use the current frame for all other callers.
      
      While this made the order of the debug environment and stack
      guard no longer cause an obvious problem, it still felt wrong
      to defer restoration of the stack guard until after something
      as potentially complex as PrepareStep might be called, so the
      order of RestoreDebug and RestoreStackGuard calls were reversed.
      
      Bug: v8:10902
      Change-Id: I174e254e72414c827e113aec142f1d329ebe73d8
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2405932
      Commit-Queue: Toon Verwaest <verwaest@chromium.org>
      Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
      Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#70152}
      9329f558
  36. 22 Sep, 2020 1 commit
  37. 05 Aug, 2020 1 commit
    • Jakob Gruber's avatar
      [nci] Replace CompilationTarget with a new Code::Kind value · c51041f4
      Jakob Gruber authored
      With the new Turbofan variants (NCI and Turboprop), we need a way to
      distinguish between them both during and after compilation. We
      initially introduced CompilationTarget to track the variant during
      compilation, but decided to reuse the code kind as the canonical spot to
      store this information instead.
      
      Why? Because it is an established mechanism, already available in most
      of the necessary spots (inside the pipeline, on Code objects, in
      profiling traces).
      
      This CL removes CompilationTarget and adds a new
      NATIVE_CONTEXT_INDEPENDENT kind, plus helper functions to determine
      various things about a given code kind (e.g.: does this code kind
      deopt?).
      
      As a (very large) drive-by, refactor both Code::Kind and
      AbstractCode::Kind into a new CodeKind enum class.
      
      Bug: v8:8888
      Change-Id: Ie858b9a53311b0731630be35cf5cd108dee95b39
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2336793
      Commit-Queue: Jakob Gruber <jgruber@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
      Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
      Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#69244}
      c51041f4
  38. 29 Apr, 2020 1 commit
  39. 09 Mar, 2020 1 commit