| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 13918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13929 template<typename Shape, typename Key> | 13929 template<typename Shape, typename Key> |
| 13930 MaybeObject* HashTable<Shape, Key>::Allocate(Heap* heap, | 13930 MaybeObject* HashTable<Shape, Key>::Allocate(Heap* heap, |
| 13931 int at_least_space_for, | 13931 int at_least_space_for, |
| 13932 MinimumCapacity capacity_option, | 13932 MinimumCapacity capacity_option, |
| 13933 PretenureFlag pretenure) { | 13933 PretenureFlag pretenure) { |
| 13934 ASSERT(!capacity_option || IS_POWER_OF_TWO(at_least_space_for)); | 13934 ASSERT(!capacity_option || IS_POWER_OF_TWO(at_least_space_for)); |
| 13935 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) | 13935 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) |
| 13936 ? at_least_space_for | 13936 ? at_least_space_for |
| 13937 : ComputeCapacity(at_least_space_for); | 13937 : ComputeCapacity(at_least_space_for); |
| 13938 if (capacity > HashTable::kMaxCapacity) { | 13938 if (capacity > HashTable::kMaxCapacity) { |
| 13939 return Failure::OutOfMemoryException(0x10); | 13939 v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true); |
| 13940 } | 13940 } |
| 13941 | 13941 |
| 13942 Object* obj; | 13942 Object* obj; |
| 13943 { MaybeObject* maybe_obj = | 13943 { MaybeObject* maybe_obj = |
| 13944 heap-> AllocateHashTable(EntryToIndex(capacity), pretenure); | 13944 heap-> AllocateHashTable(EntryToIndex(capacity), pretenure); |
| 13945 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 13945 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 13946 } | 13946 } |
| 13947 HashTable::cast(obj)->SetNumberOfElements(0); | 13947 HashTable::cast(obj)->SetNumberOfElements(0); |
| 13948 HashTable::cast(obj)->SetNumberOfDeletedElements(0); | 13948 HashTable::cast(obj)->SetNumberOfDeletedElements(0); |
| 13949 HashTable::cast(obj)->SetCapacity(capacity); | 13949 HashTable::cast(obj)->SetCapacity(capacity); |
| (...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16434 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16434 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16435 static const char* error_messages_[] = { | 16435 static const char* error_messages_[] = { |
| 16436 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16436 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16437 }; | 16437 }; |
| 16438 #undef ERROR_MESSAGES_TEXTS | 16438 #undef ERROR_MESSAGES_TEXTS |
| 16439 return error_messages_[reason]; | 16439 return error_messages_[reason]; |
| 16440 } | 16440 } |
| 16441 | 16441 |
| 16442 | 16442 |
| 16443 } } // namespace v8::internal | 16443 } } // namespace v8::internal |
| OLD | NEW |