Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: src/heap/spaces-inl.h

Issue 1625753002: Allocation sampling for paged/lo spaces (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/incremental-marking.h" 8 #include "src/heap/incremental-marking.h"
9 #include "src/heap/spaces.h" 9 #include "src/heap/spaces.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 return object; 418 return object;
419 } 419 }
420 420
421 return AllocationResult::Retry(identity()); 421 return AllocationResult::Retry(identity());
422 } 422 }
423 423
424 424
425 AllocationResult PagedSpace::AllocateRaw(int size_in_bytes, 425 AllocationResult PagedSpace::AllocateRaw(int size_in_bytes,
426 AllocationAlignment alignment) { 426 AllocationAlignment alignment) {
427 #ifdef V8_HOST_ARCH_32_BIT 427 #ifdef V8_HOST_ARCH_32_BIT
428 return alignment == kDoubleAligned 428 AllocationResult result =
429 ? AllocateRawAligned(size_in_bytes, kDoubleAligned) 429 alignment == kDoubleAligned
430 : AllocateRawUnaligned(size_in_bytes); 430 ? AllocateRawAligned(size_in_bytes, kDoubleAligned)
431 : AllocateRawUnaligned(size_in_bytes);
431 #else 432 #else
432 return AllocateRawUnaligned(size_in_bytes); 433 AllocationResult result = AllocateRawUnaligned(size_in_bytes);
433 #endif 434 #endif
435 if (!result.IsRetry()) {
436 Object* obj = result.ToObjectChecked();
437 if (obj->IsHeapObject()) {
ofrobots 2016/01/23 16:16:31 Why is this check necessary here?
ofrobots 2016/01/26 00:38:25 *bump*
mattloring 2016/01/26 00:42:48 An Object can be an Smi or a HeapObject so I check
ofrobots 2016/01/26 15:47:15 We just allocated an object on the heap; so this c
438 HeapObject* heap_obj = static_cast<HeapObject*>(obj);
439 for (int i = 0; i < allocation_observers_.length(); ++i) {
440 AllocationObserver* o = allocation_observers_[i];
441 o->AllocationStep(size_in_bytes, heap_obj->address(), size_in_bytes);
442 }
443 }
444 }
445 return result;
434 } 446 }
435 447
436 448
437 // ----------------------------------------------------------------------------- 449 // -----------------------------------------------------------------------------
438 // NewSpace 450 // NewSpace
439 451
440 452
441 AllocationResult NewSpace::AllocateRawAligned(int size_in_bytes, 453 AllocationResult NewSpace::AllocateRawAligned(int size_in_bytes,
442 AllocationAlignment alignment) { 454 AllocationAlignment alignment) {
443 Address top = allocation_info_.top(); 455 Address top = allocation_info_.top();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 other->allocation_info_.Reset(nullptr, nullptr); 556 other->allocation_info_.Reset(nullptr, nullptr);
545 return true; 557 return true;
546 } 558 }
547 return false; 559 return false;
548 } 560 }
549 561
550 } // namespace internal 562 } // namespace internal
551 } // namespace v8 563 } // namespace v8
552 564
553 #endif // V8_HEAP_SPACES_INL_H_ 565 #endif // V8_HEAP_SPACES_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698