Commit fa04fa8a authored by deanm@chromium.org's avatar deanm@chromium.org

Make Logger::SuspectReadEvent extract the class name from the object. This...

Make Logger::SuspectReadEvent extract the class name from the object.  This makes the lone caller cleaner, and also avoids a tiny bit of work in the default case of not running with --log-suspect.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@943 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent df727ffd
...@@ -514,11 +514,7 @@ Object* LoadIC::Load(State state, Handle<Object> object, Handle<String> name) { ...@@ -514,11 +514,7 @@ Object* LoadIC::Load(State state, Handle<Object> object, Handle<String> name) {
if (FLAG_strict || is_contextual()) { if (FLAG_strict || is_contextual()) {
return ReferenceError("not_defined", name); return ReferenceError("not_defined", name);
} }
String* class_name = object->IsJSObject() LOG(SuspectReadEvent(*name, *object));
? Handle<JSObject>::cast(object)->class_name()
: Heap::empty_string();
LOG(SuspectReadEvent(*name, class_name));
USE(class_name);
} }
// Update inline cache and stub cache. // Update inline cache and stub cache.
......
...@@ -593,12 +593,15 @@ void Logger::ResourceEvent(const char* name, const char* tag) { ...@@ -593,12 +593,15 @@ void Logger::ResourceEvent(const char* name, const char* tag) {
} }
void Logger::SuspectReadEvent(String* name, String* obj) { void Logger::SuspectReadEvent(String* name, Object* obj) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
if (logfile_ == NULL || !FLAG_log_suspect) return; if (logfile_ == NULL || !FLAG_log_suspect) return;
String* class_name = obj->IsJSObject()
? JSObject::cast(obj)->class_name()
: Heap::empty_string();
ScopedLock sl(mutex_); ScopedLock sl(mutex_);
fprintf(logfile_, "suspect-read,"); fprintf(logfile_, "suspect-read,");
obj->PrintOn(logfile_); class_name->PrintOn(logfile_);
fprintf(logfile_, ",\""); fprintf(logfile_, ",\"");
name->PrintOn(logfile_); name->PrintOn(logfile_);
fprintf(logfile_, "\"\n"); fprintf(logfile_, "\"\n");
......
...@@ -134,7 +134,7 @@ class Logger { ...@@ -134,7 +134,7 @@ class Logger {
// Emits an event that an undefined property was read from an // Emits an event that an undefined property was read from an
// object. // object.
static void SuspectReadEvent(String* name, String* obj); static void SuspectReadEvent(String* name, Object* obj);
// Emits an event when a message is put on or read from a debugging queue. // Emits an event when a message is put on or read from a debugging queue.
// DebugTag lets us put a call-site specific label on the event. // DebugTag lets us put a call-site specific label on the event.
......
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