OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3188 reinterpret_cast<FixedArray*>(result)->set_map(fixed_array_map()); | 3188 reinterpret_cast<FixedArray*>(result)->set_map(fixed_array_map()); |
3189 reinterpret_cast<FixedArray*>(result)->set_length(0); | 3189 reinterpret_cast<FixedArray*>(result)->set_length(0); |
3190 return result; | 3190 return result; |
3191 } | 3191 } |
3192 | 3192 |
3193 | 3193 |
3194 Object* Heap::AllocateRawFixedArray(int length) { | 3194 Object* Heap::AllocateRawFixedArray(int length) { |
3195 if (length < 0 || length > FixedArray::kMaxLength) { | 3195 if (length < 0 || length > FixedArray::kMaxLength) { |
3196 return Failure::OutOfMemoryException(); | 3196 return Failure::OutOfMemoryException(); |
3197 } | 3197 } |
| 3198 ASSERT(length > 0); |
3198 // Use the general function if we're forced to always allocate. | 3199 // Use the general function if we're forced to always allocate. |
3199 if (always_allocate()) return AllocateFixedArray(length, TENURED); | 3200 if (always_allocate()) return AllocateFixedArray(length, TENURED); |
3200 // Allocate the raw data for a fixed array. | 3201 // Allocate the raw data for a fixed array. |
3201 int size = FixedArray::SizeFor(length); | 3202 int size = FixedArray::SizeFor(length); |
3202 return size <= kMaxObjectSizeInNewSpace | 3203 return size <= kMaxObjectSizeInNewSpace |
3203 ? new_space_.AllocateRaw(size) | 3204 ? new_space_.AllocateRaw(size) |
3204 : lo_space_->AllocateRawFixedArray(size); | 3205 : lo_space_->AllocateRawFixedArray(size); |
3205 } | 3206 } |
3206 | 3207 |
3207 | 3208 |
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4968 void ExternalStringTable::TearDown() { | 4969 void ExternalStringTable::TearDown() { |
4969 new_space_strings_.Free(); | 4970 new_space_strings_.Free(); |
4970 old_space_strings_.Free(); | 4971 old_space_strings_.Free(); |
4971 } | 4972 } |
4972 | 4973 |
4973 | 4974 |
4974 List<Object*> ExternalStringTable::new_space_strings_; | 4975 List<Object*> ExternalStringTable::new_space_strings_; |
4975 List<Object*> ExternalStringTable::old_space_strings_; | 4976 List<Object*> ExternalStringTable::old_space_strings_; |
4976 | 4977 |
4977 } } // namespace v8::internal | 4978 } } // namespace v8::internal |
OLD | NEW |