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 13903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13914 template<typename Shape, typename Key> | 13914 template<typename Shape, typename Key> |
13915 MaybeObject* HashTable<Shape, Key>::Allocate(Heap* heap, | 13915 MaybeObject* HashTable<Shape, Key>::Allocate(Heap* heap, |
13916 int at_least_space_for, | 13916 int at_least_space_for, |
13917 MinimumCapacity capacity_option, | 13917 MinimumCapacity capacity_option, |
13918 PretenureFlag pretenure) { | 13918 PretenureFlag pretenure) { |
13919 ASSERT(!capacity_option || IS_POWER_OF_TWO(at_least_space_for)); | 13919 ASSERT(!capacity_option || IS_POWER_OF_TWO(at_least_space_for)); |
13920 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) | 13920 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) |
13921 ? at_least_space_for | 13921 ? at_least_space_for |
13922 : ComputeCapacity(at_least_space_for); | 13922 : ComputeCapacity(at_least_space_for); |
13923 if (capacity > HashTable::kMaxCapacity) { | 13923 if (capacity > HashTable::kMaxCapacity) { |
13924 return Failure::OutOfMemoryException(0x10); | 13924 v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true); |
13925 } | 13925 } |
13926 | 13926 |
13927 Object* obj; | 13927 Object* obj; |
13928 { MaybeObject* maybe_obj = | 13928 { MaybeObject* maybe_obj = |
13929 heap-> AllocateHashTable(EntryToIndex(capacity), pretenure); | 13929 heap-> AllocateHashTable(EntryToIndex(capacity), pretenure); |
13930 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 13930 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
13931 } | 13931 } |
13932 HashTable::cast(obj)->SetNumberOfElements(0); | 13932 HashTable::cast(obj)->SetNumberOfElements(0); |
13933 HashTable::cast(obj)->SetNumberOfDeletedElements(0); | 13933 HashTable::cast(obj)->SetNumberOfDeletedElements(0); |
13934 HashTable::cast(obj)->SetCapacity(capacity); | 13934 HashTable::cast(obj)->SetCapacity(capacity); |
(...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16419 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16419 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16420 static const char* error_messages_[] = { | 16420 static const char* error_messages_[] = { |
16421 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16421 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16422 }; | 16422 }; |
16423 #undef ERROR_MESSAGES_TEXTS | 16423 #undef ERROR_MESSAGES_TEXTS |
16424 return error_messages_[reason]; | 16424 return error_messages_[reason]; |
16425 } | 16425 } |
16426 | 16426 |
16427 | 16427 |
16428 } } // namespace v8::internal | 16428 } } // namespace v8::internal |
OLD | NEW |