| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 reinterpret_cast<PreallocatedStorage*>(new char[size]); | 236 reinterpret_cast<PreallocatedStorage*>(new char[size]); |
| 237 free_list_.next_ = free_list_.previous_ = free_chunk; | 237 free_list_.next_ = free_list_.previous_ = free_chunk; |
| 238 free_chunk->next_ = free_chunk->previous_ = &free_list_; | 238 free_chunk->next_ = free_chunk->previous_ = &free_list_; |
| 239 free_chunk->size_ = size - sizeof(PreallocatedStorage); | 239 free_chunk->size_ = size - sizeof(PreallocatedStorage); |
| 240 preallocated_storage_preallocated_ = true; | 240 preallocated_storage_preallocated_ = true; |
| 241 } | 241 } |
| 242 | 242 |
| 243 | 243 |
| 244 void* Isolate::PreallocatedStorageNew(size_t size) { | 244 void* Isolate::PreallocatedStorageNew(size_t size) { |
| 245 if (!preallocated_storage_preallocated_) { | 245 if (!preallocated_storage_preallocated_) { |
| 246 return FreeStoreAllocationPolicy::New(size); | 246 return FreeStoreAllocator().New(size); |
| 247 } | 247 } |
| 248 ASSERT(free_list_.next_ != &free_list_); | 248 ASSERT(free_list_.next_ != &free_list_); |
| 249 ASSERT(free_list_.previous_ != &free_list_); | 249 ASSERT(free_list_.previous_ != &free_list_); |
| 250 | 250 |
| 251 size = (size + kPointerSize - 1) & ~(kPointerSize - 1); | 251 size = (size + kPointerSize - 1) & ~(kPointerSize - 1); |
| 252 // Search for exact fit. | 252 // Search for exact fit. |
| 253 for (PreallocatedStorage* storage = free_list_.next_; | 253 for (PreallocatedStorage* storage = free_list_.next_; |
| 254 storage != &free_list_; | 254 storage != &free_list_; |
| 255 storage = storage->next_) { | 255 storage = storage->next_) { |
| 256 if (storage->size_ == size) { | 256 if (storage->size_ == size) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 282 return NULL; | 282 return NULL; |
| 283 } | 283 } |
| 284 | 284 |
| 285 | 285 |
| 286 // We don't attempt to coalesce. | 286 // We don't attempt to coalesce. |
| 287 void Isolate::PreallocatedStorageDelete(void* p) { | 287 void Isolate::PreallocatedStorageDelete(void* p) { |
| 288 if (p == NULL) { | 288 if (p == NULL) { |
| 289 return; | 289 return; |
| 290 } | 290 } |
| 291 if (!preallocated_storage_preallocated_) { | 291 if (!preallocated_storage_preallocated_) { |
| 292 FreeStoreAllocationPolicy::Delete(p); | 292 FreeStoreAllocator().Delete(p); |
| 293 return; | 293 return; |
| 294 } | 294 } |
| 295 PreallocatedStorage* storage = reinterpret_cast<PreallocatedStorage*>(p) - 1; | 295 PreallocatedStorage* storage = reinterpret_cast<PreallocatedStorage*>(p) - 1; |
| 296 ASSERT(storage->next_->previous_ == storage); | 296 ASSERT(storage->next_->previous_ == storage); |
| 297 ASSERT(storage->previous_->next_ == storage); | 297 ASSERT(storage->previous_->next_ == storage); |
| 298 storage->Unlink(); | 298 storage->Unlink(); |
| 299 storage->LinkTo(&free_list_); | 299 storage->LinkTo(&free_list_); |
| 300 } | 300 } |
| 301 | 301 |
| 302 | 302 |
| (...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 | 1848 |
| 1849 #ifdef DEBUG | 1849 #ifdef DEBUG |
| 1850 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 1850 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 1851 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 1851 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 1852 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 1852 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 1853 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 1853 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 1854 #undef ISOLATE_FIELD_OFFSET | 1854 #undef ISOLATE_FIELD_OFFSET |
| 1855 #endif | 1855 #endif |
| 1856 | 1856 |
| 1857 } } // namespace v8::internal | 1857 } } // namespace v8::internal |
| OLD | NEW |