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
This commit is contained in:
parent
df727ffd43
commit
fa04fa8a19
@ -514,11 +514,7 @@ Object* LoadIC::Load(State state, Handle<Object> object, Handle<String> name) {
|
||||
if (FLAG_strict || is_contextual()) {
|
||||
return ReferenceError("not_defined", name);
|
||||
}
|
||||
String* class_name = object->IsJSObject()
|
||||
? Handle<JSObject>::cast(object)->class_name()
|
||||
: Heap::empty_string();
|
||||
LOG(SuspectReadEvent(*name, class_name));
|
||||
USE(class_name);
|
||||
LOG(SuspectReadEvent(*name, *object));
|
||||
}
|
||||
|
||||
// Update inline cache and stub cache.
|
||||
|
@ -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
|
||||
if (logfile_ == NULL || !FLAG_log_suspect) return;
|
||||
String* class_name = obj->IsJSObject()
|
||||
? JSObject::cast(obj)->class_name()
|
||||
: Heap::empty_string();
|
||||
ScopedLock sl(mutex_);
|
||||
fprintf(logfile_, "suspect-read,");
|
||||
obj->PrintOn(logfile_);
|
||||
class_name->PrintOn(logfile_);
|
||||
fprintf(logfile_, ",\"");
|
||||
name->PrintOn(logfile_);
|
||||
fprintf(logfile_, "\"\n");
|
||||
|
@ -134,7 +134,7 @@ class Logger {
|
||||
|
||||
// Emits an event that an undefined property was read from an
|
||||
// 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.
|
||||
// DebugTag lets us put a call-site specific label on the event.
|
||||
|
Loading…
Reference in New Issue
Block a user