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

Unified Diff: src/isolate.cc

Issue 1104353003: Add flag to print stack-trace after n allocations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: trace stack for allocations Created 5 years, 8 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/isolate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index ff94105834004077bb8406dad939f42d83e8d6c7..b548fb3870e25c46aee565353770d6a44b2512e0 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -667,14 +667,14 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
}
-void Isolate::PrintStack(FILE* out) {
+void Isolate::PrintStack(FILE* out, PrintStackMode mode) {
if (stack_trace_nesting_level_ == 0) {
stack_trace_nesting_level_++;
StringStream::ClearMentionedObjectCache(this);
HeapStringAllocator allocator;
StringStream accumulator(&allocator);
incomplete_message_ = &accumulator;
- PrintStack(&accumulator);
+ PrintStack(&accumulator, mode);
accumulator.OutputToFile(out);
InitializeLoggingAndCounters();
accumulator.Log(this);
@@ -701,7 +701,7 @@ static void PrintFrames(Isolate* isolate,
}
-void Isolate::PrintStack(StringStream* accumulator) {
+void Isolate::PrintStack(StringStream* accumulator, PrintStackMode mode) {
// The MentionedObjectCache is not GC-proof at the moment.
DisallowHeapAllocation no_gc;
DCHECK(StringStream::IsMentionedObjectCacheClear(this));
@@ -712,12 +712,12 @@ void Isolate::PrintStack(StringStream* accumulator) {
accumulator->Add(
"\n==== JS stack trace =========================================\n\n");
PrintFrames(this, accumulator, StackFrame::OVERVIEW);
-
- accumulator->Add(
- "\n==== Details ================================================\n\n");
- PrintFrames(this, accumulator, StackFrame::DETAILS);
-
- accumulator->PrintMentionedObjectCache(this);
+ if (mode == kPrintStackVerbose) {
+ accumulator->Add(
+ "\n==== Details ================================================\n\n");
+ PrintFrames(this, accumulator, StackFrame::DETAILS);
+ accumulator->PrintMentionedObjectCache(this);
+ }
accumulator->Add("=====================\n\n");
}
« no previous file with comments | « src/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698