Index: test/mjsunit/es6/array-iterator-turbo.js |
diff --git a/test/mjsunit/es6/array-iterator-turbo.js b/test/mjsunit/es6/array-iterator-turbo.js |
index afae0697fc7498501704c2ba359f2e30b527431a..c1b8d3207228887bf47249688ca3614ec8694923 100644 |
--- a/test/mjsunit/es6/array-iterator-turbo.js |
+++ b/test/mjsunit/es6/array-iterator-turbo.js |
@@ -5,6 +5,21 @@ |
// Flags: --turbo --turbo-escape --allow-natives-syntax |
"use strict"; |
+ |
+const kDeoptimized = 2; |
+const kTurbofanned = 7; |
+const kInterpreted = 8; |
+ |
+function GetOptimizationStatus(fn) { |
+ let status = %GetOptimizationStatus(fn); |
+ switch (status) { |
+ case kInterpreted: // Treat interpreted frames as unoptimized |
+ status = kDeoptimized; |
+ break; |
+ } |
+ |
+ return status; |
+} |
let global = this; |
let tests = { |
@@ -103,27 +118,15 @@ |
// TODO(bmeurer): FAST_HOLEY_DOUBLE_ELEMENTS maps generally deopt when |
// a hole is encountered. Test should be fixed once that is corrected. |
- let expect_deopt = /HOLEY_DOUBLE/.test(key); |
- |
- if (expect_deopt) { |
- assertUnoptimized(fn, '', key); |
- } else { |
- assertOptimized(fn, '', key); |
- } |
+ let status = /HOLEY_DOUBLE/.test(key) ? kDeoptimized : kTurbofanned; |
+ |
+ assertEquals(status, GetOptimizationStatus(fn), key); |
assertEquals(expected, fn(array), key); |
- if (expect_deopt) { |
- assertUnoptimized(fn, '', key); |
- } else { |
- assertOptimized(fn, '', key); |
- } |
- |
- // Check no deopt when another array with the same map is used |
+ assertEquals(status, GetOptimizationStatus(fn), key); |
+ |
+ // Check no deopt when another arra with the same map is used |
assertTrue(%HaveSameMap(array, array2), key); |
- if (expect_deopt) { |
- assertUnoptimized(fn, '', key); |
- } else { |
- assertOptimized(fn, '', key); |
- } |
+ assertEquals(status, GetOptimizationStatus(fn), key); |
assertEquals(expected2, fn(array2), key); |
// CheckMaps bailout |
@@ -131,7 +134,7 @@ |
[1, 2, 3], 2, { enumerable: false, configurable: false, |
get() { return 7; } }); |
fn(newArray); |
- assertUnoptimized(fn, '', key); |
+ assertEquals(kDeoptimized, GetOptimizationStatus(fn), key); |
} |
}, |
@@ -219,12 +222,12 @@ |
%OptimizeFunctionOnNextCall(sum); |
assertEquals(expected, sum(array), key); |
- assertOptimized(sum, '', key); |
+ assertEquals(kTurbofanned, GetOptimizationStatus(sum), key); |
// Not deoptimized when called on typed array of same type / map |
assertTrue(%HaveSameMap(array, array2)); |
assertEquals(expected2, sum(array2), key); |
- assertOptimized(sum, '', key); |
+ assertEquals(kTurbofanned, GetOptimizationStatus(sum), key); |
// Throw when detached |
let clone = new array.constructor(array); |