Reviewers: Igor Sheludko,

Description:
Fix bogus allocation limit in allocation folding.

[email protected]
TEST=mjsunit/allocation-folding

Please review this at https://codereview.chromium.org/73563004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+15, -1 lines):
  M src/hydrogen-instructions.cc
  M test/mjsunit/allocation-folding.js


Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index f7a9569ed612a6b4c88d5e4b5de820567bc39e80..38eabdae06aa5d9968d1479e050e883ff7b707f2 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -3404,7 +3404,7 @@ void HAllocate::HandleSideEffectDominator(GVNFlag side_effect,
     }
   }

-  if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) {
+ if (new_dominator_size > isolate()->heap()->MaxRegularSpaceAllocationSize()) {
     if (FLAG_trace_allocation_folding) {
       PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n",
           id(), Mnemonic(), dominator_allocate->id(),
Index: test/mjsunit/allocation-folding.js
diff --git a/test/mjsunit/allocation-folding.js b/test/mjsunit/allocation-folding.js index ec07392f2c223687f3e6c4bcd6d0df8cabde59f4..a914b59ec9e27cec96aae34801ecb986c5a01c9e 100644
--- a/test/mjsunit/allocation-folding.js
+++ b/test/mjsunit/allocation-folding.js
@@ -100,3 +100,17 @@ gc();

 assertEquals(result[1], 4);
 assertEquals(result2[1], 6);
+
+// Test to exceed the Heap::MaxRegularSpaceAllocationSize limit but not
+// the Page::kMaxNonCodeHeapObjectSize limit with allocation folding.
+
+function boom() {
+  var a1 = new Array(84632);
+  var a2 = new Array(84632);
+  var a3 = new Array(84632);
+  return [ a1, a2, a3 ];
+}
+
+boom(); boom(); boom();
+%OptimizeFunctionOnNextCall(boom);
+boom();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to