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

Side by Side Diff: src/heap/slot-set.h

Issue 2397473004: [heap] Do not touch pre-freed typed slot set memory anymore. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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_SLOT_SET_H 5 #ifndef V8_SLOT_SET_H
6 #define V8_SLOT_SET_H 6 #define V8_SLOT_SET_H
7 7
8 #include <stack> 8 #include <stack>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 Address addr = page_start_ + type_and_offset.second; 394 Address addr = page_start_ + type_and_offset.second;
395 if (callback(type, host_addr, addr) == KEEP_SLOT) { 395 if (callback(type, host_addr, addr) == KEEP_SLOT) {
396 new_count++; 396 new_count++;
397 empty = false; 397 empty = false;
398 } else { 398 } else {
399 buffer[i].Clear(); 399 buffer[i].Clear();
400 } 400 }
401 } 401 }
402 } 402 }
403 403
404 Chunk* next = chunk->next.Value();
404 if (mode == PREFREE_EMPTY_CHUNKS && empty) { 405 if (mode == PREFREE_EMPTY_CHUNKS && empty) {
405 // We remove the chunk from the list but let it still point its next 406 // We remove the chunk from the list but let it still point its next
406 // chunk to allow concurrent iteration. 407 // chunk to allow concurrent iteration.
407 if (previous) { 408 if (previous) {
408 previous->next.SetValue(chunk->next.Value()); 409 previous->next.SetValue(next);
409 } else { 410 } else {
410 chunk_.SetValue(chunk->next.Value()); 411 chunk_.SetValue(next);
411 } 412 }
412 base::LockGuard<base::Mutex> guard(&to_be_freed_chunks_mutex_); 413 base::LockGuard<base::Mutex> guard(&to_be_freed_chunks_mutex_);
413 to_be_freed_chunks_.push(chunk); 414 to_be_freed_chunks_.push(chunk);
414 } else { 415 } else {
415 previous = chunk; 416 previous = chunk;
416 } 417 }
417 chunk = chunk->next.Value(); 418 chunk = next;
418 } 419 }
419 return new_count; 420 return new_count;
420 } 421 }
421 422
422 void FreeToBeFreedChunks() { 423 void FreeToBeFreedChunks() {
423 base::LockGuard<base::Mutex> guard(&to_be_freed_chunks_mutex_); 424 base::LockGuard<base::Mutex> guard(&to_be_freed_chunks_mutex_);
424 while (!to_be_freed_chunks_.empty()) { 425 while (!to_be_freed_chunks_.empty()) {
425 Chunk* top = to_be_freed_chunks_.top(); 426 Chunk* top = to_be_freed_chunks_.top();
426 to_be_freed_chunks_.pop(); 427 to_be_freed_chunks_.pop();
427 delete top; 428 delete top;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 Address page_start_; 468 Address page_start_;
468 base::AtomicValue<Chunk*> chunk_; 469 base::AtomicValue<Chunk*> chunk_;
469 base::Mutex to_be_freed_chunks_mutex_; 470 base::Mutex to_be_freed_chunks_mutex_;
470 std::stack<Chunk*> to_be_freed_chunks_; 471 std::stack<Chunk*> to_be_freed_chunks_;
471 }; 472 };
472 473
473 } // namespace internal 474 } // namespace internal
474 } // namespace v8 475 } // namespace v8
475 476
476 #endif // V8_SLOT_SET_H 477 #endif // V8_SLOT_SET_H
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698