Author: [EMAIL PROTECTED]
Date: Tue Dec  9 01:19:02 2008
New Revision: 943

Modified:
    branches/bleeding_edge/src/ic.cc
    branches/bleeding_edge/src/log.cc
    branches/bleeding_edge/src/log.h

Log:
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

Modified: branches/bleeding_edge/src/ic.cc
==============================================================================
--- branches/bleeding_edge/src/ic.cc    (original)
+++ branches/bleeding_edge/src/ic.cc    Tue Dec  9 01:19:02 2008
@@ -514,11 +514,7 @@
      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.

Modified: branches/bleeding_edge/src/log.cc
==============================================================================
--- branches/bleeding_edge/src/log.cc   (original)
+++ branches/bleeding_edge/src/log.cc   Tue Dec  9 01:19:02 2008
@@ -593,12 +593,15 @@
  }


-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");

Modified: branches/bleeding_edge/src/log.h
==============================================================================
--- branches/bleeding_edge/src/log.h    (original)
+++ branches/bleeding_edge/src/log.h    Tue Dec  9 01:19:02 2008
@@ -134,7 +134,7 @@

    // 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.

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to