| Index: src/objects.cc
|
| ===================================================================
|
| --- src/objects.cc (revision 3610)
|
| +++ src/objects.cc (working copy)
|
| @@ -6931,10 +6931,14 @@
|
|
|
|
|
| template<typename Shape, typename Key>
|
| -Object* HashTable<Shape, Key>::Allocate(
|
| - int at_least_space_for) {
|
| +Object* HashTable<Shape, Key>::Allocate(int at_least_space_for) {
|
| int capacity = RoundUpToPowerOf2(at_least_space_for);
|
| - if (capacity < 4) capacity = 4; // Guarantee min capacity.
|
| + if (capacity < 4) {
|
| + capacity = 4; // Guarantee min capacity.
|
| + } else if (capacity > HashTable::kMaxCapacity) {
|
| + return Failure::OutOfMemoryException();
|
| + }
|
| +
|
| Object* obj = Heap::AllocateHashTable(EntryToIndex(capacity));
|
| if (!obj->IsFailure()) {
|
| HashTable::cast(obj)->SetNumberOfElements(0);
|
|
|