Author: [email protected]
Date: Thu May  7 02:27:42 2009
New Revision: 1893

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

Log:
X64: Changed 0x%x formats in log.cc to 0x%p and omitted reinterpretting  
pointers.

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


Modified: branches/bleeding_edge/src/globals.h
==============================================================================
--- branches/bleeding_edge/src/globals.h        (original)
+++ branches/bleeding_edge/src/globals.h        Thu May  7 02:27:42 2009
@@ -76,11 +76,17 @@
  #ifdef _MSC_VER
  #define V8_UINT64_C(x)  (x ## UI64)
  #define V8_INT64_C(x)   (x ## I64)
+#define V8_PTR_PREFIX "ll"
  #else
  #define V8_UINT64_C(x)  (x ## UL)
  #define V8_INT64_C(x)   (x ## L)
+#define V8_PTR_PREFIX "l"
  #endif
-#endif  // V8_HOST_ARCH_64_BIT
+#else // V8_HOST_ARCH_64_BIT
+#define V8_PTR_PREFIX ""
+#endif
+
+#define V8PRIp V8_PTR_PREFIX "x"

  // Code-point values in Unicode 4.0 are 21 bits wide.
  typedef uint16_t uc16;

Modified: branches/bleeding_edge/src/log.cc
==============================================================================
--- branches/bleeding_edge/src/log.cc   (original)
+++ branches/bleeding_edge/src/log.cc   Thu May  7 02:27:42 2009
@@ -164,7 +164,7 @@
  //
  class Ticker: public Sampler {
   public:
-  explicit Ticker(int interval, unsigned int low_stack_bound):
+  explicit Ticker(int interval, uintptr_t low_stack_bound):
        Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL),
        stack_tracer_(low_stack_bound) {}

@@ -630,8 +630,7 @@
  #ifdef ENABLE_LOGGING_AND_PROFILING
    if (!Log::is_enabled() || !FLAG_log_handles) return;
    LogMessageBuilder msg;
-  msg.Append("%s,0x%x\n", name,
-             reinterpret_cast<unsigned int>(location));
+  msg.Append("%s,0x%%"V8PRIp"\n", name, location);
    msg.WriteToLogFile();
  #endif
  }
@@ -850,8 +849,7 @@
  #ifdef ENABLE_LOGGING_AND_PROFILING
    if (!Log::is_enabled() || !FLAG_log) return;
    LogMessageBuilder msg;
-  msg.Append("new,%s,0x%x,%u\n", name,
-             reinterpret_cast<unsigned int>(object),
+  msg.Append("new,%s,0x%%"V8PRIp",%u\n", name, object,
               static_cast<unsigned int>(size));
    msg.WriteToLogFile();
  #endif
@@ -862,8 +860,7 @@
  #ifdef ENABLE_LOGGING_AND_PROFILING
    if (!Log::is_enabled() || !FLAG_log) return;
    LogMessageBuilder msg;
-  msg.Append("delete,%s,0x%x\n", name,
-             reinterpret_cast<unsigned int>(object));
+  msg.Append("delete,%s,0x%%"V8PRIp"\n", name, object);
    msg.WriteToLogFile();
  #endif
  }
@@ -873,8 +870,7 @@
  #ifdef ENABLE_LOGGING_AND_PROFILING
    if (!Log::is_enabled() || !FLAG_log_code) return;
    LogMessageBuilder msg;
-  msg.Append("code-creation,%s,0x%x,%d,\"", tag,
-             reinterpret_cast<unsigned int>(code->address()),
+  msg.Append("code-creation,%s,0x%"V8PRIp",%d,\"", tag, code->address(),
               code->ExecutableSize());
    for (const char* p = comment; *p != '\0'; p++) {
      if (*p == '"') {
@@ -895,8 +891,7 @@
    LogMessageBuilder msg;
    SmartPointer<char> str =
        name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
-  msg.Append("code-creation,%s,0x%x,%d,\"%s\"\n", tag,
-             reinterpret_cast<unsigned int>(code->address()),
+  msg.Append("code-creation,%s,0x%"V8PRIp",%d,\"%s\"\n", tag,  
code->address(),
               code->ExecutableSize(), *str);
    msg.WriteToLogFile();
  #endif
@@ -912,8 +907,7 @@
        name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
    SmartPointer<char> sourcestr =
        source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
-  msg.Append("code-creation,%s,0x%x,%d,\"%s %s:%d\"\n", tag,
-             reinterpret_cast<unsigned int>(code->address()),
+  msg.Append("code-creation,%s,0x%"V8PRIp",%d,\"%s %s:%d\"\n", tag,  
code->address(),
               code->ExecutableSize(),
               *str, *sourcestr, line);
    msg.WriteToLogFile();
@@ -925,8 +919,8 @@
  #ifdef ENABLE_LOGGING_AND_PROFILING
    if (!Log::is_enabled() || !FLAG_log_code) return;
    LogMessageBuilder msg;
-  msg.Append("code-creation,%s,0x%x,%d,\"args_count: %d\"\n", tag,
-             reinterpret_cast<unsigned int>(code->address()),
+  msg.Append("code-creation,%s,0x%"V8PRIp",%d,\"args_count: %d\"\n", tag,
+             code->address(),
               code->ExecutableSize(),
               args_count);
    msg.WriteToLogFile();
@@ -938,8 +932,8 @@
  #ifdef ENABLE_LOGGING_AND_PROFILING
    if (!Log::is_enabled() || !FLAG_log_code) return;
    LogMessageBuilder msg;
-  msg.Append("code-creation,%s,0x%x,%d,\"", "RegExp",
-             reinterpret_cast<unsigned int>(code->address()),
+  msg.Append("code-creation,%s,0x%"V8PRIp",%d,\"", "RegExp",
+             code->address(),
               code->ExecutableSize());
    msg.AppendDetailed(source, false);
    msg.Append("\"\n");
@@ -952,9 +946,7 @@
  #ifdef ENABLE_LOGGING_AND_PROFILING
    if (!Log::is_enabled() || !FLAG_log_code) return;
    LogMessageBuilder msg;
-  msg.Append("code-allocate,0x%x,0x%x\n",
-             reinterpret_cast<unsigned int>(code->address()),
-             reinterpret_cast<unsigned int>(assem));
+  msg.Append("code-allocate,0x%"V8PRIp",0x%"V8PRIp"\n", code->address(),  
assem);
    msg.WriteToLogFile();
  #endif
  }
@@ -964,9 +956,7 @@
  #ifdef ENABLE_LOGGING_AND_PROFILING
    if (!Log::is_enabled() || !FLAG_log_code) return;
    LogMessageBuilder msg;
-  msg.Append("code-move,0x%x,0x%x\n",
-             reinterpret_cast<unsigned int>(from),
-             reinterpret_cast<unsigned int>(to));
+  msg.Append("code-move,0x%"V8PRIp",0x%"V8PRIp"\n", from, to);
    msg.WriteToLogFile();
  #endif
  }
@@ -976,7 +966,7 @@
  #ifdef ENABLE_LOGGING_AND_PROFILING
    if (!Log::is_enabled() || !FLAG_log_code) return;
    LogMessageBuilder msg;
-  msg.Append("code-delete,0x%x\n", reinterpret_cast<unsigned int>(from));
+  msg.Append("code-delete,0x%"V8PRIp"\n", from);
    msg.WriteToLogFile();
  #endif
  }
@@ -1088,7 +1078,7 @@
      msg.Append(",overflow");
    }
    for (int i = 0; i < sample->frames_count; ++i) {
-    msg.Append(",0x%x", reinterpret_cast<uint32_t>(sample->stack[i]));
+    msg.Append(",0x%"V8PRIp, sample->stack[i]);
    }
    msg.Append('\n');
    msg.WriteToLogFile();
@@ -1189,7 +1179,7 @@
    // as log is initialized early with V8, we can assume that JS execution
    // frames can never reach this point on stack
    int stack_var;
-  ticker_ = new Ticker(1, reinterpret_cast<unsigned int>(&stack_var));
+  ticker_ = new Ticker(1, reinterpret_cast<uintptr_t>(&stack_var));

    if (FLAG_sliding_state_window && sliding_state_window_ == NULL) {
      sliding_state_window_ = new SlidingStateWindow();

Modified: branches/bleeding_edge/src/log.h
==============================================================================
--- branches/bleeding_edge/src/log.h    (original)
+++ branches/bleeding_edge/src/log.h    Thu May  7 02:27:42 2009
@@ -261,12 +261,12 @@
  // Class that extracts stack trace, used for profiling.
  class StackTracer BASE_EMBEDDED {
   public:
-  explicit StackTracer(unsigned int low_stack_bound)
+  explicit StackTracer(uintptr_t low_stack_bound)
        : low_stack_bound_(low_stack_bound) { }
    void Trace(TickSample* sample);
   private:

-  unsigned int low_stack_bound_;
+  uintptr_t low_stack_bound_;
  };



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

Reply via email to