| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 reinterpret_cast<PreallocatedStorage*>(new char[size]); | 249 reinterpret_cast<PreallocatedStorage*>(new char[size]); |
| 250 free_list_.next_ = free_list_.previous_ = free_chunk; | 250 free_list_.next_ = free_list_.previous_ = free_chunk; |
| 251 free_chunk->next_ = free_chunk->previous_ = &free_list_; | 251 free_chunk->next_ = free_chunk->previous_ = &free_list_; |
| 252 free_chunk->size_ = size - sizeof(PreallocatedStorage); | 252 free_chunk->size_ = size - sizeof(PreallocatedStorage); |
| 253 preallocated_storage_preallocated_ = true; | 253 preallocated_storage_preallocated_ = true; |
| 254 } | 254 } |
| 255 | 255 |
| 256 | 256 |
| 257 void* Isolate::PreallocatedStorageNew(size_t size) { | 257 void* Isolate::PreallocatedStorageNew(size_t size) { |
| 258 if (!preallocated_storage_preallocated_) { | 258 if (!preallocated_storage_preallocated_) { |
| 259 return FreeStoreAllocationPolicy::New(size); | 259 return FreeStoreAllocator().New(size); |
| 260 } | 260 } |
| 261 ASSERT(free_list_.next_ != &free_list_); | 261 ASSERT(free_list_.next_ != &free_list_); |
| 262 ASSERT(free_list_.previous_ != &free_list_); | 262 ASSERT(free_list_.previous_ != &free_list_); |
| 263 | 263 |
| 264 size = (size + kPointerSize - 1) & ~(kPointerSize - 1); | 264 size = (size + kPointerSize - 1) & ~(kPointerSize - 1); |
| 265 // Search for exact fit. | 265 // Search for exact fit. |
| 266 for (PreallocatedStorage* storage = free_list_.next_; | 266 for (PreallocatedStorage* storage = free_list_.next_; |
| 267 storage != &free_list_; | 267 storage != &free_list_; |
| 268 storage = storage->next_) { | 268 storage = storage->next_) { |
| 269 if (storage->size_ == size) { | 269 if (storage->size_ == size) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 295 return NULL; | 295 return NULL; |
| 296 } | 296 } |
| 297 | 297 |
| 298 | 298 |
| 299 // We don't attempt to coalesce. | 299 // We don't attempt to coalesce. |
| 300 void Isolate::PreallocatedStorageDelete(void* p) { | 300 void Isolate::PreallocatedStorageDelete(void* p) { |
| 301 if (p == NULL) { | 301 if (p == NULL) { |
| 302 return; | 302 return; |
| 303 } | 303 } |
| 304 if (!preallocated_storage_preallocated_) { | 304 if (!preallocated_storage_preallocated_) { |
| 305 FreeStoreAllocationPolicy::Delete(p); | 305 FreeStoreDeallocator().Delete(p); |
| 306 return; | 306 return; |
| 307 } | 307 } |
| 308 PreallocatedStorage* storage = reinterpret_cast<PreallocatedStorage*>(p) - 1; | 308 PreallocatedStorage* storage = reinterpret_cast<PreallocatedStorage*>(p) - 1; |
| 309 ASSERT(storage->next_->previous_ == storage); | 309 ASSERT(storage->next_->previous_ == storage); |
| 310 ASSERT(storage->previous_->next_ == storage); | 310 ASSERT(storage->previous_->next_ == storage); |
| 311 storage->Unlink(); | 311 storage->Unlink(); |
| 312 storage->LinkTo(&free_list_); | 312 storage->LinkTo(&free_list_); |
| 313 } | 313 } |
| 314 | 314 |
| 315 Isolate* Isolate::default_isolate_ = NULL; | 315 Isolate* Isolate::default_isolate_ = NULL; |
| (...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 | 1951 |
| 1952 #ifdef DEBUG | 1952 #ifdef DEBUG |
| 1953 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 1953 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 1954 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 1954 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 1955 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 1955 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 1956 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 1956 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 1957 #undef ISOLATE_FIELD_OFFSET | 1957 #undef ISOLATE_FIELD_OFFSET |
| 1958 #endif | 1958 #endif |
| 1959 | 1959 |
| 1960 } } // namespace v8::internal | 1960 } } // namespace v8::internal |
| OLD | NEW |