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

Unified Diff: test/mjsunit/allocation-site-info.js

Issue 16453002: Removed flag optimize-constructed-arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment fixes Created 7 years, 6 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 | « src/x64/lithium-x64.cc ('k') | test/mjsunit/array-constructor-feedback.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/allocation-site-info.js
diff --git a/test/mjsunit/allocation-site-info.js b/test/mjsunit/allocation-site-info.js
index 69ee83ec765cda0b35119ac7b068744232a3c4e3..542f874f334c7a5bf70cc067662c4d2b595a7641 100644
--- a/test/mjsunit/allocation-site-info.js
+++ b/test/mjsunit/allocation-site-info.js
@@ -37,7 +37,6 @@
// support_smi_only_arrays = %HasFastSmiElements(new Array(1,2,3,4,5,6,7,8));
support_smi_only_arrays = true;
-optimize_constructed_arrays = true;
if (support_smi_only_arrays) {
print("Tests include smi-only arrays.");
@@ -45,12 +44,6 @@ if (support_smi_only_arrays) {
print("Tests do NOT include smi-only arrays.");
}
-if (optimize_constructed_arrays) {
- print("Tests include constructed array optimizations.");
-} else {
- print("Tests do NOT include constructed array optimizations.");
-}
-
var elements_kind = {
fast_smi_only : 'fast smi only elements',
fast : 'fast elements',
@@ -187,136 +180,134 @@ if (support_smi_only_arrays) {
// sites work again for fast literals
//assertKind(elements_kind.fast, obj);
- if (optimize_constructed_arrays) {
- function newarraycase_smidouble(value) {
- var a = new Array();
- a[0] = value;
- return a;
- }
+ function newarraycase_smidouble(value) {
+ var a = new Array();
+ a[0] = value;
+ return a;
+ }
- // Case: new Array() as allocation site, smi->double
- obj = newarraycase_smidouble(1);
- assertKind(elements_kind.fast_smi_only, obj);
- obj = newarraycase_smidouble(1.5);
- assertKind(elements_kind.fast_double, obj);
- obj = newarraycase_smidouble(2);
- assertKind(elements_kind.fast_double, obj);
+ // Case: new Array() as allocation site, smi->double
+ obj = newarraycase_smidouble(1);
+ assertKind(elements_kind.fast_smi_only, obj);
+ obj = newarraycase_smidouble(1.5);
+ assertKind(elements_kind.fast_double, obj);
+ obj = newarraycase_smidouble(2);
+ assertKind(elements_kind.fast_double, obj);
- function newarraycase_smiobj(value) {
- var a = new Array();
- a[0] = value;
- return a;
- }
+ function newarraycase_smiobj(value) {
+ var a = new Array();
+ a[0] = value;
+ return a;
+ }
- // Case: new Array() as allocation site, smi->fast
- obj = newarraycase_smiobj(1);
- assertKind(elements_kind.fast_smi_only, obj);
- obj = newarraycase_smiobj("gloria");
- assertKind(elements_kind.fast, obj);
- obj = newarraycase_smiobj(2);
- assertKind(elements_kind.fast, obj);
-
- function newarraycase_length_smidouble(value) {
- var a = new Array(3);
- a[0] = value;
- return a;
- }
-
- // Case: new Array(length) as allocation site
- obj = newarraycase_length_smidouble(1);
- assertKind(elements_kind.fast_smi_only, obj);
- obj = newarraycase_length_smidouble(1.5);
- assertKind(elements_kind.fast_double, obj);
- obj = newarraycase_length_smidouble(2);
- assertKind(elements_kind.fast_double, obj);
+ // Case: new Array() as allocation site, smi->fast
+ obj = newarraycase_smiobj(1);
+ assertKind(elements_kind.fast_smi_only, obj);
+ obj = newarraycase_smiobj("gloria");
+ assertKind(elements_kind.fast, obj);
+ obj = newarraycase_smiobj(2);
+ assertKind(elements_kind.fast, obj);
- // Try to continue the transition to fast object, but
- // we will not pretransition from double->fast, because
- // it may hurt performance ("poisoning").
- obj = newarraycase_length_smidouble("coates");
- assertKind(elements_kind.fast, obj);
- obj = newarraycase_length_smidouble(2.5);
- // However, because of optimistic transitions, we will
- // transition to the most general kind of elements kind found,
- // therefore I can't count on this assert yet.
- // assertKind(elements_kind.fast_double, obj);
-
- function newarraycase_length_smiobj(value) {
- var a = new Array(3);
- a[0] = value;
- return a;
- }
-
- // Case: new Array(<length>) as allocation site, smi->fast
- obj = newarraycase_length_smiobj(1);
- assertKind(elements_kind.fast_smi_only, obj);
- obj = newarraycase_length_smiobj("gloria");
- assertKind(elements_kind.fast, obj);
- obj = newarraycase_length_smiobj(2);
- assertKind(elements_kind.fast, obj);
-
- function newarraycase_list_smidouble(value) {
- var a = new Array(1, 2, 3);
- a[0] = value;
- return a;
- }
-
- obj = newarraycase_list_smidouble(1);
- assertKind(elements_kind.fast_smi_only, obj);
- obj = newarraycase_list_smidouble(1.5);
- assertKind(elements_kind.fast_double, obj);
- obj = newarraycase_list_smidouble(2);
- assertKind(elements_kind.fast_double, obj);
+ function newarraycase_length_smidouble(value) {
+ var a = new Array(3);
+ a[0] = value;
+ return a;
+ }
- function newarraycase_list_smiobj(value) {
- var a = new Array(4, 5, 6);
- a[0] = value;
- return a;
- }
+ // Case: new Array(length) as allocation site
+ obj = newarraycase_length_smidouble(1);
+ assertKind(elements_kind.fast_smi_only, obj);
+ obj = newarraycase_length_smidouble(1.5);
+ assertKind(elements_kind.fast_double, obj);
+ obj = newarraycase_length_smidouble(2);
+ assertKind(elements_kind.fast_double, obj);
- obj = newarraycase_list_smiobj(1);
- assertKind(elements_kind.fast_smi_only, obj);
- obj = newarraycase_list_smiobj("coates");
- assertKind(elements_kind.fast, obj);
- obj = newarraycase_list_smiobj(2);
- assertKind(elements_kind.fast, obj);
-
- function newarraycase_onearg(len, value) {
- var a = new Array(len);
- a[0] = value;
- return a;
- }
-
- obj = newarraycase_onearg(5, 3.5);
- assertKind(elements_kind.fast_double, obj);
- obj = newarraycase_onearg(10, 5);
- assertKind(elements_kind.fast_double, obj);
- obj = newarraycase_onearg(0, 5);
- assertKind(elements_kind.fast_double, obj);
- // Now pass a length that forces the dictionary path.
- obj = newarraycase_onearg(100000, 5);
- assertKind(elements_kind.dictionary, obj);
- assertTrue(obj.length == 100000);
-
- // Verify that cross context calls work
- var realmA = Realm.current();
- var realmB = Realm.create();
- assertEquals(0, realmA);
- assertEquals(1, realmB);
-
- function instanceof_check(type) {
- assertTrue(new type() instanceof type);
- assertTrue(new type(5) instanceof type);
- assertTrue(new type(1,2,3) instanceof type);
- }
-
- var realmBArray = Realm.eval(realmB, "Array");
- instanceof_check(Array);
- instanceof_check(realmBArray);
- %OptimizeFunctionOnNextCall(instanceof_check);
- instanceof_check(Array);
- assertTrue(2 != %GetOptimizationStatus(instanceof_check));
- instanceof_check(realmBArray);
- assertTrue(1 != %GetOptimizationStatus(instanceof_check));
+ // Try to continue the transition to fast object, but
+ // we will not pretransition from double->fast, because
+ // it may hurt performance ("poisoning").
+ obj = newarraycase_length_smidouble("coates");
+ assertKind(elements_kind.fast, obj);
+ obj = newarraycase_length_smidouble(2.5);
+ // However, because of optimistic transitions, we will
+ // transition to the most general kind of elements kind found,
+ // therefore I can't count on this assert yet.
+ // assertKind(elements_kind.fast_double, obj);
+
+ function newarraycase_length_smiobj(value) {
+ var a = new Array(3);
+ a[0] = value;
+ return a;
}
+
+ // Case: new Array(<length>) as allocation site, smi->fast
+ obj = newarraycase_length_smiobj(1);
+ assertKind(elements_kind.fast_smi_only, obj);
+ obj = newarraycase_length_smiobj("gloria");
+ assertKind(elements_kind.fast, obj);
+ obj = newarraycase_length_smiobj(2);
+ assertKind(elements_kind.fast, obj);
+
+ function newarraycase_list_smidouble(value) {
+ var a = new Array(1, 2, 3);
+ a[0] = value;
+ return a;
+ }
+
+ obj = newarraycase_list_smidouble(1);
+ assertKind(elements_kind.fast_smi_only, obj);
+ obj = newarraycase_list_smidouble(1.5);
+ assertKind(elements_kind.fast_double, obj);
+ obj = newarraycase_list_smidouble(2);
+ assertKind(elements_kind.fast_double, obj);
+
+ function newarraycase_list_smiobj(value) {
+ var a = new Array(4, 5, 6);
+ a[0] = value;
+ return a;
+ }
+
+ obj = newarraycase_list_smiobj(1);
+ assertKind(elements_kind.fast_smi_only, obj);
+ obj = newarraycase_list_smiobj("coates");
+ assertKind(elements_kind.fast, obj);
+ obj = newarraycase_list_smiobj(2);
+ assertKind(elements_kind.fast, obj);
+
+ function newarraycase_onearg(len, value) {
+ var a = new Array(len);
+ a[0] = value;
+ return a;
+ }
+
+ obj = newarraycase_onearg(5, 3.5);
+ assertKind(elements_kind.fast_double, obj);
+ obj = newarraycase_onearg(10, 5);
+ assertKind(elements_kind.fast_double, obj);
+ obj = newarraycase_onearg(0, 5);
+ assertKind(elements_kind.fast_double, obj);
+ // Now pass a length that forces the dictionary path.
+ obj = newarraycase_onearg(100000, 5);
+ assertKind(elements_kind.dictionary, obj);
+ assertTrue(obj.length == 100000);
+
+ // Verify that cross context calls work
+ var realmA = Realm.current();
+ var realmB = Realm.create();
+ assertEquals(0, realmA);
+ assertEquals(1, realmB);
+
+ function instanceof_check(type) {
+ assertTrue(new type() instanceof type);
+ assertTrue(new type(5) instanceof type);
+ assertTrue(new type(1,2,3) instanceof type);
+ }
+
+ var realmBArray = Realm.eval(realmB, "Array");
+ instanceof_check(Array);
+ instanceof_check(realmBArray);
+ %OptimizeFunctionOnNextCall(instanceof_check);
+ instanceof_check(Array);
+ assertTrue(2 != %GetOptimizationStatus(instanceof_check));
+ instanceof_check(realmBArray);
+ assertTrue(1 != %GetOptimizationStatus(instanceof_check));
}
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | test/mjsunit/array-constructor-feedback.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698