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

Unified Diff: test/mjsunit/elements-transition.js

Issue 397253002: Remove experimental flags that are now required (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 6 years, 5 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/elements-kind-depends.js ('k') | test/mjsunit/elements-transition-hoisting.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/elements-transition.js
diff --git a/test/mjsunit/elements-transition.js b/test/mjsunit/elements-transition.js
index 7298e68a12cb77047f03d794b6aff732fcdd8cba..f6a8188e2f5a55c2f1ed9f1615618b9963770aa5 100644
--- a/test/mjsunit/elements-transition.js
+++ b/test/mjsunit/elements-transition.js
@@ -25,107 +25,95 @@
// (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: --allow-natives-syntax --smi-only-arrays
+// Flags: --allow-natives-syntax
// Flags: --nostress-opt
-support_smi_only_arrays = %HasFastSmiElements(new Array(1,2,3,4,5,6,7,8));
-
-if (support_smi_only_arrays) {
- print("Tests include smi-only arrays.");
-} else {
- print("Tests do NOT include smi-only arrays.");
+// This code exists to eliminate the learning influence of AllocationSites
+// on the following tests.
+var __sequence = 0;
+function make_array_string(length) {
+ this.__sequence = this.__sequence + 1;
+ return "/* " + this.__sequence + " */ new Array(" + length + ");";
+}
+function make_array(length) {
+ return eval(make_array_string(length));
}
-if (support_smi_only_arrays) {
- // This code exists to eliminate the learning influence of AllocationSites
- // on the following tests.
- var __sequence = 0;
- function make_array_string(length) {
- this.__sequence = this.__sequence + 1;
- return "/* " + this.__sequence + " */ new Array(" + length + ");";
- }
- function make_array(length) {
- return eval(make_array_string(length));
- }
-
- function test(test_double, test_object, set, length) {
- // We apply the same operations to two identical arrays. The first array
- // triggers an IC miss, upon which the conversion stub is generated, but the
- // actual conversion is done in runtime. The second array, arriving at
- // the previously patched IC, is then converted using the conversion stub.
- var array_1 = make_array(length);
- var array_2 = make_array(length);
+function test(test_double, test_object, set, length) {
+ // We apply the same operations to two identical arrays. The first array
+ // triggers an IC miss, upon which the conversion stub is generated, but the
+ // actual conversion is done in runtime. The second array, arriving at
+ // the previously patched IC, is then converted using the conversion stub.
+ var array_1 = make_array(length);
+ var array_2 = make_array(length);
- // false, true, nice setter function, 20
- assertTrue(%HasFastSmiElements(array_1));
- assertTrue(%HasFastSmiElements(array_2));
- for (var i = 0; i < length; i++) {
- if (i == length - 5 && test_double) {
- // Trigger conversion to fast double elements at length-5.
- set(array_1, i, 0.5);
- set(array_2, i, 0.5);
- assertTrue(%HasFastDoubleElements(array_1));
- assertTrue(%HasFastDoubleElements(array_2));
- } else if (i == length - 3 && test_object) {
- // Trigger conversion to fast object elements at length-3.
- set(array_1, i, 'object');
- set(array_2, i, 'object');
- assertTrue(%HasFastObjectElements(array_1));
- assertTrue(%HasFastObjectElements(array_2));
- } else if (i != length - 7) {
- // Set the element to an integer but leave a hole at length-7.
- set(array_1, i, 2*i+1);
- set(array_2, i, 2*i+1);
- }
+ // false, true, nice setter function, 20
+ assertTrue(%HasFastSmiElements(array_1));
+ assertTrue(%HasFastSmiElements(array_2));
+ for (var i = 0; i < length; i++) {
+ if (i == length - 5 && test_double) {
+ // Trigger conversion to fast double elements at length-5.
+ set(array_1, i, 0.5);
+ set(array_2, i, 0.5);
+ assertTrue(%HasFastDoubleElements(array_1));
+ assertTrue(%HasFastDoubleElements(array_2));
+ } else if (i == length - 3 && test_object) {
+ // Trigger conversion to fast object elements at length-3.
+ set(array_1, i, 'object');
+ set(array_2, i, 'object');
+ assertTrue(%HasFastObjectElements(array_1));
+ assertTrue(%HasFastObjectElements(array_2));
+ } else if (i != length - 7) {
+ // Set the element to an integer but leave a hole at length-7.
+ set(array_1, i, 2*i+1);
+ set(array_2, i, 2*i+1);
}
+ }
- for (var i = 0; i < length; i++) {
- if (i == length - 5 && test_double) {
- assertEquals(0.5, array_1[i]);
- assertEquals(0.5, array_2[i]);
- } else if (i == length - 3 && test_object) {
- assertEquals('object', array_1[i]);
- assertEquals('object', array_2[i]);
- } else if (i != length - 7) {
- assertEquals(2*i+1, array_1[i]);
- assertEquals(2*i+1, array_2[i]);
- } else {
- assertEquals(undefined, array_1[i]);
- assertEquals(undefined, array_2[i]);
- }
+ for (var i = 0; i < length; i++) {
+ if (i == length - 5 && test_double) {
+ assertEquals(0.5, array_1[i]);
+ assertEquals(0.5, array_2[i]);
+ } else if (i == length - 3 && test_object) {
+ assertEquals('object', array_1[i]);
+ assertEquals('object', array_2[i]);
+ } else if (i != length - 7) {
+ assertEquals(2*i+1, array_1[i]);
+ assertEquals(2*i+1, array_2[i]);
+ } else {
+ assertEquals(undefined, array_1[i]);
+ assertEquals(undefined, array_2[i]);
}
-
- assertEquals(length, array_1.length);
- assertEquals(length, array_2.length);
}
- function run_test(test_double, test_object, set, length) {
- test(test_double, test_object, set, length);
+ assertEquals(length, array_1.length);
+ assertEquals(length, array_2.length);
+}
+
+function run_test(test_double, test_object, set, length) {
+ test(test_double, test_object, set, length);
%ClearFunctionTypeFeedback(test);
- }
+}
- run_test(false, false, function(a,i,v){ a[i] = v; }, 20);
- run_test(true, false, function(a,i,v){ a[i] = v; }, 20);
- run_test(false, true, function(a,i,v){ a[i] = v; }, 20);
- run_test(true, true, function(a,i,v){ a[i] = v; }, 20);
+run_test(false, false, function(a,i,v){ a[i] = v; }, 20);
+run_test(true, false, function(a,i,v){ a[i] = v; }, 20);
+run_test(false, true, function(a,i,v){ a[i] = v; }, 20);
+run_test(true, true, function(a,i,v){ a[i] = v; }, 20);
- run_test(false, false, function(a,i,v){ a[i] = v; }, 10000);
- run_test(true, false, function(a,i,v){ a[i] = v; }, 10000);
- run_test(false, true, function(a,i,v){ a[i] = v; }, 10000);
- run_test(true, true, function(a,i,v){ a[i] = v; }, 10000);
+run_test(false, false, function(a,i,v){ a[i] = v; }, 10000);
+run_test(true, false, function(a,i,v){ a[i] = v; }, 10000);
+run_test(false, true, function(a,i,v){ a[i] = v; }, 10000);
+run_test(true, true, function(a,i,v){ a[i] = v; }, 10000);
- // Check COW arrays
- function get_cow() { return [1, 2, 3]; }
+// Check COW arrays
+function get_cow() { return [1, 2, 3]; }
- function transition(x) { x[0] = 1.5; }
+function transition(x) { x[0] = 1.5; }
- var ignore = get_cow();
- transition(ignore); // Handled by runtime.
- var a = get_cow();
- var b = get_cow();
- transition(a); // Handled by IC.
- assertEquals(1.5, a[0]);
- assertEquals(1, b[0]);
-} else {
- print("Test skipped because smi only arrays are not supported.");
-}
+var ignore = get_cow();
+transition(ignore); // Handled by runtime.
+var a = get_cow();
+var b = get_cow();
+transition(a); // Handled by IC.
+assertEquals(1.5, a[0]);
+assertEquals(1, b[0]);
« no previous file with comments | « test/mjsunit/elements-kind-depends.js ('k') | test/mjsunit/elements-transition-hoisting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698