|
|
Description[regexp] Use consistent map checks for fast paths
These map checks were implemented for TF code already. This CL makes
sure that parts implemented in C++ follow the same logic, which is:
An object is an unmodified regexp if:
1) it's a receiver,
2) its map is the initial regexp map,
3) its prototype is a receiver,
4) and its prototype's map is the initial prototype's initial map.
We can now be smarter in @@replace and @@split since checking maps
(unlike the previous check of RegExp.prototype.exec) is not observable,
so we can perform fast-path checks at a time of our choosing.
BUG=v8:5339, v8:5434, v8:5123
Committed: https://crrev.com/eb10dc4c91eb34bad40a5cd33be27a13885f1736
Cr-Commit-Position: refs/heads/master@{#40501}
Patch Set 1 #Patch Set 2 : Go through GetProperty when accessing flags in exec when needed #Patch Set 3 : Earlier fast path in split #Patch Set 4 : Inline proto check #Patch Set 5 : Revert changes to BuiltinExec #Patch Set 6 : Rebase #Patch Set 7 : Unmark coerce-* tests as failing #
Dependent Patchsets: Messages
Total messages: 54 (41 generated)
The CQ bit was checked by jgruber@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
jgruber@chromium.org changed reviewers: + yangguo@chromium.org
+igor FYI since I'm adding another TODO for you.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux64_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_rel_ng/builds/14941) v8_linux64_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_rel_ng_triggered...)
This exposes an issue in RE.proto.exec: * In some tests, e.g. es6/regexp-flags, the regexp instance is modified. * That results in taking the slow 'subclass' path in RegExpReplace. * The slow path properly reads the 'global' property and sees that it is true. * exec directly reads JSRegExp's flags value and thinks it is false. * exec never advances lastIndex, and RegExpReplace loops forever. This was already present in the original JS code, but hasn't triggered so far because our fast-path check in replace was less strict. A partial solution would be to make exec go through GetProperty if regexp is not an unmodified JSRegExp. This would probably help with current test failures. But that still would not fix accesses to e.g. flags in RegExpImpl::Exec / RegExpExecStub.
On 2016/10/20 12:39:24, jgruber wrote: > This exposes an issue in RE.proto.exec: > > * In some tests, e.g. es6/regexp-flags, the regexp instance is modified. > * That results in taking the slow 'subclass' path in RegExpReplace. > * The slow path properly reads the 'global' property and sees that it is true. > * exec directly reads JSRegExp's flags value and thinks it is false. > * exec never advances lastIndex, and RegExpReplace loops forever. > > This was already present in the original JS code, but hasn't triggered so far > because our fast-path check in replace was less strict. > > A partial solution would be to make exec go through GetProperty if regexp is not > an unmodified JSRegExp. This would probably help with current test failures. > > But that still would not fix accesses to e.g. flags in RegExpImpl::Exec / > RegExpExecStub. Actually, RegExpExecStub has no accesses and we could fix the ones in RegExpImpl::Exec. We'd have to be conservative though and would choose the slow path whenever the regexp instance is modified.
The CQ bit was checked by jgruber@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by jgruber@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_mac_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng/builds/11212) v8_mac_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng_triggered/bui...)
The CQ bit was checked by jgruber@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_mac_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng/builds/11220) v8_mac_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng_triggered/bui...)
The CQ bit was checked by jgruber@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux_dbg_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_dbg_ng/builds/15014) v8_linux_dbg_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_dbg_ng_triggered/b...)
On 2016/10/20 12:44:53, jgruber wrote: > On 2016/10/20 12:39:24, jgruber wrote: > > This exposes an issue in RE.proto.exec: > > > > * In some tests, e.g. es6/regexp-flags, the regexp instance is modified. > > * That results in taking the slow 'subclass' path in RegExpReplace. > > * The slow path properly reads the 'global' property and sees that it is true. > > * exec directly reads JSRegExp's flags value and thinks it is false. > > * exec never advances lastIndex, and RegExpReplace loops forever. > > > > This was already present in the original JS code, but hasn't triggered so far > > because our fast-path check in replace was less strict. > > > > A partial solution would be to make exec go through GetProperty if regexp is > not > > an unmodified JSRegExp. This would probably help with current test failures. > > > > But that still would not fix accesses to e.g. flags in RegExpImpl::Exec / > > RegExpExecStub. > > Actually, RegExpExecStub has no accesses and we could fix the ones in > RegExpImpl::Exec. We'd have to be conservative though and would choose the slow > path whenever the regexp instance is modified. LGTM once test failures have been fixed.
The CQ bit was checked by jgruber@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in RegExpReplace since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434 ========== to ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434 ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_mac_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng/builds/11267)
On 2016/10/20 12:44:53, jgruber wrote: > On 2016/10/20 12:39:24, jgruber wrote: > > This exposes an issue in RE.proto.exec: > > > > * In some tests, e.g. es6/regexp-flags, the regexp instance is modified. > > * That results in taking the slow 'subclass' path in RegExpReplace. > > * The slow path properly reads the 'global' property and sees that it is true. > > * exec directly reads JSRegExp's flags value and thinks it is false. > > * exec never advances lastIndex, and RegExpReplace loops forever. > > > > This was already present in the original JS code, but hasn't triggered so far > > because our fast-path check in replace was less strict. > > > > A partial solution would be to make exec go through GetProperty if regexp is > not > > an unmodified JSRegExp. This would probably help with current test failures. > > > > But that still would not fix accesses to e.g. flags in RegExpImpl::Exec / > > RegExpExecStub. > > Actually, RegExpExecStub has no accesses and we could fix the ones in > RegExpImpl::Exec. We'd have to be conservative though and would choose the slow > path whenever the regexp instance is modified. Conclusion after more investigation: in the current spec draft (https://tc39.github.io/ecma262/#sec-regexpbuiltinexec) RegExpBuiltinExec now accesses OriginalFlags (instead of calling GetProperty for global and sticky). That means our exec implementation is correct, and the infinite loop in regexp-flags.js is spec-compliant. Commented that test case for now, and pinged littledan@ about spec issues.
The CQ bit was checked by jgruber@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_win_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_rel_ng/builds/16623)
Description was changed from ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434 ========== to ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 ==========
The CQ bit was checked by jgruber@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux_dbg_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_dbg_ng/builds/15028)
The CQ bit was checked by jgruber@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from yangguo@chromium.org Link to the patchset: https://codereview.chromium.org/2434983002/#ps120001 (title: "Unmark coerce-* tests as failing")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 ========== to ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 ==========
Message was sent while issue was closed.
Committed patchset #7 (id:120001)
Message was sent while issue was closed.
A revert of this CL (patchset #7 id:120001) has been created in https://chromiumcodereview.appspot.com/2438283002/ by machenbach@chromium.org. The reason for reverting is: https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/bui....
Message was sent while issue was closed.
Description was changed from ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 ========== to ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 ==========
On 2016/10/21 11:14:43, machenbach (slow) wrote: > A revert of this CL (patchset #7 id:120001) has been created in > https://chromiumcodereview.appspot.com/2438283002/ by mailto:machenbach@chromium.org. > > The reason for reverting is: > https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/bui.... Relanding - I can't see a timing difference in the extra-transition locally.
The CQ bit was checked by jgruber@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 ========== to ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 ==========
Message was sent while issue was closed.
Committed patchset #7 (id:120001)
Message was sent while issue was closed.
Description was changed from ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 ========== to ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 Committed: https://crrev.com/bac992a11440b7972fe40720d056fc3398c08495 Cr-Commit-Position: refs/heads/master@{#40495} ==========
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/bac992a11440b7972fe40720d056fc3398c08495 Cr-Commit-Position: refs/heads/master@{#40495}
Message was sent while issue was closed.
Description was changed from ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 Committed: https://crrev.com/bac992a11440b7972fe40720d056fc3398c08495 Cr-Commit-Position: refs/heads/master@{#40495} ========== to ========== [regexp] Use consistent map checks for fast paths These map checks were implemented for TF code already. This CL makes sure that parts implemented in C++ follow the same logic, which is: An object is an unmodified regexp if: 1) it's a receiver, 2) its map is the initial regexp map, 3) its prototype is a receiver, 4) and its prototype's map is the initial prototype's initial map. We can now be smarter in @@replace and @@split since checking maps (unlike the previous check of RegExp.prototype.exec) is not observable, so we can perform fast-path checks at a time of our choosing. BUG=v8:5339,v8:5434,v8:5123 Committed: https://crrev.com/eb10dc4c91eb34bad40a5cd33be27a13885f1736 Cr-Commit-Position: refs/heads/master@{#40501} ==========
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/eb10dc4c91eb34bad40a5cd33be27a13885f1736 Cr-Commit-Position: refs/heads/master@{#40501} |