Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: test/mjsunit/compare-objects.js

Issue 145773008: A64: Synchronize with r17104. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/compare-known-objects.js ('k') | test/mjsunit/debug-step-4-in-frame.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compare-objects.js
diff --git a/test/mjsunit/compare-known-objects-slow.js b/test/mjsunit/compare-objects.js
similarity index 60%
copy from test/mjsunit/compare-known-objects-slow.js
copy to test/mjsunit/compare-objects.js
index afa198fcb352ea7f186a285146a61fd1ab70d51b..fb31203b746b8aa70426d15a0f34c545ea5b8871 100644
--- a/test/mjsunit/compare-known-objects-slow.js
+++ b/test/mjsunit/compare-objects.js
@@ -28,8 +28,15 @@
// Flags: --allow-natives-syntax
// 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.
+// objects in hydrogen.
+
+function lt(a, b) {
+ return a < b;
+}
+
+function gt(a, b) {
+ return a > b;
+}
function eq(a, b) {
return a == b;
@@ -39,31 +46,63 @@ function eq_strict(a, b) {
return a === b;
}
-function test(a, b) {
+function test(a, b, less, greater) {
// 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));
+ assertEquals(lt(a, b), less);
+ assertEquals(gt(a, b), greater);
+ assertEquals(lt(b, a), greater);
+ assertEquals(gt(b, a), less);
}
-// Prepare two objects in slow mode that have the same map.
-var obj1 = %OptimizeObjectForAddingMultipleProperties({}, 1);
-var obj2 = %OptimizeObjectForAddingMultipleProperties({}, 1);
+var obj1 = {toString: function() {return "1";}};
+var obj2 = {toString: function() {return "2";}};
+
+var less = obj1 < obj2;
+var greater = obj1 > obj2;
-// Test original objects.
-assertTrue(%HaveSameMap(obj1, obj2));
-test(obj1, obj2);
+test(obj1, obj2, less, greater);
+test(obj1, obj2, less, greater);
+test(obj1, obj2, less, greater);
+%OptimizeFunctionOnNextCall(test);
+test(obj1, obj2, less, greater);
+test(obj1, obj2, less, greater);
-// Test after adding property to first object.
obj1.x = 1;
-assertTrue(%HaveSameMap(obj1, obj2));
-test(obj1, obj2);
+test(obj1, obj2, less, greater);
+
+obj2.y = 2;
+test(obj1, obj2, less, greater);
+
+var obj1 = {test: 3};
+var obj2 = {test2: 3};
+
+var less = obj1 < obj2;
+var greater = obj1 > obj2;
+
+test(obj1, obj2, less, greater);
+test(obj1, obj2, less, greater);
+test(obj1, obj2, less, greater);
+%OptimizeFunctionOnNextCall(test);
+test(obj1, obj2, less, greater);
+test(obj1, obj2, less, greater);
+
+obj1.toString = function() {return "1"};
+var less = obj1 < obj2;
+var greater = obj1 > obj2;
+test(obj1, obj2, less, greater);
+%OptimizeFunctionOnNextCall(test);
+test(obj1, obj2, less, greater);
+
+obj2.toString = function() {return "2"};
+var less = true;
+var greater = false;
-// Test after adding property to second object.
+test(obj1, obj2, less, greater);
obj2.y = 2;
-assertTrue(%HaveSameMap(obj1, obj2));
-test(obj1, obj2);
+test(obj1, obj2, less, greater);
« no previous file with comments | « test/mjsunit/compare-known-objects.js ('k') | test/mjsunit/debug-step-4-in-frame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698