Reviewers: danno,

Description:
Merged r11815 into trunk branch.

Fix assertion for map code cache of shared maps.

[email protected]
TEST=mjsunit/compare-known-objects-slow


Please review this at https://chromiumcodereview.appspot.com/10534159/

SVN Base: https://v8.googlecode.com/svn/trunk

Affected files:
  M src/objects.cc
  M src/version.cc
  A + test/mjsunit/compare-known-objects-slow.js


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 6314955b13749fbcc7abd71d535cc0225c9604f7..329a0c562b25407036bb24d51bb6e2398da2e6d5 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8279,7 +8279,8 @@ void Code::ClearTypeFeedbackCells(Heap* heap) {


 bool Code::allowed_in_shared_map_code_cache() {
-  return is_keyed_load_stub() || is_keyed_store_stub();
+  return is_keyed_load_stub() || is_keyed_store_stub() ||
+ (is_compare_ic_stub() && compare_state() == CompareIC::KNOWN_OBJECTS);
 }


Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index 81b2c597ea9f239f7fcc8c3150b08ba9bf3a0452..86f18b652ba77a2b79d4a614472aed201428a3bc 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     11
 #define BUILD_NUMBER      10
-#define PATCH_LEVEL       2
+#define PATCH_LEVEL       3
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0
Index: test/mjsunit/compare-known-objects-slow.js
diff --git a/test/mjsunit/compiler/inline-arity-mismatch.js b/test/mjsunit/compare-known-objects-slow.js
similarity index 60%
copy from test/mjsunit/compiler/inline-arity-mismatch.js
copy to test/mjsunit/compare-known-objects-slow.js
index 4a61fa3a62c36f8f53b12cde023f52bdb6e1abc7..afa198fcb352ea7f186a285146a61fd1ab70d51b 100644
--- a/test/mjsunit/compiler/inline-arity-mismatch.js
+++ b/test/mjsunit/compare-known-objects-slow.js
@@ -27,36 +27,43 @@

 // Flags: --allow-natives-syntax

-// Test inlining at call sites with mismatched arity.
+// Test CompareIC stubs for normal and strict equality comparison of known
+// objects in slow mode. These objects share the same map even though they
+// might have completely different properties.

-function f(a) {
-  return a.x;
+function eq(a, b) {
+  return a == b;
 }

-function g(a, b) {
-  return a.x;
+function eq_strict(a, b) {
+  return a === b;
 }

-function h1(a, b) {
-  return f(a, a) * g(b);
-}
-
-function h2(a, b) {
-  return f(a, a) * g(b);
+function test(a, b) {
+  // Check CompareIC for equality of known objects.
+  assertTrue(eq(a, a));
+  assertTrue(eq(b, b));
+  assertFalse(eq(a, b));
+  // Check CompareIC for strict equality of known objects.
+  assertTrue(eq_strict(a, a));
+  assertTrue(eq_strict(b, b));
+  assertFalse(eq_strict(a, b));
 }

+// Prepare two objects in slow mode that have the same map.
+var obj1 = %OptimizeObjectForAddingMultipleProperties({}, 1);
+var obj2 = %OptimizeObjectForAddingMultipleProperties({}, 1);

-var o = {x: 2};
+// Test original objects.
+assertTrue(%HaveSameMap(obj1, obj2));
+test(obj1, obj2);

-assertEquals(4, h1(o, o));
-assertEquals(4, h1(o, o));
-assertEquals(4, h2(o, o));
-assertEquals(4, h2(o, o));
-%OptimizeFunctionOnNextCall(h1);
-%OptimizeFunctionOnNextCall(h2);
-assertEquals(4, h1(o, o));
-assertEquals(4, h2(o, o));
+// Test after adding property to first object.
+obj1.x = 1;
+assertTrue(%HaveSameMap(obj1, obj2));
+test(obj1, obj2);

-var u = {y:0, x:1};
-assertEquals(2, h1(u, o));
-assertEquals(2, h2(o, u));
+// Test after adding property to second object.
+obj2.y = 2;
+assertTrue(%HaveSameMap(obj1, obj2));
+test(obj1, obj2);


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to