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

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

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 7 years, 8 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
Index: test/mjsunit/allocation-site-info.js
diff --git a/test/mjsunit/allocation-site-info.js b/test/mjsunit/allocation-site-info.js
index 4d534e30369bfe468613241ee3a58050f88df12e..0baeff64ead6cd542d438fa644e01027e1395a72 100644
--- a/test/mjsunit/allocation-site-info.js
+++ b/test/mjsunit/allocation-site-info.js
@@ -26,7 +26,7 @@
// 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 --nooptimize-constructed-arrays
+// Flags: --track-allocation-sites --noalways-opt
// TODO(mvstanton): remove --nooptimize-constructed-arrays and enable
// the constructed array code below when the feature is turned on
@@ -39,8 +39,9 @@
// 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));
-optimize_constructed_arrays = false;
+// 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.");
@@ -148,12 +149,17 @@ if (support_smi_only_arrays) {
// sites work again for fast literals
//assertKind(elements_kind.fast_double, obj);
- obj = fastliteralcase([5, 3, 2], 1.5);
- assertKind(elements_kind.fast_double, obj);
- obj = fastliteralcase([3, 6, 2], 1.5);
- assertKind(elements_kind.fast_double, obj);
- obj = fastliteralcase([2, 6, 3], 2);
- assertKind(elements_kind.fast_smi_only, obj);
+ // The test below is in a loop because arrays that live
+ // at global scope without the chance of being recreated
+ // don't have allocation site information attached.
+ for (i = 0; i < 2; i++) {
+ obj = fastliteralcase([5, 3, 2], 1.5);
+ assertKind(elements_kind.fast_double, obj);
+ obj = fastliteralcase([3, 6, 2], 1.5);
+ assertKind(elements_kind.fast_double, obj);
+ obj = fastliteralcase([2, 6, 3], 2);
+ assertKind(elements_kind.fast_smi_only, obj);
+ }
// Verify that we will not pretransition the double->fast path.
obj = fastliteralcase(get_standard_literal(), "elliot");
@@ -164,6 +170,12 @@ if (support_smi_only_arrays) {
// obj = fastliteralcase(3);
// assertKind(elements_kind.fast_double, obj);
+ // Make sure this works in crankshafted code too.
+ %OptimizeFunctionOnNextCall(get_standard_literal);
+ get_standard_literal();
+ obj = get_standard_literal();
+ assertKind(elements_kind.fast_double, obj);
+
function fastliteralcase_smifast(value) {
var literal = [1, 2, 3, 4];
literal[0] = value;

Powered by Google App Engine
This is Rietveld 408576698