Commit 2498ea91 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[deserializer] Dump the disassembly of deserialized code

Prints the disassembly of code objects on the heap after
deserialization, if --print-builtin-code is on. This allows us to
annotate the disassembly of builtins in the same way as we do optimised
code now, for example using `perf report --objdump=v8/tools/objdump`.

Change-Id: I1781302de6fca035ea9bd4c4f7d58796a957f4af
Reviewed-on: https://chromium-review.googlesource.com/456340Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43923}
parent 6803fd9f
......@@ -113,6 +113,9 @@ void Deserializer::Deserialize(Isolate* isolate) {
isolate_->heap()->undefined_value());
}
// If needed, print the dissassembly of deserialized code objects.
PrintDisassembledCodeObjects();
// Issue code events for newly deserialized code objects.
LOG_CODE_EVENT(isolate_, LogCodeObjects());
LOG_CODE_EVENT(isolate_, LogBytecodeHandlers());
......@@ -250,6 +253,26 @@ void Deserializer::DeserializeEmbedderFields(
}
}
void Deserializer::PrintDisassembledCodeObjects() {
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_builtin_code) {
Heap* heap = isolate_->heap();
HeapIterator iterator(heap);
DisallowHeapAllocation no_gc;
CodeTracer::Scope tracing_scope(isolate_->GetCodeTracer());
OFStream os(tracing_scope.file());
for (HeapObject* obj = iterator.next(); obj != NULL;
obj = iterator.next()) {
if (obj->IsCode()) {
Code::cast(obj)->Disassemble(nullptr, os);
}
}
}
#endif
}
// Used to insert a deserialized internalized string into the string table.
class StringTableInsertionKey : public HashTableKey {
public:
......
......@@ -98,6 +98,8 @@ class Deserializer : public SerializerDeserializer {
void CommitPostProcessedObjects(Isolate* isolate);
void PrintDisassembledCodeObjects();
// Fills in some heap data in an area from start to end (non-inclusive). The
// space id is used for the write barrier. The object_address is the address
// of the object we are writing into, or NULL if we are not writing into an
......
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