| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_SPACES_INL_H_ | 5 #ifndef V8_SPACES_INL_H_ |
| 6 #define V8_SPACES_INL_H_ | 6 #define V8_SPACES_INL_H_ |
| 7 | 7 |
| 8 #include "src/heap-profiler.h" | 8 #include "src/heap-profiler.h" |
| 9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
| 10 #include "src/spaces.h" | 10 #include "src/spaces.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 if (new_top > allocation_info_.limit()) return NULL; | 246 if (new_top > allocation_info_.limit()) return NULL; |
| 247 | 247 |
| 248 allocation_info_.set_top(new_top); | 248 allocation_info_.set_top(new_top); |
| 249 return HeapObject::FromAddress(current_top); | 249 return HeapObject::FromAddress(current_top); |
| 250 } | 250 } |
| 251 | 251 |
| 252 | 252 |
| 253 // Raw allocation. | 253 // Raw allocation. |
| 254 AllocationResult PagedSpace::AllocateRaw(int size_in_bytes) { | 254 AllocationResult PagedSpace::AllocateRaw(int size_in_bytes) { |
| 255 HeapObject* object = AllocateLinearly(size_in_bytes); | 255 HeapObject* object = AllocateLinearly(size_in_bytes); |
| 256 |
| 257 if (object == NULL) { |
| 258 object = free_list_.Allocate(size_in_bytes); |
| 259 if (object == NULL) { |
| 260 object = SlowAllocateRaw(size_in_bytes); |
| 261 } |
| 262 } |
| 263 |
| 256 if (object != NULL) { | 264 if (object != NULL) { |
| 257 if (identity() == CODE_SPACE) { | 265 if (identity() == CODE_SPACE) { |
| 258 SkipList::Update(object->address(), size_in_bytes); | 266 SkipList::Update(object->address(), size_in_bytes); |
| 259 } | |
| 260 return object; | |
| 261 } | |
| 262 | |
| 263 ASSERT(!heap()->linear_allocation() || | |
| 264 (anchor_.next_chunk() == &anchor_ && | |
| 265 anchor_.prev_chunk() == &anchor_)); | |
| 266 | |
| 267 object = free_list_.Allocate(size_in_bytes); | |
| 268 if (object != NULL) { | |
| 269 if (identity() == CODE_SPACE) { | |
| 270 SkipList::Update(object->address(), size_in_bytes); | |
| 271 } | |
| 272 return object; | |
| 273 } | |
| 274 | |
| 275 object = SlowAllocateRaw(size_in_bytes); | |
| 276 if (object != NULL) { | |
| 277 if (identity() == CODE_SPACE) { | |
| 278 SkipList::Update(object->address(), size_in_bytes); | |
| 279 } | 267 } |
| 280 return object; | 268 return object; |
| 281 } | 269 } |
| 282 | 270 |
| 283 return AllocationResult::Retry(identity()); | 271 return AllocationResult::Retry(identity()); |
| 284 } | 272 } |
| 285 | 273 |
| 286 | 274 |
| 287 // ----------------------------------------------------------------------------- | 275 // ----------------------------------------------------------------------------- |
| 288 // NewSpace | 276 // NewSpace |
| (...skipping 29 matching lines...) Expand all Loading... |
| 318 Map* map = object->map(); | 306 Map* map = object->map(); |
| 319 Heap* heap = object->GetHeap(); | 307 Heap* heap = object->GetHeap(); |
| 320 return map == heap->raw_unchecked_free_space_map() | 308 return map == heap->raw_unchecked_free_space_map() |
| 321 || map == heap->raw_unchecked_one_pointer_filler_map() | 309 || map == heap->raw_unchecked_one_pointer_filler_map() |
| 322 || map == heap->raw_unchecked_two_pointer_filler_map(); | 310 || map == heap->raw_unchecked_two_pointer_filler_map(); |
| 323 } | 311 } |
| 324 | 312 |
| 325 } } // namespace v8::internal | 313 } } // namespace v8::internal |
| 326 | 314 |
| 327 #endif // V8_SPACES_INL_H_ | 315 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |