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

Unified Diff: test/mjsunit/allocation-folding.js

Issue 19956002: Support double allocations when folding allocation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/allocation-folding.js
diff --git a/test/mjsunit/allocation-folding.js b/test/mjsunit/allocation-folding.js
index a730bf12a032b538f2f5a7870bbc3e9c594435ac..fe5fa6d855e5894c2a3f136db2c14a3a865fbe40 100644
--- a/test/mjsunit/allocation-folding.js
+++ b/test/mjsunit/allocation-folding.js
@@ -25,7 +25,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax --nouse-osr
+// Flags: --allow-natives-syntax --nouse-osr --expose-gc
+
+// Test loop barrier when folding allocations.
+
function f() {
var elem1 = [1,2,3];
for (var i=0; i < 100000; i++) {
@@ -39,8 +42,38 @@ f(); f(); f();
%OptimizeFunctionOnNextCall(f);
var result = f();
-for (var i=0; i < 100000; i++) {
- var bar = [1];
-}
+gc();
assertEquals(result[2], 3);
+
+// Test allocation folding of doubles.
+
+function doubles() {
+ var elem1 = [1.1, 1.2];
+ var elem2 = [2.1, 2.2];
+ return elem2;
+}
+
+doubles(); doubles(); doubles();
+%OptimizeFunctionOnNextCall(doubles);
+var result = doubles();
+
+gc();
+
+assertEquals(result[1], 2.2);
+
+// Test allocation folding of doubles into non-doubles.
+
+function doubles_int() {
+ var elem1 = [2, 3];
+ var elem2 = [2.1, 3.1];
+ return elem2;
+}
+
+doubles_int(); doubles_int(); doubles_int();
+%OptimizeFunctionOnNextCall(doubles_int);
+var result = doubles_int();
+
+gc();
+
+assertEquals(result[1], 3.1);
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698