Make elements_kind map transition test conditional on smi element support

TEST=mjsunit/element-kind passes even without --smi-only-arrays

Review URL: http://codereview.chromium.org/8230008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9578 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 184fdcf2
...@@ -209,49 +209,53 @@ crankshaft_test(); ...@@ -209,49 +209,53 @@ crankshaft_test();
// A map can have three different elements_kind transitions: SMI->DOUBLE, // A map can have three different elements_kind transitions: SMI->DOUBLE,
// DOUBLE->OBJECT, and SMI->OBJECT. No matter in which order these three are // DOUBLE->OBJECT, and SMI->OBJECT. No matter in which order these three are
// created, they must always end up with the same FAST map. // created, they must always end up with the same FAST map.
// Preparation: create one pair of identical objects for each case.
var a = [1, 2, 3]; // This test is meaningless without FAST_SMI_ONLY_ELEMENTS.
var b = [1, 2, 3]; if (support_smi_only_arrays) {
assertTrue(%HaveSameMap(a, b)); // Preparation: create one pair of identical objects for each case.
assertKind(element_kind.fast_smi_only_elements, a); var a = [1, 2, 3];
var c = [1, 2, 3]; var b = [1, 2, 3];
c["case2"] = true; assertTrue(%HaveSameMap(a, b));
var d = [1, 2, 3]; assertKind(element_kind.fast_smi_only_elements, a);
d["case2"] = true; var c = [1, 2, 3];
assertTrue(%HaveSameMap(c, d)); c["case2"] = true;
assertFalse(%HaveSameMap(a, c)); var d = [1, 2, 3];
assertKind(element_kind.fast_smi_only_elements, c); d["case2"] = true;
var e = [1, 2, 3]; assertTrue(%HaveSameMap(c, d));
e["case3"] = true; assertFalse(%HaveSameMap(a, c));
var f = [1, 2, 3]; assertKind(element_kind.fast_smi_only_elements, c);
f["case3"] = true; var e = [1, 2, 3];
assertTrue(%HaveSameMap(e, f)); e["case3"] = true;
assertFalse(%HaveSameMap(a, e)); var f = [1, 2, 3];
assertFalse(%HaveSameMap(c, e)); f["case3"] = true;
assertKind(element_kind.fast_smi_only_elements, e); assertTrue(%HaveSameMap(e, f));
// Case 1: SMI->DOUBLE, DOUBLE->OBJECT, SMI->OBJECT. assertFalse(%HaveSameMap(a, e));
a[0] = 1.5; assertFalse(%HaveSameMap(c, e));
assertKind(element_kind.fast_double_elements, a); assertKind(element_kind.fast_smi_only_elements, e);
a[0] = "foo"; // Case 1: SMI->DOUBLE, DOUBLE->OBJECT, SMI->OBJECT.
assertKind(element_kind.fast_elements, a); a[0] = 1.5;
b[0] = "bar"; assertKind(element_kind.fast_double_elements, a);
assertTrue(%HaveSameMap(a, b)); a[0] = "foo";
// Case 2: SMI->DOUBLE, SMI->OBJECT, DOUBLE->OBJECT. assertKind(element_kind.fast_elements, a);
c[0] = 1.5; b[0] = "bar";
assertKind(element_kind.fast_double_elements, c); assertTrue(%HaveSameMap(a, b));
assertFalse(%HaveSameMap(c, d)); // Case 2: SMI->DOUBLE, SMI->OBJECT, DOUBLE->OBJECT.
d[0] = "foo"; c[0] = 1.5;
assertKind(element_kind.fast_elements, d); assertKind(element_kind.fast_double_elements, c);
assertFalse(%HaveSameMap(c, d)); assertFalse(%HaveSameMap(c, d));
c[0] = "bar"; d[0] = "foo";
assertTrue(%HaveSameMap(c, d)); assertKind(element_kind.fast_elements, d);
// Case 3: SMI->OBJECT, SMI->DOUBLE, DOUBLE->OBJECT. assertFalse(%HaveSameMap(c, d));
e[0] = "foo"; c[0] = "bar";
assertKind(element_kind.fast_elements, e); assertTrue(%HaveSameMap(c, d));
assertFalse(%HaveSameMap(e, f)); // Case 3: SMI->OBJECT, SMI->DOUBLE, DOUBLE->OBJECT.
f[0] = 1.5; e[0] = "foo";
assertKind(element_kind.fast_double_elements, f); assertKind(element_kind.fast_elements, e);
assertFalse(%HaveSameMap(e, f)); assertFalse(%HaveSameMap(e, f));
f[0] = "bar"; f[0] = 1.5;
assertKind(element_kind.fast_elements, f); assertKind(element_kind.fast_double_elements, f);
assertTrue(%HaveSameMap(e, f)); assertFalse(%HaveSameMap(e, f));
f[0] = "bar";
assertKind(element_kind.fast_elements, f);
assertTrue(%HaveSameMap(e, f));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment