Reviewers: titzer,
Description:
Fix loop side-effects of deoptimizing loops with a nested live OSR loop.
Please review this at https://chromiumcodereview.appspot.com/106723002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+18, -11 lines):
M src/hydrogen-gvn.cc
A + test/mjsunit/regress/regress-context-osr.js
Index: src/hydrogen-gvn.cc
diff --git a/src/hydrogen-gvn.cc b/src/hydrogen-gvn.cc
index
02b3a0a2c94dc217f625f78556cf1ab8cb0e95c1..1da477cf8413efc6f13c39075a2b104fb2e6052c
100644
--- a/src/hydrogen-gvn.cc
+++ b/src/hydrogen-gvn.cc
@@ -412,10 +412,13 @@ void
HGlobalValueNumberingPhase::ComputeBlockSideEffects() {
// Propagate loop side effects upwards.
if (block->HasParentLoopHeader()) {
- int header_id = block->parent_loop_header()->block_id();
- loop_side_effects_[header_id].Add(block->IsLoopHeader()
- ? loop_side_effects_[id]
- : side_effects);
+ HBasicBlock* with_parent = block;
+ if (block->IsLoopHeader()) side_effects = loop_side_effects_[id];
+ while (with_parent->HasParentLoopHeader()) {
+ HBasicBlock* parent_block = with_parent->parent_loop_header();
+ loop_side_effects_[parent_block->block_id()].Add(side_effects);
+ with_parent = parent_block;
+ }
}
}
}
@@ -567,7 +570,9 @@ void HGlobalValueNumberingPhase::ProcessLoopBlock(
}
if (inputs_loop_invariant && ShouldMove(instr, loop_header)) {
- TRACE_GVN_1("Hoisting loop invariant instruction %d\n",
instr->id());
+ TRACE_GVN_3("Hoisting loop invariant instruction %d %d %s\n",
+ instr->id(), pre_header->block_id(),
+ *GetGVNFlagsString(loop_kills));
// Move the instruction out of the loop.
instr->Unlink();
instr->InsertBefore(pre_header->end());
Index: test/mjsunit/regress/regress-context-osr.js
diff --git a/test/mjsunit/regress/regress-crbug-217858.js
b/test/mjsunit/regress/regress-context-osr.js
similarity index 88%
copy from test/mjsunit/regress/regress-crbug-217858.js
copy to test/mjsunit/regress/regress-context-osr.js
index
e61cb9f6d24a6dcb54a81699183d2db843d0d2dc..fbf325b14d59a9007c4e3814b04555c37050f9b4
100644
--- a/test/mjsunit/regress/regress-crbug-217858.js
+++ b/test/mjsunit/regress/regress-context-osr.js
@@ -25,13 +25,15 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --noanalyze_environment_liveness
-
-var r = /r/;
+"use strict";
function f() {
- r[r] = function() {};
+ try { } catch (e) { }
}
-for (var i = 0; i < 300000; i++) {
- f();
+for (this.x = 0; this.x < 1; ++this.x) {
+ for (this.jj = 0; this.jj < 1; ++this.jj) {
+ for (this.ll = 10000; this.ll < 100000; ++this.ll) {
+ f();
+ }
+ }
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.