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

Unified Diff: src/codegen.cc

Issue 1297203002: Add CompileInfo::GetDebugName() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@interpreter_immed_bytecodes
Patch Set: Fix test crash Created 5 years, 4 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-hydrogen.cc ('k') | src/compiler.h » ('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 cc5495bc1b91612ca409d9eca06fd654ac3d3e17..0b130e987515589b1cd93691627de885eeb629ab 100644
--- a/src/codegen.cc
+++ b/src/codegen.cc
@@ -121,16 +121,8 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) {
}
if (FLAG_trace_codegen || print_source || print_ast) {
- PrintF("[generating %s code for %s function: ", kind, ftype);
- if (info->IsStub()) {
- const char* name =
- CodeStub::MajorName(info->code_stub()->MajorKey(), true);
- PrintF("%s", name == NULL ? "<unknown>" : name);
- } else {
- AllowDeferredHandleDereference allow_deference_for_trace;
- PrintF("%s", info->literal()->debug_name()->ToCString().get());
- }
- PrintF("]\n");
+ base::SmartArrayPointer<char> name = info->GetDebugName();
+ PrintF("[generating %s code for %s function: %s]", kind, ftype, name.get());
}
#ifdef DEBUG
@@ -153,11 +145,13 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
Isolate* isolate = info->isolate();
Code::Flags flags =
- info->code_stub() != nullptr
- ? Code::ComputeFlags(info->code_stub()->GetCodeKind(),
- info->code_stub()->GetICState(),
- info->code_stub()->GetExtraICState(),
- info->code_stub()->GetStubType())
+ info->IsStub()
+ ? info->code_stub()
+ ? Code::ComputeFlags(info->code_stub()->GetCodeKind(),
+ info->code_stub()->GetICState(),
+ info->code_stub()->GetExtraICState(),
+ info->code_stub()->GetStubType())
+ : Code::ComputeFlags(Code::STUB)
: Code::ComputeFlags(info->IsOptimizing() ? Code::OPTIMIZED_FUNCTION
: Code::FUNCTION);
@@ -189,16 +183,7 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
(info->IsStub() && FLAG_print_code_stubs) ||
(info->IsOptimizing() && FLAG_print_opt_code));
if (print_code) {
- const char* debug_name;
- base::SmartArrayPointer<char> debug_name_holder;
- if (info->IsStub()) {
- CodeStub::Major major_key = info->code_stub()->MajorKey();
- debug_name = CodeStub::MajorName(major_key, false);
- } else {
- debug_name_holder = info->literal()->debug_name()->ToCString();
- debug_name = debug_name_holder.get();
- }
-
+ base::SmartArrayPointer<char> debug_name = info->GetDebugName();
CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer());
OFStream os(tracing_scope.file());
@@ -228,7 +213,7 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
if (info->IsOptimizing()) {
if (FLAG_print_unopt_code && info->parse_info()) {
os << "--- Unoptimized code ---\n";
- info->closure()->shared()->code()->Disassemble(debug_name, os);
+ info->closure()->shared()->code()->Disassemble(debug_name.get(), os);
}
os << "--- Optimized code ---\n"
<< "optimization_id = " << info->optimization_id() << "\n";
@@ -239,7 +224,7 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
FunctionLiteral* literal = info->literal();
os << "source_position = " << literal->start_position() << "\n";
}
- code->Disassemble(debug_name, os);
+ code->Disassemble(debug_name.get(), os);
os << "--- End code ---\n";
}
#endif // ENABLE_DISASSEMBLER
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698