Unverified Commit c57cd9bf authored by Ali Ijaz Sheikh's avatar Ali Ijaz Sheikh Committed by Gibson Fahnestock
Browse files

deps: V8: cherry-pick cfc3404f from upstream

Original commit message:
  [string] Fix regexp fast path in MaybeCallFunctionAtSymbol

  The regexp fast path in MaybeCallFunctionAtSymbol had an issue in which
  we'd call ToString after checking that the given {object} was a fast
  regexp and deciding to take the fast path. This is invalid since
  ToString() can call into user-controlled JS and may mutate {object}.

  There's no way to place the ToString call correctly in this instance:
  1 before BranchIfFastRegExp, it's a spec violation if we end up on the
    slow regexp path;
  2 the problem with the current location is already described above;
  3 and we can't place it into the fast-path regexp builtin (e.g.
    RegExpReplace) either due to the same reasons as 1.

  The solution in this CL is to restrict the fast path to string
  arguments only, i.e. cases where ToString would be a nop and can safely
  be skipped.

  Bug: chromium:782145
  Change-Id: Ifd35b3a9a6cf2e77c96cb860a8ec98eaec35aa85
  Reviewed-on: https://chromium-review.googlesource.com/758257


  Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#49213}

Refs: https://github.com/v8/v8/commit/cfc3404fa89957994efd8d1f614dd06f8e075ccf
Refs: https://github.com/v8/v8/commit/55a98076827edac8eba775f8025df3749bcd8367
PR-URL: https://github.com/nodejs/node/pull/17354
parent f34ee5c9
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment