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

Side by Side Diff: src/heap/store-buffer.cc

Issue 804603006: Regularly check hash set addresses to verify memory integrity. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | src/isolate.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 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 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/base/atomicops.h" 9 #include "src/base/atomicops.h"
10 #include "src/counters.h" 10 #include "src/counters.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 CHECK(virtual_memory_->Commit(reinterpret_cast<Address>(start_), 74 CHECK(virtual_memory_->Commit(reinterpret_cast<Address>(start_),
75 kStoreBufferSize, 75 kStoreBufferSize,
76 false)); // Not executable. 76 false)); // Not executable.
77 heap_->public_set_store_buffer_top(start_); 77 heap_->public_set_store_buffer_top(start_);
78 78
79 hash_set_1_ = new uintptr_t[kHashSetLength]; 79 hash_set_1_ = new uintptr_t[kHashSetLength];
80 hash_set_2_ = new uintptr_t[kHashSetLength]; 80 hash_set_2_ = new uintptr_t[kHashSetLength];
81 hash_sets_are_empty_ = false; 81 hash_sets_are_empty_ = false;
82 82
83 ClearFilteringHashSets(); 83 ClearFilteringHashSets();
84
85 heap_->isolate()->set_store_buffer_hash_set_1_address(hash_set_1_);
86 heap_->isolate()->set_store_buffer_hash_set_2_address(hash_set_2_);
84 } 87 }
85 88
86 89
87 void StoreBuffer::TearDown() { 90 void StoreBuffer::TearDown() {
88 delete virtual_memory_; 91 delete virtual_memory_;
89 delete old_virtual_memory_; 92 delete old_virtual_memory_;
90 delete[] hash_set_1_; 93 delete[] hash_set_1_;
91 delete[] hash_set_2_; 94 delete[] hash_set_2_;
92 old_start_ = old_top_ = old_limit_ = old_reserved_limit_ = NULL; 95 old_start_ = old_top_ = old_limit_ = old_reserved_limit_ = NULL;
93 start_ = limit_ = NULL; 96 start_ = limit_ = NULL;
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 550 }
548 } 551 }
549 if (callback_ != NULL) { 552 if (callback_ != NULL) {
550 (*callback_)(heap_, NULL, kStoreBufferScanningPageEvent); 553 (*callback_)(heap_, NULL, kStoreBufferScanningPageEvent);
551 } 554 }
552 } 555 }
553 } 556 }
554 557
555 558
556 void StoreBuffer::Compact() { 559 void StoreBuffer::Compact() {
560 CHECK(hash_set_1_ == heap_->isolate()->store_buffer_hash_set_1_address());
561 CHECK(hash_set_2_ == heap_->isolate()->store_buffer_hash_set_2_address());
562
557 Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top()); 563 Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top());
558 564
559 if (top == start_) return; 565 if (top == start_) return;
560 566
561 // There's no check of the limit in the loop below so we check here for 567 // There's no check of the limit in the loop below so we check here for
562 // the worst case (compaction doesn't eliminate any pointers). 568 // the worst case (compaction doesn't eliminate any pointers).
563 DCHECK(top <= limit_); 569 DCHECK(top <= limit_);
564 heap_->public_set_store_buffer_top(start_); 570 heap_->public_set_store_buffer_top(start_);
565 EnsureSpace(top - start_); 571 EnsureSpace(top - start_);
566 DCHECK(may_move_store_buffer_entries_); 572 DCHECK(may_move_store_buffer_entries_);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 606 }
601 old_buffer_is_sorted_ = false; 607 old_buffer_is_sorted_ = false;
602 old_buffer_is_filtered_ = false; 608 old_buffer_is_filtered_ = false;
603 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); 609 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2);
604 DCHECK(old_top_ <= old_limit_); 610 DCHECK(old_top_ <= old_limit_);
605 } 611 }
606 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); 612 heap_->isolate()->counters()->store_buffer_compactions()->Increment();
607 } 613 }
608 } 614 }
609 } // namespace v8::internal 615 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698