Fix issue 597: builtins and stubs are missing in profiler log when using snapshots.

After this fix, profiles of non-snapshotted VMs are now equivalent to
profiles of snapshotted VMs (having that --log-snapshot-positions is used,
and mksnapshot's log is given to the tick processor script.)

BUG=597

Review URL: http://codereview.chromium.org/574005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3802 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9b4312fd
......@@ -1294,6 +1294,15 @@ void Logger::LogCodeObject(Object* object) {
}
void Logger::LogCodeObjects() {
AssertNoAllocation no_alloc;
HeapIterator iterator;
for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
if (obj->IsCode()) LogCodeObject(obj);
}
}
void Logger::LogCompiledFunctions() {
HandleScope scope;
const int compiled_funcs_count = EnumerateCompiledFunctions(NULL);
......
......@@ -292,7 +292,7 @@ class Logger {
// Logs all accessor callbacks found in the heap.
static void LogAccessorCallbacks();
// Used for logging stubs found in the snapshot.
static void LogCodeObject(Object* code_object);
static void LogCodeObjects();
private:
......@@ -325,6 +325,9 @@ class Logger {
// Emits the source code of a regexp. Used by regexp events.
static void LogRegExpSource(Handle<JSRegExp> regexp);
// Used for logging stubs found in the snapshot.
static void LogCodeObject(Object* code_object);
// Emits a profiler tick event. Used by the profiler thread.
static void TickEvent(TickSample* sample, bool overflow);
......
......@@ -114,8 +114,11 @@ bool V8::Initialize(Deserializer *des) {
OProfileAgent::Initialize();
if (FLAG_log_code) {
// If we are deserializing, log non-function code objects and compiled
// functions found in the snapshot.
if (des != NULL && FLAG_log_code) {
HandleScope scope;
LOG(LogCodeObjects());
LOG(LogCompiledFunctions());
}
......
......@@ -67,6 +67,9 @@ function SnapshotLogProcessor() {
processor: this.processCodeMove, backrefs: true },
'code-delete': { parsers: [this.createAddressParser('code')],
processor: this.processCodeDelete, backrefs: true },
'function-creation': null,
'function-move': null,
'function-delete': null,
'snapshot-pos': { parsers: [this.createAddressParser('code'), parseInt],
processor: this.processSnapshotPosition, backrefs: true }});
......
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