namespace internal {
namespace compiler {
+
+FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase,
+ const char* suffix, const char* mode) {
+ EmbeddedVector<char, 256> filename;
+ SmartArrayPointer<char> function_name;
+ if (!info->shared_info().is_null()) {
+ function_name = info->shared_info()->DebugName()->ToCString();
+ if (strlen(function_name.get()) > 0) {
+ SNPrintF(filename, "turbo-%s", function_name.get());
+ } else {
+ SNPrintF(filename, "turbo-%p", static_cast<void*>(info));
+ }
+ } else {
+ SNPrintF(filename, "turbo-none-%s", phase);
+ }
+ std::replace(filename.start(), filename.start() + filename.length(), ' ',
+ '_');
+
+ EmbeddedVector<char, 256> full_filename;
+ if (phase == NULL) {
+ SNPrintF(full_filename, "%s.%s", filename.start(), suffix);
+ } else {
+ SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix);
+ }
+ return base::OS::FOpen(full_filename.start(), mode);
+}
+
+
static int SafeId(Node* node) { return node == NULL ? -1 : node->id(); }
static const char* SafeMnemonic(Node* node) {
return node == NULL ? "null" : node->op()->mnemonic();
};
-namespace {
-
-FILE* OpenLogFile(CompilationInfo* info, const char* phase, const char* suffix,
- const char* mode) {
- EmbeddedVector<char, 256> filename;
- SmartArrayPointer<char> function_name;
- if (!info->shared_info().is_null()) {
- function_name = info->shared_info()->DebugName()->ToCString();
- if (strlen(function_name.get()) > 0) {
- SNPrintF(filename, "turbo-%s", function_name.get());
- } else {
- SNPrintF(filename, "turbo-%p", static_cast<void*>(info));
- }
- } else {
- SNPrintF(filename, "turbo-none-%s", phase);
- }
- std::replace(filename.start(), filename.start() + filename.length(), ' ',
- '_');
-
- EmbeddedVector<char, 256> full_filename;
- if (phase == NULL) {
- SNPrintF(full_filename, "%s.%s", filename.start(), suffix);
- } else {
- SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix);
- }
- return base::OS::FOpen(full_filename.start(), mode);
-}
-}
-
struct PrintGraphPhase {
static const char* phase_name() { return nullptr; }
Graph* graph = data->graph();
{ // Print dot.
- FILE* dot_file = OpenLogFile(info, phase, "dot", "w+");
+ FILE* dot_file = OpenVisualizerLogFile(info, phase, "dot", "w+");
if (dot_file == nullptr) return;
OFStream dot_of(dot_file);
dot_of << AsDOT(*graph);
}
{ // Print JSON.
- FILE* json_file = OpenLogFile(info, NULL, "json", "a+");
+ FILE* json_file = OpenVisualizerLogFile(info, NULL, "json", "a+");
if (json_file == nullptr) return;
OFStream json_of(json_file);
json_of << "{\"name\":\"" << phase << "\",\"type\":\"graph\",\"data\":"
}
if (FLAG_trace_turbo) {
- FILE* json_file = OpenLogFile(info(), NULL, "json", "w+");
+ FILE* json_file = OpenVisualizerLogFile(info(), NULL, "json", "w+");
if (json_file != nullptr) {
OFStream json_of(json_file);
Handle<Script> script = info()->script();
v8::internal::CodeGenerator::PrintCode(code, info());
if (FLAG_trace_turbo) {
- FILE* json_file = OpenLogFile(info(), NULL, "json", "a+");
+ FILE* json_file = OpenVisualizerLogFile(info(), NULL, "json", "a+");
if (json_file != nullptr) {
OFStream json_of(json_file);
json_of
DEFINE_BOOL(turbo_types, true, "use typed lowering in TurboFan")
DEFINE_BOOL(turbo_source_positions, false,
"track source code positions when building TurboFan IR")
+DEFINE_IMPLICATION(trace_turbo, turbo_source_positions)
DEFINE_BOOL(context_specialization, false,
"enable context specialization in TurboFan")
DEFINE_BOOL(turbo_deoptimization, false, "enable deoptimization in TurboFan")