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

Unified Diff: src/codegen.cc

Issue 43273004: Allow redirecting disassembly and deoptimization traces into a file. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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/code-stubs.cc ('k') | src/d8.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen.cc
diff --git a/src/codegen.cc b/src/codegen.cc
index 7b2f81ba8ab0e3ea85595fd18ec6d3664904e71e..9d79617ea0fdcba51215d403c7a0074b50b6531e 100644
--- a/src/codegen.cc
+++ b/src/codegen.cc
@@ -136,10 +136,12 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
FunctionLiteral* function = info->function();
bool print_source = code->kind() == Code::OPTIMIZED_FUNCTION ||
code->kind() == Code::FUNCTION;
+
+ CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer());
if (print_source) {
Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
- PrintF("--- Raw source ---\n");
+ PrintF(tracing_scope.file(), "--- Raw source ---\n");
ConsStringIteratorOp op;
StringCharacterStream stream(String::cast(script->source()),
&op,
@@ -149,31 +151,36 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
int source_len =
function->end_position() - function->start_position() + 1;
for (int i = 0; i < source_len; i++) {
- if (stream.HasMore()) PrintF("%c", stream.GetNext());
+ if (stream.HasMore()) {
+ PrintF(tracing_scope.file(), "%c", stream.GetNext());
+ }
}
- PrintF("\n\n");
+ PrintF(tracing_scope.file(), "\n\n");
}
}
if (info->IsOptimizing()) {
if (FLAG_print_unopt_code) {
- PrintF("--- Unoptimized code ---\n");
+ PrintF(tracing_scope.file(), "--- Unoptimized code ---\n");
info->closure()->shared()->code()->Disassemble(
- *function->debug_name()->ToCString());
+ *function->debug_name()->ToCString(), tracing_scope.file());
}
- PrintF("--- Optimized code ---\n");
+ PrintF(tracing_scope.file(), "--- Optimized code ---\n");
} else {
- PrintF("--- Code ---\n");
+ PrintF(tracing_scope.file(), "--- Code ---\n");
}
if (print_source) {
- PrintF("source_position = %d\n", function->start_position());
+ PrintF(tracing_scope.file(),
+ "source_position = %d\n", function->start_position());
}
if (info->IsStub()) {
CodeStub::Major major_key = info->code_stub()->MajorKey();
- code->Disassemble(CodeStub::MajorName(major_key, false));
+ code->Disassemble(CodeStub::MajorName(major_key, false),
+ tracing_scope.file());
} else {
- code->Disassemble(*function->debug_name()->ToCString());
+ code->Disassemble(*function->debug_name()->ToCString(),
+ tracing_scope.file());
}
- PrintF("--- End code ---\n");
+ PrintF(tracing_scope.file(), "--- End code ---\n");
}
#endif // ENABLE_DISASSEMBLER
}
« no previous file with comments | « src/code-stubs.cc ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698