Reviewers: Kasper Lund,

Description:
Merged r17569 into 3.22 branch.

Make HCapturedObjects non-deletable for DCE.

BUG=v8:2987
[email protected]

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

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

Affected files (+32, -21 lines):
  M src/hydrogen-instructions.h
  M src/version.cc
  A + test/mjsunit/regress/regress-2987.js


Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 80773bf14789e8524dc4c46184588641d6396495..fde79a7ed5e3aec0a0269675fe62061ae0dd3d02 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -3257,9 +3257,6 @@ class HDematerializedObject : public HInstruction {

   // List of values tracked by this marker.
   ZoneList<HValue*> values_;
-
- private:
-  virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; }
 };


@@ -3287,6 +3284,8 @@ class HArgumentsObject V8_FINAL : public HDematerializedObject {
     set_representation(Representation::Tagged());
     SetFlag(kIsArguments);
   }
+
+  virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; }
 };


@@ -3323,6 +3322,11 @@ class HCapturedObject V8_FINAL : public HDematerializedObject {

  private:
   int capture_id_;
+
+  // Note that we cannot DCE captured objects as they are used to replay
+  // the environment. This method is here as an explicit reminder.
+  // TODO(mstarzinger): Turn HSimulates into full snapshots maybe?
+  virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return false; }
 };


Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index dcf8df7e2a111904816e9a7788e17e1e2d516103..3911ea0b2490f69b90e1b6a10e76ce0e86ca8eb8 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     22
 #define BUILD_NUMBER      24
-#define PATCH_LEVEL       5
+#define PATCH_LEVEL       6
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0
Index: test/mjsunit/regress/regress-2987.js
diff --git a/test/mjsunit/compiler/osr-warm.js b/test/mjsunit/regress/regress-2987.js
similarity index 70%
copy from test/mjsunit/compiler/osr-warm.js
copy to test/mjsunit/regress/regress-2987.js
index 65ada1e114856109ab2261d0bc670bf59daa983c..7dd727e46cd9a75f1315ecd8e34bad6a0038f7f0 100644
--- a/test/mjsunit/compiler/osr-warm.js
+++ b/test/mjsunit/regress/regress-2987.js
@@ -25,26 +25,33 @@
 // (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: --use-osr
+// Flags: --allow-natives-syntax --dead-code-elimination

-function f1(x) {
-  while (x > 0) {
-    x--;
-  }
-  return x;
-}
+// This tests that stores on captured objects are correctly tracked even
+// when DCE is enabled. We cannot delete simulations of captured objects
+// that are still needed to replay the environment correctly.

-assertEquals(0, f1(1));
-assertEquals(0, f1(10000000));
+function constructor() {
+  this.x = 0;
+}

-function f2(x) {
-  var sum = 1;
-  while (x > 0) {
-    x--;
-    sum++;
+var deopt = { deopt:false };
+function boogeyman(mode, value) {
+  var object = new constructor();
+  if (mode) {
+    object.x = 1;
+  } else {
+    object.x = 2;
   }
-  return sum;
+  deopt.deopt;
+  assertEquals(value, object.x);
 }

-assertEquals(2, f2(1));
-assertEquals(10000001, f2(10000000));
+boogeyman(true, 1);
+boogeyman(true, 1);
+boogeyman(false, 2);
+boogeyman(false, 2);
+%OptimizeFunctionOnNextCall(boogeyman);
+boogeyman(false, 2);
+delete deopt.deopt;
+boogeyman(false, 2);


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