[loggers] Guard object/code move events using mutexes.

Parallel compaction, i.e., concurrently moving of objects (and code) requires
proper synchronization in the logger.

R=hpayer@chromium.org
BUG=chromium:524425
LOG=N

Review URL: https://codereview.chromium.org/1338253002

Cr-Commit-Position: refs/heads/master@{#30714}
This commit is contained in:
mlippautz 2015-09-14 05:06:43 -07:00 committed by Commit bot
parent cb621e2e2c
commit 8f40327067
3 changed files with 4 additions and 0 deletions

View File

@ -135,6 +135,7 @@ SnapshotObjectId HeapProfiler::GetSnapshotObjectId(Handle<Object> obj) {
void HeapProfiler::ObjectMoveEvent(Address from, Address to, int size) {
base::LockGuard<base::Mutex> guard(&profiler_mutex_);
bool known_object = ids_->MoveObject(from, to, size);
if (!known_object && !allocation_tracker_.is_empty()) {
allocation_tracker_->address_to_trace()->MoveObject(from, to, size);

View File

@ -76,6 +76,7 @@ class HeapProfiler {
List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
base::SmartPointer<AllocationTracker> allocation_tracker_;
bool is_tracking_object_moves_;
base::Mutex profiler_mutex_;
};
} } // namespace v8::internal

View File

@ -501,6 +501,7 @@ class JitLogger : public CodeEventLogger {
int length);
JitCodeEventHandler code_event_handler_;
base::Mutex logger_mutex_;
};
@ -530,6 +531,7 @@ void JitLogger::LogRecordedBuffer(Code* code,
void JitLogger::CodeMoveEvent(Address from, Address to) {
base::LockGuard<base::Mutex> guard(&logger_mutex_);
Code* from_code = Code::cast(HeapObject::FromAddress(from));
JitCodeEvent event;