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

Side by Side Diff: src/heap/heap.cc

Issue 617493005: Version 3.28.71.15 (merged r23824) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.28
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/once.h" 9 #include "src/base/once.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 void PromotionQueue::Initialize() { 1366 void PromotionQueue::Initialize() {
1367 // Assumes that a NewSpacePage exactly fits a number of promotion queue 1367 // Assumes that a NewSpacePage exactly fits a number of promotion queue
1368 // entries (where each is a pair of intptr_t). This allows us to simplify 1368 // entries (where each is a pair of intptr_t). This allows us to simplify
1369 // the test fpr when to switch pages. 1369 // the test fpr when to switch pages.
1370 DCHECK((Page::kPageSize - MemoryChunk::kBodyOffset) % (2 * kPointerSize) == 1370 DCHECK((Page::kPageSize - MemoryChunk::kBodyOffset) % (2 * kPointerSize) ==
1371 0); 1371 0);
1372 limit_ = reinterpret_cast<intptr_t*>(heap_->new_space()->ToSpaceStart()); 1372 limit_ = reinterpret_cast<intptr_t*>(heap_->new_space()->ToSpaceStart());
1373 front_ = rear_ = 1373 front_ = rear_ =
1374 reinterpret_cast<intptr_t*>(heap_->new_space()->ToSpaceEnd()); 1374 reinterpret_cast<intptr_t*>(heap_->new_space()->ToSpaceEnd());
1375 emergency_stack_ = NULL; 1375 emergency_stack_ = NULL;
1376 guard_ = false;
1377 } 1376 }
1378 1377
1379 1378
1380 void PromotionQueue::RelocateQueueHead() { 1379 void PromotionQueue::RelocateQueueHead() {
1381 DCHECK(emergency_stack_ == NULL); 1380 DCHECK(emergency_stack_ == NULL);
1382 1381
1383 Page* p = Page::FromAllocationTop(reinterpret_cast<Address>(rear_)); 1382 Page* p = Page::FromAllocationTop(reinterpret_cast<Address>(rear_));
1384 intptr_t* head_start = rear_; 1383 intptr_t* head_start = rear_;
1385 intptr_t* head_end = Min(front_, reinterpret_cast<intptr_t*>(p->area_end())); 1384 intptr_t* head_end = Min(front_, reinterpret_cast<intptr_t*>(p->area_end()));
1386 1385
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 DCHECK(alignment == kDoubleAlignment); 1963 DCHECK(alignment == kDoubleAlignment);
1965 allocation_size += kPointerSize; 1964 allocation_size += kPointerSize;
1966 } 1965 }
1967 1966
1968 DCHECK(heap->AllowedToBeMigrated(object, NEW_SPACE)); 1967 DCHECK(heap->AllowedToBeMigrated(object, NEW_SPACE));
1969 AllocationResult allocation = 1968 AllocationResult allocation =
1970 heap->new_space()->AllocateRaw(allocation_size); 1969 heap->new_space()->AllocateRaw(allocation_size);
1971 1970
1972 HeapObject* target = NULL; // Initialization to please compiler. 1971 HeapObject* target = NULL; // Initialization to please compiler.
1973 if (allocation.To(&target)) { 1972 if (allocation.To(&target)) {
1973 // Order is important here: Set the promotion limit before storing a
1974 // filler for double alignment or migrating the object. Otherwise we
1975 // may end up overwriting promotion queue entries when we migrate the
1976 // object.
1977 heap->promotion_queue()->SetNewLimit(heap->new_space()->top());
1978
1974 if (alignment != kObjectAlignment) { 1979 if (alignment != kObjectAlignment) {
1975 target = EnsureDoubleAligned(heap, target, allocation_size); 1980 target = EnsureDoubleAligned(heap, target, allocation_size);
1976 } 1981 }
1977 1982
1978 // Order is important here: Set the promotion limit before migrating
1979 // the object. Otherwise we may end up overwriting promotion queue
1980 // entries when we migrate the object.
1981 heap->promotion_queue()->SetNewLimit(heap->new_space()->top());
1982
1983 // Order is important: slot might be inside of the target if target 1983 // Order is important: slot might be inside of the target if target
1984 // was allocated over a dead object and slot comes from the store 1984 // was allocated over a dead object and slot comes from the store
1985 // buffer. 1985 // buffer.
1986 *slot = target; 1986 *slot = target;
1987 MigrateObject(heap, object, target, object_size); 1987 MigrateObject(heap, object, target, object_size);
1988 1988
1989 heap->IncrementSemiSpaceCopiedObjectSize(object_size); 1989 heap->IncrementSemiSpaceCopiedObjectSize(object_size);
1990 return true; 1990 return true;
1991 } 1991 }
1992 return false; 1992 return false;
(...skipping 4150 matching lines...) Expand 10 before | Expand all | Expand 10 after
6143 static_cast<int>(object_sizes_last_time_[index])); 6143 static_cast<int>(object_sizes_last_time_[index]));
6144 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6144 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6145 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6145 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6146 6146
6147 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6147 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6148 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6148 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6149 ClearObjectStats(); 6149 ClearObjectStats();
6150 } 6150 }
6151 } 6151 }
6152 } // namespace v8::internal 6152 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698