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

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

Issue 1863983002: 🏄 [heap] Add page evacuation mode for new->old (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup 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
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/heap/heap.h" 5 #include "src/heap/heap.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/ast/scopeinfo.h" 9 #include "src/ast/scopeinfo.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 6212 matching lines...) Expand 10 before | Expand all | Expand 10 after
6223 6223
6224 void KeyedLookupCache::Clear() { 6224 void KeyedLookupCache::Clear() {
6225 for (int index = 0; index < kLength; index++) keys_[index].map = NULL; 6225 for (int index = 0; index < kLength; index++) keys_[index].map = NULL;
6226 } 6226 }
6227 6227
6228 6228
6229 void DescriptorLookupCache::Clear() { 6229 void DescriptorLookupCache::Clear() {
6230 for (int index = 0; index < kLength; index++) keys_[index].source = NULL; 6230 for (int index = 0; index < kLength; index++) keys_[index].source = NULL;
6231 } 6231 }
6232 6232
6233 6233 template <Heap::ExternalStringTable::CleanupMode mode>
6234 void Heap::ExternalStringTable::CleanUp() { 6234 void Heap::ExternalStringTable::CleanUp() {
6235 int last = 0; 6235 int last = 0;
6236 for (int i = 0; i < new_space_strings_.length(); ++i) { 6236 for (int i = 0; i < new_space_strings_.length(); ++i) {
6237 if (new_space_strings_[i] == heap_->the_hole_value()) { 6237 if (new_space_strings_[i] == heap_->the_hole_value()) {
6238 continue; 6238 continue;
6239 } 6239 }
6240 DCHECK(new_space_strings_[i]->IsExternalString()); 6240 DCHECK(new_space_strings_[i]->IsExternalString());
6241 if (heap_->InNewSpace(new_space_strings_[i])) { 6241 if (heap_->InNewSpace(new_space_strings_[i])) {
6242 new_space_strings_[last++] = new_space_strings_[i]; 6242 new_space_strings_[last++] = new_space_strings_[i];
6243 } else { 6243 } else {
6244 old_space_strings_.Add(new_space_strings_[i]); 6244 old_space_strings_.Add(new_space_strings_[i]);
6245 } 6245 }
6246 } 6246 }
6247 new_space_strings_.Rewind(last); 6247 new_space_strings_.Rewind(last);
6248 new_space_strings_.Trim(); 6248 new_space_strings_.Trim();
6249 6249
6250 last = 0; 6250 if (mode == CleanupMode::kFull) {
6251 for (int i = 0; i < old_space_strings_.length(); ++i) { 6251 last = 0;
6252 if (old_space_strings_[i] == heap_->the_hole_value()) { 6252 for (int i = 0; i < old_space_strings_.length(); ++i) {
6253 continue; 6253 if (old_space_strings_[i] == heap_->the_hole_value()) {
6254 continue;
6255 }
6256 DCHECK(old_space_strings_[i]->IsExternalString());
6257 DCHECK(!heap_->InNewSpace(old_space_strings_[i]));
6258 old_space_strings_[last++] = old_space_strings_[i];
6254 } 6259 }
6255 DCHECK(old_space_strings_[i]->IsExternalString()); 6260 old_space_strings_.Rewind(last);
6256 DCHECK(!heap_->InNewSpace(old_space_strings_[i])); 6261 old_space_strings_.Trim();
6257 old_space_strings_[last++] = old_space_strings_[i];
6258 } 6262 }
6259 old_space_strings_.Rewind(last);
6260 old_space_strings_.Trim();
6261 #ifdef VERIFY_HEAP 6263 #ifdef VERIFY_HEAP
6262 if (FLAG_verify_heap) { 6264 if (FLAG_verify_heap) {
6263 Verify(); 6265 Verify();
6264 } 6266 }
6265 #endif 6267 #endif
6266 } 6268 }
6267 6269
6270 template void Heap::ExternalStringTable::CleanUp<
6271 Heap::ExternalStringTable::CleanupMode::kFull>();
6272 template void Heap::ExternalStringTable::CleanUp<
6273 Heap::ExternalStringTable::CleanupMode::kPromoteOnly>();
6268 6274
6269 void Heap::ExternalStringTable::TearDown() { 6275 void Heap::ExternalStringTable::TearDown() {
6270 for (int i = 0; i < new_space_strings_.length(); ++i) { 6276 for (int i = 0; i < new_space_strings_.length(); ++i) {
6271 heap_->FinalizeExternalString(ExternalString::cast(new_space_strings_[i])); 6277 heap_->FinalizeExternalString(ExternalString::cast(new_space_strings_[i]));
6272 } 6278 }
6273 new_space_strings_.Free(); 6279 new_space_strings_.Free();
6274 for (int i = 0; i < old_space_strings_.length(); ++i) { 6280 for (int i = 0; i < old_space_strings_.length(); ++i) {
6275 heap_->FinalizeExternalString(ExternalString::cast(old_space_strings_[i])); 6281 heap_->FinalizeExternalString(ExternalString::cast(old_space_strings_[i]));
6276 } 6282 }
6277 old_space_strings_.Free(); 6283 old_space_strings_.Free();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
6447 } 6453 }
6448 6454
6449 6455
6450 // static 6456 // static
6451 int Heap::GetStaticVisitorIdForMap(Map* map) { 6457 int Heap::GetStaticVisitorIdForMap(Map* map) {
6452 return StaticVisitorBase::GetVisitorId(map); 6458 return StaticVisitorBase::GetVisitorId(map);
6453 } 6459 }
6454 6460
6455 } // namespace internal 6461 } // namespace internal
6456 } // namespace v8 6462 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698