Commit 8d57bc5a authored by lrn@chromium.org's avatar lrn@chromium.org

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

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1893 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3e82fce4
...@@ -76,11 +76,17 @@ typedef byte* Address; ...@@ -76,11 +76,17 @@ typedef byte* Address;
#ifdef _MSC_VER #ifdef _MSC_VER
#define V8_UINT64_C(x) (x ## UI64) #define V8_UINT64_C(x) (x ## UI64)
#define V8_INT64_C(x) (x ## I64) #define V8_INT64_C(x) (x ## I64)
#define V8_PTR_PREFIX "ll"
#else #else
#define V8_UINT64_C(x) (x ## UL) #define V8_UINT64_C(x) (x ## UL)
#define V8_INT64_C(x) (x ## L) #define V8_INT64_C(x) (x ## L)
#define V8_PTR_PREFIX "l"
#endif #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. // Code-point values in Unicode 4.0 are 21 bits wide.
typedef uint16_t uc16; typedef uint16_t uc16;
......
...@@ -164,7 +164,7 @@ void StackTracer::Trace(TickSample* sample) { ...@@ -164,7 +164,7 @@ void StackTracer::Trace(TickSample* sample) {
// //
class Ticker: public Sampler { class Ticker: public Sampler {
public: 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), Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL),
stack_tracer_(low_stack_bound) {} stack_tracer_(low_stack_bound) {}
...@@ -630,8 +630,7 @@ void Logger::HandleEvent(const char* name, Object** location) { ...@@ -630,8 +630,7 @@ void Logger::HandleEvent(const char* name, Object** location) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
if (!Log::is_enabled() || !FLAG_log_handles) return; if (!Log::is_enabled() || !FLAG_log_handles) return;
LogMessageBuilder msg; LogMessageBuilder msg;
msg.Append("%s,0x%x\n", name, msg.Append("%s,0x%%"V8PRIp"\n", name, location);
reinterpret_cast<unsigned int>(location));
msg.WriteToLogFile(); msg.WriteToLogFile();
#endif #endif
} }
...@@ -850,8 +849,7 @@ void Logger::NewEvent(const char* name, void* object, size_t size) { ...@@ -850,8 +849,7 @@ void Logger::NewEvent(const char* name, void* object, size_t size) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
if (!Log::is_enabled() || !FLAG_log) return; if (!Log::is_enabled() || !FLAG_log) return;
LogMessageBuilder msg; LogMessageBuilder msg;
msg.Append("new,%s,0x%x,%u\n", name, msg.Append("new,%s,0x%%"V8PRIp",%u\n", name, object,
reinterpret_cast<unsigned int>(object),
static_cast<unsigned int>(size)); static_cast<unsigned int>(size));
msg.WriteToLogFile(); msg.WriteToLogFile();
#endif #endif
...@@ -862,8 +860,7 @@ void Logger::DeleteEvent(const char* name, void* object) { ...@@ -862,8 +860,7 @@ void Logger::DeleteEvent(const char* name, void* object) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
if (!Log::is_enabled() || !FLAG_log) return; if (!Log::is_enabled() || !FLAG_log) return;
LogMessageBuilder msg; LogMessageBuilder msg;
msg.Append("delete,%s,0x%x\n", name, msg.Append("delete,%s,0x%%"V8PRIp"\n", name, object);
reinterpret_cast<unsigned int>(object));
msg.WriteToLogFile(); msg.WriteToLogFile();
#endif #endif
} }
...@@ -873,8 +870,7 @@ void Logger::CodeCreateEvent(const char* tag, Code* code, const char* comment) { ...@@ -873,8 +870,7 @@ void Logger::CodeCreateEvent(const char* tag, Code* code, const char* comment) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
if (!Log::is_enabled() || !FLAG_log_code) return; if (!Log::is_enabled() || !FLAG_log_code) return;
LogMessageBuilder msg; LogMessageBuilder msg;
msg.Append("code-creation,%s,0x%x,%d,\"", tag, msg.Append("code-creation,%s,0x%"V8PRIp",%d,\"", tag, code->address(),
reinterpret_cast<unsigned int>(code->address()),
code->ExecutableSize()); code->ExecutableSize());
for (const char* p = comment; *p != '\0'; p++) { for (const char* p = comment; *p != '\0'; p++) {
if (*p == '"') { if (*p == '"') {
...@@ -895,8 +891,7 @@ void Logger::CodeCreateEvent(const char* tag, Code* code, String* name) { ...@@ -895,8 +891,7 @@ void Logger::CodeCreateEvent(const char* tag, Code* code, String* name) {
LogMessageBuilder msg; LogMessageBuilder msg;
SmartPointer<char> str = SmartPointer<char> str =
name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
msg.Append("code-creation,%s,0x%x,%d,\"%s\"\n", tag, msg.Append("code-creation,%s,0x%"V8PRIp",%d,\"%s\"\n", tag, code->address(),
reinterpret_cast<unsigned int>(code->address()),
code->ExecutableSize(), *str); code->ExecutableSize(), *str);
msg.WriteToLogFile(); msg.WriteToLogFile();
#endif #endif
...@@ -912,8 +907,7 @@ void Logger::CodeCreateEvent(const char* tag, Code* code, String* name, ...@@ -912,8 +907,7 @@ void Logger::CodeCreateEvent(const char* tag, Code* code, String* name,
name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
SmartPointer<char> sourcestr = SmartPointer<char> sourcestr =
source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
msg.Append("code-creation,%s,0x%x,%d,\"%s %s:%d\"\n", tag, msg.Append("code-creation,%s,0x%"V8PRIp",%d,\"%s %s:%d\"\n", tag, code->address(),
reinterpret_cast<unsigned int>(code->address()),
code->ExecutableSize(), code->ExecutableSize(),
*str, *sourcestr, line); *str, *sourcestr, line);
msg.WriteToLogFile(); msg.WriteToLogFile();
...@@ -925,8 +919,8 @@ void Logger::CodeCreateEvent(const char* tag, Code* code, int args_count) { ...@@ -925,8 +919,8 @@ void Logger::CodeCreateEvent(const char* tag, Code* code, int args_count) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
if (!Log::is_enabled() || !FLAG_log_code) return; if (!Log::is_enabled() || !FLAG_log_code) return;
LogMessageBuilder msg; LogMessageBuilder msg;
msg.Append("code-creation,%s,0x%x,%d,\"args_count: %d\"\n", tag, msg.Append("code-creation,%s,0x%"V8PRIp",%d,\"args_count: %d\"\n", tag,
reinterpret_cast<unsigned int>(code->address()), code->address(),
code->ExecutableSize(), code->ExecutableSize(),
args_count); args_count);
msg.WriteToLogFile(); msg.WriteToLogFile();
...@@ -938,8 +932,8 @@ void Logger::RegExpCodeCreateEvent(Code* code, String* source) { ...@@ -938,8 +932,8 @@ void Logger::RegExpCodeCreateEvent(Code* code, String* source) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
if (!Log::is_enabled() || !FLAG_log_code) return; if (!Log::is_enabled() || !FLAG_log_code) return;
LogMessageBuilder msg; LogMessageBuilder msg;
msg.Append("code-creation,%s,0x%x,%d,\"", "RegExp", msg.Append("code-creation,%s,0x%"V8PRIp",%d,\"", "RegExp",
reinterpret_cast<unsigned int>(code->address()), code->address(),
code->ExecutableSize()); code->ExecutableSize());
msg.AppendDetailed(source, false); msg.AppendDetailed(source, false);
msg.Append("\"\n"); msg.Append("\"\n");
...@@ -952,9 +946,7 @@ void Logger::CodeAllocateEvent(Code* code, Assembler* assem) { ...@@ -952,9 +946,7 @@ void Logger::CodeAllocateEvent(Code* code, Assembler* assem) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
if (!Log::is_enabled() || !FLAG_log_code) return; if (!Log::is_enabled() || !FLAG_log_code) return;
LogMessageBuilder msg; LogMessageBuilder msg;
msg.Append("code-allocate,0x%x,0x%x\n", msg.Append("code-allocate,0x%"V8PRIp",0x%"V8PRIp"\n", code->address(), assem);
reinterpret_cast<unsigned int>(code->address()),
reinterpret_cast<unsigned int>(assem));
msg.WriteToLogFile(); msg.WriteToLogFile();
#endif #endif
} }
...@@ -964,9 +956,7 @@ void Logger::CodeMoveEvent(Address from, Address to) { ...@@ -964,9 +956,7 @@ void Logger::CodeMoveEvent(Address from, Address to) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
if (!Log::is_enabled() || !FLAG_log_code) return; if (!Log::is_enabled() || !FLAG_log_code) return;
LogMessageBuilder msg; LogMessageBuilder msg;
msg.Append("code-move,0x%x,0x%x\n", msg.Append("code-move,0x%"V8PRIp",0x%"V8PRIp"\n", from, to);
reinterpret_cast<unsigned int>(from),
reinterpret_cast<unsigned int>(to));
msg.WriteToLogFile(); msg.WriteToLogFile();
#endif #endif
} }
...@@ -976,7 +966,7 @@ void Logger::CodeDeleteEvent(Address from) { ...@@ -976,7 +966,7 @@ void Logger::CodeDeleteEvent(Address from) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
if (!Log::is_enabled() || !FLAG_log_code) return; if (!Log::is_enabled() || !FLAG_log_code) return;
LogMessageBuilder msg; LogMessageBuilder msg;
msg.Append("code-delete,0x%x\n", reinterpret_cast<unsigned int>(from)); msg.Append("code-delete,0x%"V8PRIp"\n", from);
msg.WriteToLogFile(); msg.WriteToLogFile();
#endif #endif
} }
...@@ -1088,7 +1078,7 @@ void Logger::TickEvent(TickSample* sample, bool overflow) { ...@@ -1088,7 +1078,7 @@ void Logger::TickEvent(TickSample* sample, bool overflow) {
msg.Append(",overflow"); msg.Append(",overflow");
} }
for (int i = 0; i < sample->frames_count; ++i) { 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.Append('\n');
msg.WriteToLogFile(); msg.WriteToLogFile();
...@@ -1189,7 +1179,7 @@ bool Logger::Setup() { ...@@ -1189,7 +1179,7 @@ bool Logger::Setup() {
// as log is initialized early with V8, we can assume that JS execution // as log is initialized early with V8, we can assume that JS execution
// frames can never reach this point on stack // frames can never reach this point on stack
int stack_var; 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) { if (FLAG_sliding_state_window && sliding_state_window_ == NULL) {
sliding_state_window_ = new SlidingStateWindow(); sliding_state_window_ = new SlidingStateWindow();
......
...@@ -261,12 +261,12 @@ class Logger { ...@@ -261,12 +261,12 @@ class Logger {
// Class that extracts stack trace, used for profiling. // Class that extracts stack trace, used for profiling.
class StackTracer BASE_EMBEDDED { class StackTracer BASE_EMBEDDED {
public: public:
explicit StackTracer(unsigned int low_stack_bound) explicit StackTracer(uintptr_t low_stack_bound)
: low_stack_bound_(low_stack_bound) { } : low_stack_bound_(low_stack_bound) { }
void Trace(TickSample* sample); void Trace(TickSample* sample);
private: private:
unsigned int low_stack_bound_; uintptr_t low_stack_bound_;
}; };
......
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