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

Unified Diff: test/mjsunit/osr-elements-kind.js

Issue 142813003: A64: Synchronize with r15358. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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/opt-elements-kind.js ('k') | test/mjsunit/parallel-initial-prototype-change.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/osr-elements-kind.js
diff --git a/test/mjsunit/array-constructor-feedback.js b/test/mjsunit/osr-elements-kind.js
similarity index 56%
copy from test/mjsunit/array-constructor-feedback.js
copy to test/mjsunit/osr-elements-kind.js
index d723121eef4ac6ea5c4410f98660a0d8deaadc6c..9b0f506b4841d9a334c54569e9a64dc1d282d5fc 100644
--- a/test/mjsunit/array-constructor-feedback.js
+++ b/test/mjsunit/osr-elements-kind.js
@@ -26,7 +26,12 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --smi-only-arrays --expose-gc
-// Flags: --track-allocation-sites --noalways-opt
+// Flags: --notrack_allocation_sites
+
+// Limit the number of stress runs to reduce polymorphism it defeats some of the
+// assumptions made about how elements transitions work because transition stubs
+// end up going generic.
+// Flags: --stress-runs=2
// Test element kind of objects.
// Since --smi-only-arrays affects builtins, its default setting at compile
@@ -35,9 +40,7 @@
// in this test case. Depending on whether smi-only arrays are actually
// enabled, this test takes the appropriate code path to check smi-only arrays.
-// support_smi_only_arrays = %HasFastSmiElements(new Array(1,2,3,4,5,6,7,8));
-support_smi_only_arrays = true;
-optimize_constructed_arrays = true;
+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.");
@@ -45,12 +48,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',
@@ -72,11 +69,35 @@ function getKind(obj) {
if (%HasFastObjectElements(obj)) return elements_kind.fast;
if (%HasFastDoubleElements(obj)) return elements_kind.fast_double;
if (%HasDictionaryElements(obj)) return elements_kind.dictionary;
-}
-
-function isHoley(obj) {
- if (%HasFastHoleyElements(obj)) return true;
- return false;
+ // Every external kind is also an external array.
+ assertTrue(%HasExternalArrayElements(obj));
+ if (%HasExternalByteElements(obj)) {
+ return elements_kind.external_byte;
+ }
+ if (%HasExternalUnsignedByteElements(obj)) {
+ return elements_kind.external_unsigned_byte;
+ }
+ if (%HasExternalShortElements(obj)) {
+ return elements_kind.external_short;
+ }
+ if (%HasExternalUnsignedShortElements(obj)) {
+ return elements_kind.external_unsigned_short;
+ }
+ if (%HasExternalIntElements(obj)) {
+ return elements_kind.external_int;
+ }
+ if (%HasExternalUnsignedIntElements(obj)) {
+ return elements_kind.external_unsigned_int;
+ }
+ if (%HasExternalFloatElements(obj)) {
+ return elements_kind.external_float;
+ }
+ if (%HasExternalDoubleElements(obj)) {
+ return elements_kind.external_double;
+ }
+ if (%HasExternalPixelElements(obj)) {
+ return elements_kind.external_pixel;
+ }
}
function assertKind(expected, obj, name_opt) {
@@ -87,20 +108,48 @@ function assertKind(expected, obj, name_opt) {
assertEquals(expected, getKind(obj), name_opt);
}
-if (support_smi_only_arrays && optimize_constructed_arrays) {
- function bar0(t) {
- return new t();
+// long-running loop forces OSR.
+for (var i = 0; i < 1000000; i++) { }
+
+if (support_smi_only_arrays) {
+ function construct_smis() {
+ try {} catch (e) {} // TODO(titzer): DisableOptimization
+ var a = [0, 0, 0];
+ a[0] = 0; // Send the COW array map to the steak house.
+ assertKind(elements_kind.fast_smi_only, a);
+ return a;
+ }
+ function construct_doubles() {
+ try {} catch (e) {} // TODO(titzer): DisableOptimization
+ var a = construct_smis();
+ a[0] = 1.5;
+ assertKind(elements_kind.fast_double, a);
+ return a;
}
- a = bar0(Array);
- a[0] = 3.5;
- b = bar0(Array);
- assertKind(elements_kind.fast_double, b);
- %OptimizeFunctionOnNextCall(bar0);
- b = bar0(Array);
- assertKind(elements_kind.fast_double, b);
- assertTrue(2 != %GetOptimizationStatus(bar0));
- // bar0 should deopt
- b = bar0(Object);
- assertTrue(1 != %GetOptimizationStatus(bar0));
+ // Test transition chain SMI->DOUBLE->FAST (crankshafted function will
+ // transition to FAST directly).
+ function convert_mixed(array, value, kind) {
+ try {} catch (e) {} // TODO(titzer): DisableOptimization
+ array[1] = value;
+ assertKind(kind, array);
+ assertEquals(value, array[1]);
+ }
+ smis = construct_smis();
+ convert_mixed(smis, 1.5, elements_kind.fast_double);
+
+ doubles = construct_doubles();
+ convert_mixed(doubles, "three", elements_kind.fast);
+
+ convert_mixed(construct_smis(), "three", elements_kind.fast);
+ convert_mixed(construct_doubles(), "three", elements_kind.fast);
+
+ smis = construct_smis();
+ doubles = construct_doubles();
+ convert_mixed(smis, 1, elements_kind.fast);
+ convert_mixed(doubles, 1, elements_kind.fast);
+ assertTrue(%HaveSameMap(smis, doubles));
}
+
+// Throw away type information in the ICs for next stress run.
+gc();
« no previous file with comments | « test/mjsunit/opt-elements-kind.js ('k') | test/mjsunit/parallel-initial-prototype-change.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698