1. 29 Apr, 2020 2 commits
  2. 05 Feb, 2020 1 commit
    • Sathya Gunasekaran's avatar
      [callprinter] Correctly point to the incorrect spread arg · 1d0693e2
      Sathya Gunasekaran authored
      The source position is set to the function call (console.log) not the
      spread (..x), in the bytecode generator, as the spread operation is
      done as part of the CallWithSpread bytecode.
      
      The CallPrinter stops at the function call and doesn't look at the
      arguments as well (in CallPrinter::VisitCall) to see if the error is
      from an incorrect spread operation.
      
      
      With this patch, we pass some state to the CallPrinter in the
      CallWithSpread error case and check that in CallPrinter::VisitCall
      before returning.
      
      For the given source string:
      ```
      x = undefined;
      console.log(1, ...x);
      ```
      
      Previously, the error was -
      
      ```
      test.js:2: TypeError: console.log is not iterable (cannot read property Symbol(Symbol.iterator))
      console.log(1, ...x);
              ^
      TypeError: console.log is not iterable (cannot read property Symbol(Symbol.iterator))
          at test.js:2:9
      ```
      
      
      Now, the error is -
      
      ```
      _test.js:2: TypeError: x is not iterable (cannot read property undefined)
      console.log(1, ...x);
                        ^
      TypeError: x is not iterable (cannot read property undefined)
          at _test.js:2:9
      ```
      
      Bug: v8:10038
      Change-Id: I199de9997f1d949c6f9b7b4f41d51f422b8b5131
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2037431Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66131}
      1d0693e2
  3. 13 Sep, 2019 1 commit
  4. 30 Aug, 2019 1 commit
    • Leszek Swirski's avatar
      Reland "[destructuring] Elide coercible check for simple keys" · ef2df57a
      Leszek Swirski authored
      This is a reland of 1fba0441
      Chromium expectation tests have been disabled, and will be enabled
      
      Original change's description:
      > [destructuring] Elide coercible check for simple keys
      >
      > Simple object destructuring, such as `let {a,b} = o`, is less efficient
      > than the equivalent assignments `let a = o.a; let b = o.b`. This is
      > because it does a nil check of `o` before the assignments. However, this
      > nil check is not strictly necessary for simple (i.e. non-computed) names,
      > as there will be an equivalent nil check on the first access to o in
      > `o.a`. For computed names the computation is unfortunately obervable.
      >
      > So, we can elide the nil check when the first property (if any) of the
      > destructuring target is a non-computed name. This messes a bit with our
      > error messages, so we re-use the CallPrinter to also find destructuring
      > assignment based errors, and fiddle with the error message there. As
      > a side-effect, we also get out the object name in the AST, so we can
      > output a slightly nicer error message.
      >
      > Change-Id: Iafa858e27ed771a146cd3ba57903cc73bb46951d
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1773254
      > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
      > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
      > Commit-Queue: Leszek Swirski <leszeks@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#63453}
      
      TBR=verwaest@chromium.org
      
      Bug: chromium:999473
      Change-Id: Ib0b2e4be433c50521ba1722e1c06b672bfefa405
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1777702Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Commit-Queue: Leszek Swirski <leszeks@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#63477}
      ef2df57a
  5. 29 Aug, 2019 2 commits
    • Adam Klein's avatar
      Revert "[destructuring] Elide coercible check for simple keys" · 28fa4cb4
      Adam Klein authored
      This reverts commit 1fba0441.
      
      Reason for revert: blocks V8 roll due to layout test failures caused by error message changes:
      https://ci.chromium.org/p/v8/builders/ci/V8%20Blink%20Linux/347
      
      Original change's description:
      > [destructuring] Elide coercible check for simple keys
      > 
      > Simple object destructuring, such as `let {a,b} = o`, is less efficient
      > than the equivalent assignments `let a = o.a; let b = o.b`. This is
      > because it does a nil check of `o` before the assignments. However, this
      > nil check is not strictly necessary for simple (i.e. non-computed) names,
      > as there will be an equivalent nil check on the first access to o in
      > `o.a`. For computed names the computation is unfortunately obervable.
      > 
      > So, we can elide the nil check when the first property (if any) of the
      > destructuring target is a non-computed name. This messes a bit with our
      > error messages, so we re-use the CallPrinter to also find destructuring
      > assignment based errors, and fiddle with the error message there. As
      > a side-effect, we also get out the object name in the AST, so we can
      > output a slightly nicer error message.
      > 
      > Change-Id: Iafa858e27ed771a146cd3ba57903cc73bb46951d
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1773254
      > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
      > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
      > Commit-Queue: Leszek Swirski <leszeks@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#63453}
      
      TBR=leszeks@chromium.org,verwaest@chromium.org
      
      Change-Id: I74cf06ebd987e5b8bbe1831b0042c085edf37f5b
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1776994Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
      Commit-Queue: Adam Klein <adamk@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#63465}
      28fa4cb4
    • Leszek Swirski's avatar
      [destructuring] Elide coercible check for simple keys · 1fba0441
      Leszek Swirski authored
      Simple object destructuring, such as `let {a,b} = o`, is less efficient
      than the equivalent assignments `let a = o.a; let b = o.b`. This is
      because it does a nil check of `o` before the assignments. However, this
      nil check is not strictly necessary for simple (i.e. non-computed) names,
      as there will be an equivalent nil check on the first access to o in
      `o.a`. For computed names the computation is unfortunately obervable.
      
      So, we can elide the nil check when the first property (if any) of the
      destructuring target is a non-computed name. This messes a bit with our
      error messages, so we re-use the CallPrinter to also find destructuring
      assignment based errors, and fiddle with the error message there. As
      a side-effect, we also get out the object name in the AST, so we can
      output a slightly nicer error message.
      
      Change-Id: Iafa858e27ed771a146cd3ba57903cc73bb46951d
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1773254Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
      Commit-Queue: Leszek Swirski <leszeks@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#63453}
      1fba0441
  6. 23 May, 2019 2 commits
  7. 28 Jan, 2019 1 commit
  8. 24 Oct, 2018 1 commit
  9. 14 Aug, 2018 1 commit
  10. 31 Jul, 2018 1 commit
  11. 04 Jul, 2018 1 commit
  12. 15 Dec, 2017 1 commit
  13. 09 Nov, 2017 1 commit
    • Ross McIlroy's avatar
      [Ast] Teach Ast Printer to print raw literal values. · ff4e4ab4
      Ross McIlroy authored
      Converts the ast prettyprinter to printing literals from the raw values
      rather than internalized on-heap strings. This enables ast printing before
      internalizing, and means we can avoid use of the isolate in the interpreter's
      off-thread phase.
      
      Also removes --print-builtin-ast and relies on just --print-ast to print
      everything.
      
      Finally, converts FunctionLiteral's debug_name function to return a
      char[] which is created from the raw name literal where it exists, rather
      than relying on the value having been internalized.
      
      BUG=v8:5203
      
      Change-Id: Ib69f754e254736f415db38713e6209465817e6f1
      Reviewed-on: https://chromium-review.googlesource.com/758681Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
      Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#49276}
      ff4e4ab4
  14. 03 Nov, 2017 2 commits
    • Ross McIlroy's avatar
      Revert "[Ast] Teach Ast Printer to print raw literal values." · 5dc02ef2
      Ross McIlroy authored
      This reverts commit c60934e9.
      
      Reason for revert: breaks nosnap build
      
      
      Original change's description:
      > [Ast] Teach Ast Printer to print raw literal values.
      > 
      > Converts the ast prettyprinter to printing literals from the raw values
      > rather than internalized on-heap strings. This enables ast printing before
      > internalizing, and means we can avoid use of the isolate in the interpreter's
      > off-thread phase.
      > 
      > Also removes --print-builtin-ast and relies on just --print-ast to print
      > everything.
      > 
      > Finally, converts FunctionLiteral's debug_name function to return a
      > char[] which is created from the raw name literal where it exists, rather
      > than relying on the value having been internalized.
      > 
      > BUG=v8:5203
      > 
      > Change-Id: I0e358d6acc9ae4516ed49e7a763e208fea5fcf66
      > Reviewed-on: https://chromium-review.googlesource.com/749261
      > Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
      > Reviewed-by: Adam Klein <adamk@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#49119}
      
      TBR=rmcilroy@chromium.org,adamk@chromium.org
      
      Change-Id: Ic9d511f5107666a2f6a2bf59d8e93643c32d4d2b
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Bug: v8:5203
      Reviewed-on: https://chromium-review.googlesource.com/753627Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
      Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#49120}
      5dc02ef2
    • Ross McIlroy's avatar
      [Ast] Teach Ast Printer to print raw literal values. · c60934e9
      Ross McIlroy authored
      Converts the ast prettyprinter to printing literals from the raw values
      rather than internalized on-heap strings. This enables ast printing before
      internalizing, and means we can avoid use of the isolate in the interpreter's
      off-thread phase.
      
      Also removes --print-builtin-ast and relies on just --print-ast to print
      everything.
      
      Finally, converts FunctionLiteral's debug_name function to return a
      char[] which is created from the raw name literal where it exists, rather
      than relying on the value having been internalized.
      
      BUG=v8:5203
      
      Change-Id: I0e358d6acc9ae4516ed49e7a763e208fea5fcf66
      Reviewed-on: https://chromium-review.googlesource.com/749261
      Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
      Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#49119}
      c60934e9
  15. 01 Aug, 2017 1 commit
    • Sathya Gunasekaran's avatar
      [parser] Provide better error when destructuring callable · c805d5e3
      Sathya Gunasekaran authored
      The patch changes CallPrinter's AST traversal to continue even after
      the first positive match for an AST node. This helps us check for the
      subsequent GetIterator AST node in case of destructuring.
      
      We can not differentiate between the function call failing and the
      GetIterator failing based on source position info. This would involve
      runtime checks costing performance.
      
      Instead of providing an incorrect error, we provide both the
      possiblities to user and allow them to disambiguate.
      
      Previously,
        d8> function f() { return 5; }
        undefined
        d8> var [a] = f();
        (d8):1: TypeError: f is not a function
        var [a] = f();
                  ^
        TypeError: f is not a function
            at (d8):1:11
      
      
      Now,
        d8> function f() { return 5; }
        undefined
        d8> var [a] = f();
        (d8):1: TypeError: f is not a function or its return value is not iterable
        var [a] = f();
                  ^
        TypeError: f is not a function or its return value is not iterable
            at (d8):1:11
      
      Bug: v8:6616, v8:6513
      Change-Id: I3d6427f10cae54951b0ad0e5ddcbe802bb7191c1
      Reviewed-on: https://chromium-review.googlesource.com/594894
      Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
      Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#47025}
      c805d5e3
  16. 06 Jul, 2017 1 commit
  17. 05 Jul, 2017 1 commit
  18. 06 Jun, 2017 1 commit
    • Igor Sheludko's avatar
      [parser] Introduce SharedFunctionInfo::has_shared_name(). · 9a2c18f5
      Igor Sheludko authored
      Properly propagate the fact that the function has a statically known name from
      parser to SharedFunctionInfo objects. The empty string that has been set as
      name before this CL does not help to distinguish cases like:
        var o1 = { ''(){} };
        var o1 = { [foo()](){} };
      or
        var o2 = { get ''(){} };
        var o2 = { get [foo()](){} };
      
      This is a preliminary step for using different layouts for closure objects with
      and without computed names.
      
      TBR=bmeurer@chromium.org, marja@chromium.org
      
      Bug: v8:6459
      Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
      Change-Id: I10afa6f4bda7881c3714711a75f720f83c1d875d
      Reviewed-on: https://chromium-review.googlesource.com/522073
      Commit-Queue: Igor Sheludko <ishell@chromium.org>
      Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
      Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#45744}
      9a2c18f5
  19. 17 Nov, 2016 1 commit
  20. 16 Nov, 2016 2 commits
  21. 02 Nov, 2016 1 commit
    • verwaest's avatar
      Thread decls-list through Declaration using a ThreadedList · 5a18685e
      verwaest authored
      This reduces per-scope overhead from minimally 6 words to 2 words, with one additional pointer per entry, rather than an average of 2 per entry for larger-than-4 element lists. For temp zone parsed functions it additionally makes the declaration-list actually freeable.
      
      This introduces ThreadedList to implement the details of dealing with such a list.
      
      BUG=v8:5209
      
      Review-Url: https://codereview.chromium.org/2457393003
      Cr-Commit-Position: refs/heads/master@{#40703}
      5a18685e
  22. 06 Sep, 2016 1 commit
    • bakkot's avatar
      Split the AST representation of class properties from object properties. · 7bc200c7
      bakkot authored
      This introduces ClassLiteralProperty and a supertype LiteralProperty of
      it and ObjectLiteralProperty. It also splits the parsing of the two.
      This substiantially clarifies some logic, especially as classes
      continue to evolve, and is also about a 2% performance improvement to
      parsing either kind of property (since no work is wasted on logic
      only necessary for the other kind). Also, it saves a word on
      ObjectLiteralProperties.
      
      Review-Url: https://codereview.chromium.org/2302643002
      Cr-Commit-Position: refs/heads/master@{#39219}
      7bc200c7
  23. 22 Aug, 2016 1 commit
    • jgruber's avatar
      Handle unicode correctly in CallPrinter · a89639e7
      jgruber authored
      CallPrinter currently has only a single use, namely to print the call
      site when throwing CalledNonCallable (ConstructedNonConstructable)
      errors. This ensures that unicode call sites such as "あいう"() are
      printed correctly by using an IncrementalStringBuilder internally.
      
      BUG=637167
      
      Review-Url: https://codereview.chromium.org/2265073002
      Cr-Commit-Position: refs/heads/master@{#38790}
      a89639e7
  24. 05 Aug, 2016 3 commits
  25. 15 Jul, 2016 1 commit
    • verwaest's avatar
      Templatize AstVisitor with its subclass · ebf166df
      verwaest authored
      This replaces the vtable on AstNode with a NodeType tag. The visitors replace double dispatch with a single switch over the NodeType.
      
      For now, visitors with subclasses still have virtual methods themselves. We should probably specialize them later as well.
      
      The uint8_t NodeType allows us to better pack memory, saving 8-16 bytes on many AST nodes (with additional packing that I'll do in a follow-up CL)
      
      BUG=
      
      Review-Url: https://codereview.chromium.org/2142233003
      Cr-Commit-Position: refs/heads/master@{#37788}
      ebf166df
  26. 13 Jul, 2016 1 commit
  27. 12 Jul, 2016 1 commit
  28. 06 Jun, 2016 1 commit
  29. 12 Apr, 2016 1 commit
  30. 11 Apr, 2016 2 commits
  31. 08 Apr, 2016 2 commits
    • jfb's avatar
      Revert of Fix printf formats (patchset #8 id:140001 of... · 4c4fdc2d
      jfb authored
      Revert of Fix printf formats (patchset #8 id:140001 of https://codereview.chromium.org/1869433004/ )
      
      Reason for revert:
      One small issue easily fixed here: https://codereview.chromium.org/1867333003/
      
      But it looks like MSVS 2013 doesn't like some of the formats and exists with the unhelpful:
      Stderr:
      f:\dd\vctools\crt\crtw32\stdio\output.c(1125) : Assertion failed: ("Incorrect
      format specifier", 0)
      
      It's easier to revert for now, I'll dig more into the docs:
      https://msdn.microsoft.com/en-us/library/56e442dc(v=vs.120).aspx
      https://msdn.microsoft.com/en-us/library/tcxf1dw6(v=vs.120).aspx
      
      And then resubmit, making sure I run these bots.
      
      Original issue's description:
      > Fix printf formats
      >
      > The usage of __attribute__((format(x, y)) was either wrong or missing from multiple functions, leading to erroneous formats. This CL:
      >
      >  - Imports PRINTF_FORMAT macro from Chrome's src/base/compiler-specific.h.
      >  - Uses it appropriately.
      >  - Imports Chrome's base/format_macros.h mainly to fix size_t formats (further cleanup could be done).
      >  - Fixes a bunch of incorrect formats.
      >
      > R= jochen@chromium.org, bmeurer@chromium.org, yangguo@chromium.org, ahaas@chromium.org
      >
      > Committed: https://crrev.com/6ebf9fbb93d31f9be41156a3325d58704ed4933d
      > Cr-Commit-Position: refs/heads/master@{#35365}
      
      TBR=jochen@chromium.org,bmeurer@chromium.org,yangguo@chromium.org,ahaas@chromium.org
      # Skipping CQ checks because original CL landed less than 1 days ago.
      NOPRESUBMIT=true
      NOTREECHECKS=true
      NOTRY=true
      
      Review URL: https://codereview.chromium.org/1867383002
      
      Cr-Commit-Position: refs/heads/master@{#35366}
      4c4fdc2d
    • jfb's avatar
      Fix printf formats · 6ebf9fbb
      jfb authored
      The usage of __attribute__((format(x, y)) was either wrong or missing from multiple functions, leading to erroneous formats. This CL:
      
       - Imports PRINTF_FORMAT macro from Chrome's src/base/compiler-specific.h.
       - Uses it appropriately.
       - Imports Chrome's base/format_macros.h mainly to fix size_t formats (further cleanup could be done).
       - Fixes a bunch of incorrect formats.
      
      R= jochen@chromium.org, bmeurer@chromium.org, yangguo@chromium.org, ahaas@chromium.org
      
      Review URL: https://codereview.chromium.org/1869433004
      
      Cr-Commit-Position: refs/heads/master@{#35365}
      6ebf9fbb