Commit 39b47107 authored by rmcilroy's avatar rmcilroy Committed by Commit bot

Fix crash when --ll_prof is enabled after cb29f9cd

BUG=v8:4766
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34446}
parent 0c355790
......@@ -298,7 +298,7 @@ class LowLevelLogger : public CodeEventLogger {
void CodeMoveEvent(AbstractCode* from, Address to) override;
void CodeDisableOptEvent(AbstractCode* code,
SharedFunctionInfo* shared) override {}
void SnapshotPositionEvent(Address addr, int pos);
void SnapshotPositionEvent(HeapObject* obj, int pos);
void CodeMovingGCEvent() override;
private:
......@@ -421,12 +421,12 @@ void LowLevelLogger::CodeMoveEvent(AbstractCode* from, Address to) {
LogWriteStruct(event);
}
void LowLevelLogger::SnapshotPositionEvent(Address addr, int pos) {
HeapObject* obj = HeapObject::FromAddress(addr);
void LowLevelLogger::SnapshotPositionEvent(HeapObject* obj, int pos) {
if (obj->IsAbstractCode()) {
SnapshotPositionStruct event;
event.address =
addr + (obj->IsCode() ? Code::kHeaderSize : BytecodeArray::kHeaderSize);
obj->address() +
(obj->IsCode() ? Code::kHeaderSize : BytecodeArray::kHeaderSize);
event.position = pos;
LogWriteStruct(event);
}
......@@ -1294,14 +1294,13 @@ void Logger::CodeNameEvent(Address addr, int pos, const char* code_name) {
msg.WriteToLogFile();
}
void Logger::SnapshotPositionEvent(Address addr, int pos) {
void Logger::SnapshotPositionEvent(HeapObject* obj, int pos) {
if (!log_->IsEnabled()) return;
LL_LOG(SnapshotPositionEvent(addr, pos));
LL_LOG(SnapshotPositionEvent(obj, pos));
if (!FLAG_log_snapshot_positions) return;
Log::MessageBuilder msg(log_);
msg.Append("%s,", kLogEventsNames[SNAPSHOT_POSITION_EVENT]);
msg.AppendAddress(addr);
msg.AppendAddress(obj->address());
msg.Append(",%d", pos);
msg.WriteToLogFile();
}
......
......@@ -260,7 +260,7 @@ class Logger {
void SharedFunctionInfoMoveEvent(Address from, Address to);
void CodeNameEvent(Address addr, int pos, const char* code_name);
void SnapshotPositionEvent(Address addr, int pos);
void SnapshotPositionEvent(HeapObject* obj, int pos);
// ==== Events logged by --log-gc. ====
// Heap sampling events: start, end, and individual types.
......
......@@ -364,14 +364,15 @@ void Deserializer::ReadObject(int space_number, Object** write_back) {
isolate_->heap()->OnAllocationEvent(obj, size);
Object** current = reinterpret_cast<Object**>(address);
Object** limit = current + (size >> kPointerSizeLog2);
if (FLAG_log_snapshot_positions) {
LOG(isolate_, SnapshotPositionEvent(address, source_.position()));
}
int position = source_.position();
if (ReadData(current, limit, space_number, address)) {
// Only post process if object content has not been deferred.
obj = PostProcessNewObject(obj, space_number);
}
if (FLAG_log_snapshot_positions) {
LOG(isolate_, SnapshotPositionEvent(obj, position));
}
Object* write_back_obj = obj;
UnalignedCopy(write_back, &write_back_obj);
......
......@@ -316,7 +316,7 @@ void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space,
LOG(serializer_->isolate_,
CodeNameEvent(object_->address(), sink_->Position(), code_name));
LOG(serializer_->isolate_,
SnapshotPositionEvent(object_->address(), sink_->Position()));
SnapshotPositionEvent(object_, sink_->Position()));
}
BackReference back_reference;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment