Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 939cd92605191d70782d882765df9e7e56d7fdcd..c9d074f1111244ba7babb3a56c7b891f68c1bd0e 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -3504,6 +3504,11 @@ HAllocate* HGraphBuilder::JSArrayBuilder::AllocateArray( |
HValue* elements_size = |
builder()->BuildCalculateElementsSize(kind_, capacity); |
+ // Bail out for large objects. |
+ HValue* max_regular_heap_object_size = |
+ builder()->Add<HConstant>(Page::kMaxRegularHeapObjectSize); |
+ builder()->Add<HBoundsCheck>(elements_size, max_regular_heap_object_size); |
+ |
// Allocate (dealing with failure appropriately) |
HAllocate* array_object = builder()->AllocateJSArrayObject(mode_); |