Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: src/log.cc

Issue 40290: Experimental: Merge 1395:1441 from bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/log.h ('k') | src/macro-assembler-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.cc
===================================================================
--- src/log.cc (revision 1441)
+++ src/log.cc (working copy)
@@ -137,16 +137,32 @@
// StackTracer implementation
//
void StackTracer::Trace(TickSample* sample) {
- // Assuming that stack grows from lower addresses
- if (sample->state != GC
- && (sample->sp < sample->fp && sample->fp < low_stack_bound_)) {
- sample->InitStack(1);
+ if (sample->state == GC) {
+ sample->frames_count = 0;
+ return;
+ }
+
+ // If c_entry_fp is available, this means that we are inside a C++
+ // function and sample->fp value isn't reliable due to FPO.
+ if (Top::c_entry_fp(Top::GetCurrentThread()) != NULL) {
+ SafeStackTraceFrameIterator it(
+ reinterpret_cast<Address>(sample->sp),
+ reinterpret_cast<Address>(low_stack_bound_));
+ int i = 0;
+ while (!it.done() && i < TickSample::kMaxFramesCount) {
+ sample->stack[i++] = it.frame()->pc();
+ it.Advance();
+ }
+ sample->frames_count = i;
+ } else if (sample->sp < sample->fp && sample->fp < low_stack_bound_) {
+ // The check assumes that stack grows from lower addresses.
sample->stack[0] = Memory::Address_at(
(Address)(sample->fp + StandardFrameConstants::kCallerPCOffset));
+ sample->frames_count = 1;
} else {
- // GC runs or FP seems to be in some intermediate state,
+ // FP seems to be in some intermediate state,
// better discard this sample
- sample->InitStack(0);
+ sample->frames_count = 0;
}
}
@@ -687,24 +703,13 @@
}
-#ifdef ENABLE_LOGGING_AND_PROFILING
-int Logger::CodeObjectSize(Code* code) {
- // Check that the assumptions about the layout of the code object holds.
- ASSERT_EQ(reinterpret_cast<unsigned int>(code->instruction_start()) -
- reinterpret_cast<unsigned int>(code->address()),
- Code::kHeaderSize);
- return code->instruction_size() + Code::kHeaderSize;
-}
-#endif
-
-
void Logger::CodeCreateEvent(const char* tag, Code* code, const char* comment) {
#ifdef ENABLE_LOGGING_AND_PROFILING
if (logfile_ == NULL || !FLAG_log_code) return;
LogMessageBuilder msg;
msg.Append("code-creation,%s,0x%x,%d,\"", tag,
reinterpret_cast<unsigned int>(code->address()),
- CodeObjectSize(code));
+ code->ExecutableSize());
for (const char* p = comment; *p != '\0'; p++) {
if (*p == '"') {
msg.Append('\\');
@@ -726,7 +731,7 @@
name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
msg.Append("code-creation,%s,0x%x,%d,\"%s\"\n", tag,
reinterpret_cast<unsigned int>(code->address()),
- CodeObjectSize(code), *str);
+ code->ExecutableSize(), *str);
msg.WriteToLogFile();
#endif
}
@@ -743,7 +748,7 @@
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()),
- CodeObjectSize(code),
+ code->ExecutableSize(),
*str, *sourcestr, line);
msg.WriteToLogFile();
#endif
@@ -756,7 +761,7 @@
LogMessageBuilder msg;
msg.Append("code-creation,%s,0x%x,%d,\"args_count: %d\"\n", tag,
reinterpret_cast<unsigned int>(code->address()),
- CodeObjectSize(code),
+ code->ExecutableSize(),
args_count);
msg.WriteToLogFile();
#endif
@@ -932,10 +937,8 @@
if (overflow) {
msg.Append(",overflow");
}
- if (*(sample->stack)) {
- for (size_t i = 0; sample->stack[i]; ++i) {
- msg.Append(",0x%x", reinterpret_cast<unsigned int>(sample->stack[i]));
- }
+ for (int i = 0; i < sample->frames_count; ++i) {
+ msg.Append(",%p", sample->stack[i]);
}
msg.Append('\n');
msg.WriteToLogFile();
« no previous file with comments | « src/log.h ('k') | src/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698