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) { ...@@ -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() { void Logger::LogCompiledFunctions() {
HandleScope scope; HandleScope scope;
const int compiled_funcs_count = EnumerateCompiledFunctions(NULL); const int compiled_funcs_count = EnumerateCompiledFunctions(NULL);
......
...@@ -292,7 +292,7 @@ class Logger { ...@@ -292,7 +292,7 @@ class Logger {
// Logs all accessor callbacks found in the heap. // Logs all accessor callbacks found in the heap.
static void LogAccessorCallbacks(); static void LogAccessorCallbacks();
// Used for logging stubs found in the snapshot. // Used for logging stubs found in the snapshot.
static void LogCodeObject(Object* code_object); static void LogCodeObjects();
private: private:
...@@ -325,6 +325,9 @@ class Logger { ...@@ -325,6 +325,9 @@ class Logger {
// Emits the source code of a regexp. Used by regexp events. // Emits the source code of a regexp. Used by regexp events.
static void LogRegExpSource(Handle<JSRegExp> regexp); 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. // Emits a profiler tick event. Used by the profiler thread.
static void TickEvent(TickSample* sample, bool overflow); static void TickEvent(TickSample* sample, bool overflow);
......
...@@ -114,8 +114,11 @@ bool V8::Initialize(Deserializer *des) { ...@@ -114,8 +114,11 @@ bool V8::Initialize(Deserializer *des) {
OProfileAgent::Initialize(); 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; HandleScope scope;
LOG(LogCodeObjects());
LOG(LogCompiledFunctions()); LOG(LogCompiledFunctions());
} }
......
...@@ -67,6 +67,9 @@ function SnapshotLogProcessor() { ...@@ -67,6 +67,9 @@ function SnapshotLogProcessor() {
processor: this.processCodeMove, backrefs: true }, processor: this.processCodeMove, backrefs: true },
'code-delete': { parsers: [this.createAddressParser('code')], 'code-delete': { parsers: [this.createAddressParser('code')],
processor: this.processCodeDelete, backrefs: true }, processor: this.processCodeDelete, backrefs: true },
'function-creation': null,
'function-move': null,
'function-delete': null,
'snapshot-pos': { parsers: [this.createAddressParser('code'), parseInt], 'snapshot-pos': { parsers: [this.createAddressParser('code'), parseInt],
processor: this.processSnapshotPosition, backrefs: true }}); 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