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

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

Issue 1932883002: Revert "[heap] Optimize NewSpace::AllocatedSinceLastGC" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/spaces.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return to_space_.ContainsSlow(a); 235 return to_space_.ContainsSlow(a);
236 } 236 }
237 237
238 bool NewSpace::FromSpaceContainsSlow(Address a) { 238 bool NewSpace::FromSpaceContainsSlow(Address a) {
239 return from_space_.ContainsSlow(a); 239 return from_space_.ContainsSlow(a);
240 } 240 }
241 241
242 bool NewSpace::ToSpaceContains(Object* o) { return to_space_.Contains(o); } 242 bool NewSpace::ToSpaceContains(Object* o) { return to_space_.Contains(o); }
243 bool NewSpace::FromSpaceContains(Object* o) { return from_space_.Contains(o); } 243 bool NewSpace::FromSpaceContains(Object* o) { return from_space_.Contains(o); }
244 244
245 size_t NewSpace::AllocatedSinceLastGC() {
246 const intptr_t age_mark_offset = Page::OffsetInPage(to_space_.age_mark());
247 const intptr_t top_offset = Page::OffsetInPage(allocation_info_.top());
248 const intptr_t age_mark_delta =
249 age_mark_offset >= Page::kObjectStartOffset
250 ? age_mark_offset - Page::kObjectStartOffset
251 : Page::kAllocatableMemory;
252 const intptr_t top_delta = top_offset >= Page::kObjectStartOffset
253 ? top_offset - Page::kObjectStartOffset
254 : Page::kAllocatableMemory;
255 DCHECK((allocated_since_last_gc_ > 0) ||
256 (Page::FromAllocationAreaAddress(allocation_info_.top()) ==
257 Page::FromAllocationAreaAddress(to_space_.age_mark())));
258 return static_cast<size_t>(allocated_since_last_gc_ + top_delta -
259 age_mark_delta);
260 }
261
262 // -------------------------------------------------------------------------- 245 // --------------------------------------------------------------------------
263 // AllocationResult 246 // AllocationResult
264 247
265 AllocationSpace AllocationResult::RetrySpace() { 248 AllocationSpace AllocationResult::RetrySpace() {
266 DCHECK(IsRetry()); 249 DCHECK(IsRetry());
267 return static_cast<AllocationSpace>(Smi::cast(object_)->value()); 250 return static_cast<AllocationSpace>(Smi::cast(object_)->value());
268 } 251 }
269 252
270 Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, 253 Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable,
271 SemiSpace* owner) { 254 SemiSpace* owner) {
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 other->allocation_info_.Reset(nullptr, nullptr); 714 other->allocation_info_.Reset(nullptr, nullptr);
732 return true; 715 return true;
733 } 716 }
734 return false; 717 return false;
735 } 718 }
736 719
737 } // namespace internal 720 } // namespace internal
738 } // namespace v8 721 } // namespace v8
739 722
740 #endif // V8_HEAP_SPACES_INL_H_ 723 #endif // V8_HEAP_SPACES_INL_H_
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698