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_HEAP_SPACES_INL_H_ | 5 #ifndef V8_HEAP_SPACES_INL_H_ |
6 #define V8_HEAP_SPACES_INL_H_ | 6 #define V8_HEAP_SPACES_INL_H_ |
7 | 7 |
8 #include "src/heap/spaces.h" | 8 #include "src/heap/spaces.h" |
9 #include "src/heap-profiler.h" | 9 #include "src/heap-profiler.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // allocated, so assume the worst case. | 304 // allocated, so assume the worst case. |
305 int filler_size = Heap::GetMaximumFillToAlign(alignment); | 305 int filler_size = Heap::GetMaximumFillToAlign(alignment); |
306 allocation_size += filler_size; | 306 allocation_size += filler_size; |
307 object = free_list_.Allocate(allocation_size); | 307 object = free_list_.Allocate(allocation_size); |
308 if (object == NULL) { | 308 if (object == NULL) { |
309 object = SlowAllocateRaw(allocation_size); | 309 object = SlowAllocateRaw(allocation_size); |
310 } | 310 } |
311 if (object != NULL && filler_size != 0) { | 311 if (object != NULL && filler_size != 0) { |
312 object = heap()->AlignWithFiller(object, size_in_bytes, allocation_size, | 312 object = heap()->AlignWithFiller(object, size_in_bytes, allocation_size, |
313 alignment); | 313 alignment); |
| 314 // Filler objects are initialized, so mark only the aligned object memory |
| 315 // as uninitialized. |
| 316 allocation_size = size_in_bytes; |
314 } | 317 } |
315 } | 318 } |
316 | 319 |
317 if (object != NULL) { | 320 if (object != NULL) { |
318 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), allocation_size); | 321 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), allocation_size); |
319 return object; | 322 return object; |
320 } | 323 } |
321 | 324 |
322 return AllocationResult::Retry(identity()); | 325 return AllocationResult::Retry(identity()); |
323 } | 326 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 404 |
402 | 405 |
403 intptr_t LargeObjectSpace::Available() { | 406 intptr_t LargeObjectSpace::Available() { |
404 return ObjectSizeFor(heap()->isolate()->memory_allocator()->Available()); | 407 return ObjectSizeFor(heap()->isolate()->memory_allocator()->Available()); |
405 } | 408 } |
406 | 409 |
407 } | 410 } |
408 } // namespace v8::internal | 411 } // namespace v8::internal |
409 | 412 |
410 #endif // V8_HEAP_SPACES_INL_H_ | 413 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |