Reviewers: Toon Verwaest,

Message:
PTAL

Description:
Bugfix in check elimination with a regression test.

Please review this at https://codereview.chromium.org/172173003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+25, -17 lines):
  M src/hydrogen-check-elimination.cc
  A + test/mjsunit/regress/compare-map-elim1.js


Index: src/hydrogen-check-elimination.cc
diff --git a/src/hydrogen-check-elimination.cc b/src/hydrogen-check-elimination.cc index f15267349f2e09af355ad0c900b5814e79095165..6e6a84cc7b3485d64d5813a9288bd58ea7f7e22d 100644
--- a/src/hydrogen-check-elimination.cc
+++ b/src/hydrogen-check-elimination.cc
@@ -338,7 +338,9 @@ class HCheckTable : public ZoneObject {
             HCheckMaps* check = HCheckMaps::cast(entry->check_);
             TRACE(("CheckMaps #%d at B%d narrowed\n", check->id(),
                 check->block()->block_id()));
+            // Update map set and ensure that the check is alive.
             check->set_map_set(intersection, graph->zone());
+            check->ClearFlag(HValue::kIsDead);
             TRACE(("Replacing redundant CheckMaps #%d at B%d with #%d\n",
instr->id(), instr->block()->block_id(), entry->check_->id()));
             instr->DeleteAndReplaceWith(entry->check_);
Index: test/mjsunit/regress/compare-map-elim1.js
diff --git a/test/mjsunit/compiler/compare-map-elim.js b/test/mjsunit/regress/compare-map-elim1.js
similarity index 79%
copy from test/mjsunit/compiler/compare-map-elim.js
copy to test/mjsunit/regress/compare-map-elim1.js
index 288d4811a6811691366841f7693495f6c785da9e..c7ea05def80873f380d40497f6ba48839c70001e 100644
--- a/test/mjsunit/compiler/compare-map-elim.js
+++ b/test/mjsunit/regress/compare-map-elim1.js
@@ -27,25 +27,31 @@

 // Flags: --allow-natives-syntax --check-elimination

-a = {
-  f: function() { this.y = 3; }
-};
-b = {
-  f: function() { this.y = 4; }
-};

-function x(z) {
-  return z.f();
+function foo(o) {
+  return o.foo1;
 }

-x(a);
-x(b);
-x(a);
-x(b);
-x(a);
-x(b);
+function getter() {
+  return this.x + this.z + foo2(this);
+}
+
+function foo2(o) {
+  return o.a;
+}

-%OptimizeFunctionOnNextCall(x)
+var o1 = {z:0, x:1};
+var o2 = {z:0, a:1.5, x:1};
+var o3 = {z:0, a:1.5};
+Object.defineProperty(o1, "foo1", {get:getter});
+Object.defineProperty(o2, "foo1", {get:getter});

-x(a);
-x(b);
+foo(o1);
+foo(o1);
+foo(o2);
+%ClearFunctionTypeFeedback(foo2);
+foo2(o2);
+foo2(o2);
+foo2(o3);
+%OptimizeFunctionOnNextCall(foo);
+foo(o1);


--
--
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.

Reply via email to