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" |
| 11 #include "src/msan.h" |
11 #include "src/v8memory.h" | 12 #include "src/v8memory.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 | 17 |
17 // ----------------------------------------------------------------------------- | 18 // ----------------------------------------------------------------------------- |
18 // Bitmap | 19 // Bitmap |
19 | 20 |
20 void Bitmap::Clear(MemoryChunk* chunk) { | 21 void Bitmap::Clear(MemoryChunk* chunk) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 object = free_list_.Allocate(size_in_bytes); | 252 object = free_list_.Allocate(size_in_bytes); |
252 if (object == NULL) { | 253 if (object == NULL) { |
253 object = SlowAllocateRaw(size_in_bytes); | 254 object = SlowAllocateRaw(size_in_bytes); |
254 } | 255 } |
255 } | 256 } |
256 | 257 |
257 if (object != NULL) { | 258 if (object != NULL) { |
258 if (identity() == CODE_SPACE) { | 259 if (identity() == CODE_SPACE) { |
259 SkipList::Update(object->address(), size_in_bytes); | 260 SkipList::Update(object->address(), size_in_bytes); |
260 } | 261 } |
| 262 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), size_in_bytes); |
261 return object; | 263 return object; |
262 } | 264 } |
263 | 265 |
264 return AllocationResult::Retry(identity()); | 266 return AllocationResult::Retry(identity()); |
265 } | 267 } |
266 | 268 |
267 | 269 |
268 // ----------------------------------------------------------------------------- | 270 // ----------------------------------------------------------------------------- |
269 // NewSpace | 271 // NewSpace |
270 | 272 |
271 | 273 |
272 AllocationResult NewSpace::AllocateRaw(int size_in_bytes) { | 274 AllocationResult NewSpace::AllocateRaw(int size_in_bytes) { |
273 Address old_top = allocation_info_.top(); | 275 Address old_top = allocation_info_.top(); |
274 | 276 |
275 if (allocation_info_.limit() - old_top < size_in_bytes) { | 277 if (allocation_info_.limit() - old_top < size_in_bytes) { |
276 return SlowAllocateRaw(size_in_bytes); | 278 return SlowAllocateRaw(size_in_bytes); |
277 } | 279 } |
278 | 280 |
279 HeapObject* obj = HeapObject::FromAddress(old_top); | 281 HeapObject* obj = HeapObject::FromAddress(old_top); |
280 allocation_info_.set_top(allocation_info_.top() + size_in_bytes); | 282 allocation_info_.set_top(allocation_info_.top() + size_in_bytes); |
281 DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); | 283 DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); |
282 | 284 |
| 285 // The slow path above ultimately goes through AllocateRaw, so this suffices. |
| 286 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(obj->address(), size_in_bytes); |
| 287 |
283 return obj; | 288 return obj; |
284 } | 289 } |
285 | 290 |
286 | 291 |
287 LargePage* LargePage::Initialize(Heap* heap, MemoryChunk* chunk) { | 292 LargePage* LargePage::Initialize(Heap* heap, MemoryChunk* chunk) { |
288 heap->incremental_marking()->SetOldSpacePageFlags(chunk); | 293 heap->incremental_marking()->SetOldSpacePageFlags(chunk); |
289 return static_cast<LargePage*>(chunk); | 294 return static_cast<LargePage*>(chunk); |
290 } | 295 } |
291 | 296 |
292 | 297 |
293 intptr_t LargeObjectSpace::Available() { | 298 intptr_t LargeObjectSpace::Available() { |
294 return ObjectSizeFor(heap()->isolate()->memory_allocator()->Available()); | 299 return ObjectSizeFor(heap()->isolate()->memory_allocator()->Available()); |
295 } | 300 } |
296 | 301 |
297 | 302 |
298 bool FreeListNode::IsFreeListNode(HeapObject* object) { | 303 bool FreeListNode::IsFreeListNode(HeapObject* object) { |
299 Map* map = object->map(); | 304 Map* map = object->map(); |
300 Heap* heap = object->GetHeap(); | 305 Heap* heap = object->GetHeap(); |
301 return map == heap->raw_unchecked_free_space_map() || | 306 return map == heap->raw_unchecked_free_space_map() || |
302 map == heap->raw_unchecked_one_pointer_filler_map() || | 307 map == heap->raw_unchecked_one_pointer_filler_map() || |
303 map == heap->raw_unchecked_two_pointer_filler_map(); | 308 map == heap->raw_unchecked_two_pointer_filler_map(); |
304 } | 309 } |
305 } | 310 } |
306 } // namespace v8::internal | 311 } // namespace v8::internal |
307 | 312 |
308 #endif // V8_HEAP_SPACES_INL_H_ | 313 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |