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

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

Issue 1312553003: [heap] Prevent direct access to ExternalStringTable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-heap-root-set-1
Patch Set: Addressed comments. Created 5 years, 3 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/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/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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 6442 matching lines...) Expand 10 before | Expand all | Expand 10 after
6453 void KeyedLookupCache::Clear() { 6453 void KeyedLookupCache::Clear() {
6454 for (int index = 0; index < kLength; index++) keys_[index].map = NULL; 6454 for (int index = 0; index < kLength; index++) keys_[index].map = NULL;
6455 } 6455 }
6456 6456
6457 6457
6458 void DescriptorLookupCache::Clear() { 6458 void DescriptorLookupCache::Clear() {
6459 for (int index = 0; index < kLength; index++) keys_[index].source = NULL; 6459 for (int index = 0; index < kLength; index++) keys_[index].source = NULL;
6460 } 6460 }
6461 6461
6462 6462
6463 void ExternalStringTable::CleanUp() { 6463 void Heap::ExternalStringTable::CleanUp() {
6464 int last = 0; 6464 int last = 0;
6465 for (int i = 0; i < new_space_strings_.length(); ++i) { 6465 for (int i = 0; i < new_space_strings_.length(); ++i) {
6466 if (new_space_strings_[i] == heap_->the_hole_value()) { 6466 if (new_space_strings_[i] == heap_->the_hole_value()) {
6467 continue; 6467 continue;
6468 } 6468 }
6469 DCHECK(new_space_strings_[i]->IsExternalString()); 6469 DCHECK(new_space_strings_[i]->IsExternalString());
6470 if (heap_->InNewSpace(new_space_strings_[i])) { 6470 if (heap_->InNewSpace(new_space_strings_[i])) {
6471 new_space_strings_[last++] = new_space_strings_[i]; 6471 new_space_strings_[last++] = new_space_strings_[i];
6472 } else { 6472 } else {
6473 old_space_strings_.Add(new_space_strings_[i]); 6473 old_space_strings_.Add(new_space_strings_[i]);
(...skipping 14 matching lines...) Expand all
6488 old_space_strings_.Rewind(last); 6488 old_space_strings_.Rewind(last);
6489 old_space_strings_.Trim(); 6489 old_space_strings_.Trim();
6490 #ifdef VERIFY_HEAP 6490 #ifdef VERIFY_HEAP
6491 if (FLAG_verify_heap) { 6491 if (FLAG_verify_heap) {
6492 Verify(); 6492 Verify();
6493 } 6493 }
6494 #endif 6494 #endif
6495 } 6495 }
6496 6496
6497 6497
6498 void ExternalStringTable::TearDown() { 6498 void Heap::ExternalStringTable::TearDown() {
6499 for (int i = 0; i < new_space_strings_.length(); ++i) { 6499 for (int i = 0; i < new_space_strings_.length(); ++i) {
6500 heap_->FinalizeExternalString(ExternalString::cast(new_space_strings_[i])); 6500 heap_->FinalizeExternalString(ExternalString::cast(new_space_strings_[i]));
6501 } 6501 }
6502 new_space_strings_.Free(); 6502 new_space_strings_.Free();
6503 for (int i = 0; i < old_space_strings_.length(); ++i) { 6503 for (int i = 0; i < old_space_strings_.length(); ++i) {
6504 heap_->FinalizeExternalString(ExternalString::cast(old_space_strings_[i])); 6504 heap_->FinalizeExternalString(ExternalString::cast(old_space_strings_[i]));
6505 } 6505 }
6506 old_space_strings_.Free(); 6506 old_space_strings_.Free();
6507 } 6507 }
6508 6508
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
6775 *object_type = "CODE_TYPE"; \ 6775 *object_type = "CODE_TYPE"; \
6776 *object_sub_type = "CODE_AGE/" #name; \ 6776 *object_sub_type = "CODE_AGE/" #name; \
6777 return true; 6777 return true;
6778 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6778 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6779 #undef COMPARE_AND_RETURN_NAME 6779 #undef COMPARE_AND_RETURN_NAME
6780 } 6780 }
6781 return false; 6781 return false;
6782 } 6782 }
6783 } // namespace internal 6783 } // namespace internal
6784 } // namespace v8 6784 } // namespace v8
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