From 2b4bfce29860a6c7e337fd37ece37708995ef9f3 Mon Sep 17 00:00:00 2001 From: "jarin@chromium.org" Date: Tue, 13 May 2014 10:31:53 +0000 Subject: [PATCH] Prevent interference of allocation sites with array-natives-elements test. This should make the arm64 build green again. R=mvstanton@chromium.org BUG= Review URL: https://codereview.chromium.org/285663005 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21288 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- test/mjsunit/array-natives-elements.js | 45 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/test/mjsunit/array-natives-elements.js b/test/mjsunit/array-natives-elements.js index cf848bb..f64818d 100644 --- a/test/mjsunit/array-natives-elements.js +++ b/test/mjsunit/array-natives-elements.js @@ -54,29 +54,30 @@ function array_natives_test() { assertTrue(%HasFastDoubleElements([1.1])); assertTrue(%HasFastDoubleElements([1.1,2])); - // Push - var a0 = [1, 2, 3]; - if (%HasFastSmiElements(a0)) { - assertTrue(%HasFastSmiElements(a0)); - a0.push(4); - assertTrue(%HasFastSmiElements(a0)); - a0.push(1.3); - assertTrue(%HasFastDoubleElements(a0)); - a0.push(1.5); - assertTrue(%HasFastDoubleElements(a0)); - a0.push({}); - assertTrue(%HasFastObjectElements(a0)); - a0.push({}); - assertTrue(%HasFastObjectElements(a0)); - } else { - assertTrue(%HasFastObjectElements(a0)); - a0.push(4); - a0.push(1.3); - a0.push(1.5); - a0.push({}); - a0.push({}); - assertTrue(%HasFastObjectElements(a0)); + // This code exists to eliminate the learning influence of AllocationSites + // on the following tests. + var __sequence = 0; + function make_array_string(literal) { + this.__sequence = this.__sequence + 1; + return "/* " + this.__sequence + " */ " + literal; + } + function make_array(literal) { + return eval(make_array_string(literal)); } + + // Push + var a0 = make_array("[1, 2, 3]"); + assertTrue(%HasFastSmiElements(a0)); + a0.push(4); + assertTrue(%HasFastSmiElements(a0)); + a0.push(1.3); + assertTrue(%HasFastDoubleElements(a0)); + a0.push(1.5); + assertTrue(%HasFastDoubleElements(a0)); + a0.push({}); + assertTrue(%HasFastObjectElements(a0)); + a0.push({}); + assertTrue(%HasFastObjectElements(a0)); assertEquals([1,2,3,4,1.3,1.5,{},{}], a0); // Concat -- 2.7.4