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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 1913973004: Include file names in hydrogen logs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix optimization id collection Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/allocation-site-scopes.h" 9 #include "src/allocation-site-scopes.h"
10 #include "src/ast/ast-numbering.h" 10 #include "src/ast/ast-numbering.h"
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 1371
1372 int inline_id = static_cast<int>(info_->inlined_function_infos().size()); 1372 int inline_id = static_cast<int>(info_->inlined_function_infos().size());
1373 InlinedFunctionInfo info(parent_id, position, UnboundScript::kNoScriptId, 1373 InlinedFunctionInfo info(parent_id, position, UnboundScript::kNoScriptId,
1374 shared->start_position()); 1374 shared->start_position());
1375 if (!shared->script()->IsUndefined()) { 1375 if (!shared->script()->IsUndefined()) {
1376 Handle<Script> script(Script::cast(shared->script())); 1376 Handle<Script> script(Script::cast(shared->script()));
1377 info.script_id = script->id(); 1377 info.script_id = script->id();
1378 1378
1379 if (FLAG_hydrogen_track_positions && !script->source()->IsUndefined()) { 1379 if (FLAG_hydrogen_track_positions && !script->source()->IsUndefined()) {
1380 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); 1380 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
1381 Object* source_name = script->name();
1381 OFStream os(tracing_scope.file()); 1382 OFStream os(tracing_scope.file());
1382 os << "--- FUNCTION SOURCE (" << shared->DebugName()->ToCString().get() 1383 os << "--- FUNCTION SOURCE (";
1383 << ") id{" << info_->optimization_id() << "," << inline_id 1384 if (source_name->IsString()) {
1384 << "} ---\n"; 1385 os << String::cast(source_name)->ToCString().get() << ":";
1386 }
1387 os << shared->DebugName()->ToCString().get() << ") id{";
1388 os << info_->optimization_id() << "," << inline_id << "} ---\n";
1385 { 1389 {
1386 DisallowHeapAllocation no_allocation; 1390 DisallowHeapAllocation no_allocation;
1387 int start = shared->start_position(); 1391 int start = shared->start_position();
1388 int len = shared->end_position() - start; 1392 int len = shared->end_position() - start;
1389 String::SubStringRange source(String::cast(script->source()), start, 1393 String::SubStringRange source(String::cast(script->source()), start,
1390 len); 1394 len);
1391 for (const auto& c : source) { 1395 for (const auto& c : source) {
1392 os << AsReversiblyEscapedUC16(c); 1396 os << AsReversiblyEscapedUC16(c);
1393 } 1397 }
1394 } 1398 }
(...skipping 12043 matching lines...) Expand 10 before | Expand all | Expand 10 after
13438 os << "NULL"; 13442 os << "NULL";
13439 } 13443 }
13440 os << "\n"; 13444 os << "\n";
13441 } 13445 }
13442 return os << "\n"; 13446 return os << "\n";
13443 } 13447 }
13444 13448
13445 13449
13446 void HTracer::TraceCompilation(CompilationInfo* info) { 13450 void HTracer::TraceCompilation(CompilationInfo* info) {
13447 Tag tag(this, "compilation"); 13451 Tag tag(this, "compilation");
13448 base::SmartArrayPointer<char> name = info->GetDebugName(); 13452 std::string name;
13453 Object* source_name = info->script()->name();
13454 if (source_name->IsString()) {
13455 String* str = String::cast(source_name);
13456 if (str->length() > 0) {
13457 name.append(str->ToCString().get());
13458 name.append(":");
13459 }
13460 }
13461 base::SmartArrayPointer<char> method_name = info->GetDebugName();
13462 name.append(method_name.get());
13449 if (info->IsOptimizing()) { 13463 if (info->IsOptimizing()) {
13450 PrintStringProperty("name", name.get()); 13464 PrintStringProperty("name", name.c_str());
13451 PrintIndent(); 13465 PrintIndent();
13452 trace_.Add("method \"%s:%d\"\n", name.get(), info->optimization_id()); 13466 trace_.Add("method \"%s:%d\"\n", method_name.get(),
13467 info->optimization_id());
13453 } else { 13468 } else {
13454 PrintStringProperty("name", name.get()); 13469 PrintStringProperty("name", name.c_str());
13455 PrintStringProperty("method", "stub"); 13470 PrintStringProperty("method", "stub");
13456 } 13471 }
13457 PrintLongProperty("date", 13472 PrintLongProperty("date",
13458 static_cast<int64_t>(base::OS::TimeCurrentMillis())); 13473 static_cast<int64_t>(base::OS::TimeCurrentMillis()));
13459 } 13474 }
13460 13475
13461 13476
13462 void HTracer::TraceLithium(const char* name, LChunk* chunk) { 13477 void HTracer::TraceLithium(const char* name, LChunk* chunk) {
13463 DCHECK(!chunk->isolate()->concurrent_recompilation_enabled()); 13478 DCHECK(!chunk->isolate()->concurrent_recompilation_enabled());
13464 AllowHandleDereference allow_deref; 13479 AllowHandleDereference allow_deref;
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
13769 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13784 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13770 } 13785 }
13771 13786
13772 #ifdef DEBUG 13787 #ifdef DEBUG
13773 graph_->Verify(false); // No full verify. 13788 graph_->Verify(false); // No full verify.
13774 #endif 13789 #endif
13775 } 13790 }
13776 13791
13777 } // namespace internal 13792 } // namespace internal
13778 } // namespace v8 13793 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698