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

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

Issue 1883933003: [heap] Optimize NewSpace::AllocatedSinceLastGC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix offset computation Created 4 years, 8 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
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_HEAP_INL_H_ 5 #ifndef V8_HEAP_HEAP_INL_H_
6 #define V8_HEAP_HEAP_INL_H_ 6 #define V8_HEAP_HEAP_INL_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 } 442 }
443 UNREACHABLE(); 443 UNREACHABLE();
444 return false; 444 return false;
445 } 445 }
446 446
447 void Heap::CopyBlock(Address dst, Address src, int byte_size) { 447 void Heap::CopyBlock(Address dst, Address src, int byte_size) {
448 CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src), 448 CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src),
449 static_cast<size_t>(byte_size / kPointerSize)); 449 static_cast<size_t>(byte_size / kPointerSize));
450 } 450 }
451 451
452 void Heap::UpdateNewSpaceAllocationCounter() {
453 new_space_allocation_counter_ = NewSpaceAllocationCounter();
454 }
455
456 size_t Heap::NewSpaceAllocationCounter() {
457 return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC();
458 }
459
452 template <Heap::FindMementoMode mode> 460 template <Heap::FindMementoMode mode>
453 AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) { 461 AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) {
454 // Check if there is potentially a memento behind the object. If 462 // Check if there is potentially a memento behind the object. If
455 // the last word of the memento is on another page we return 463 // the last word of the memento is on another page we return
456 // immediately. 464 // immediately.
457 Address object_address = object->address(); 465 Address object_address = object->address();
458 Address memento_address = object_address + object->Size(); 466 Address memento_address = object_address + object->Size();
459 Address last_memento_word_address = memento_address + kPointerSize; 467 Address last_memento_word_address = memento_address + kPointerSize;
460 if (!NewSpacePage::OnSamePage(object_address, last_memento_word_address)) { 468 if (!NewSpacePage::OnSamePage(object_address, last_memento_word_address)) {
461 return nullptr; 469 return nullptr;
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 731
724 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { 732 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) {
725 for (Object** current = start; current < end; current++) { 733 for (Object** current = start; current < end; current++) {
726 CHECK((*current)->IsSmi()); 734 CHECK((*current)->IsSmi());
727 } 735 }
728 } 736 }
729 } // namespace internal 737 } // namespace internal
730 } // namespace v8 738 } // namespace v8
731 739
732 #endif // V8_HEAP_HEAP_INL_H_ 740 #endif // V8_HEAP_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698