Reviewers: titzer,
Description:
Fix OSR to ignore phis without merge index in loop entry.
This fixes a corner case introduced by escape analysis where phis are
introduced in OSR loop entry blocks that don't have a merge index and
hence cannot contain OSR values.
[email protected]
TEST=mjsunit/compiler/escape-analysis
Please review this at https://codereview.chromium.org/23503025/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/hydrogen-osr.cc
M test/mjsunit/compiler/escape-analysis.js
Index: src/hydrogen-osr.cc
diff --git a/src/hydrogen-osr.cc b/src/hydrogen-osr.cc
index
73fa40a72cff1f58c0f320a749aa2ac42583dc7a..bf6233bb41d91cda9f3f8cf38629b3c78aa1c4a7
100644
--- a/src/hydrogen-osr.cc
+++ b/src/hydrogen-osr.cc
@@ -117,8 +117,9 @@ void HOsrBuilder::FinishOsrValues() {
const ZoneList<HPhi*>* phis = osr_loop_entry_->phis();
for (int j = 0; j < phis->length(); j++) {
HPhi* phi = phis->at(j);
- ASSERT(phi->HasMergedIndex());
- osr_values_->at(phi->merged_index())->set_incoming_value(phi);
+ if (phi->HasMergedIndex()) {
+ osr_values_->at(phi->merged_index())->set_incoming_value(phi);
+ }
}
}
Index: test/mjsunit/compiler/escape-analysis.js
diff --git a/test/mjsunit/compiler/escape-analysis.js
b/test/mjsunit/compiler/escape-analysis.js
index
f32069c39239b102ca3e1c32692152533ce2abd2..846edaaa031c0c9e670c559b2d3df037586969ba
100644
--- a/test/mjsunit/compiler/escape-analysis.js
+++ b/test/mjsunit/compiler/escape-analysis.js
@@ -200,3 +200,22 @@
check(27, 27); check(27, 27);
assertEquals(130, sum);
})();
+
+
+// Test OSR into a loop with captured objects.
+(function testOSR() {
+ function constructor() {
+ this.a = 23;
+ }
+ function osr(length) {
+ assertEquals(23, (new constructor()).a);
+ var result = 0;
+ for (var i = 0; i < length; i++) {
+ result = (result + i) % 99;
+ }
+ return result;
+ }
+ assertEquals(45, osr(10));
+ assertEquals(45, osr(10));
+ assertEquals(10, osr(50000));
+})();
--
--
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.