From 3d1b3df9486c0e7708065257f7311902f6b7b366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Wed, 18 Oct 2017 15:03:02 -0700 Subject: deps: update V8 to 6.2.414.32 PR-URL: https://github.com/nodejs/node/pull/15362 Reviewed-By: Myles Borins Reviewed-By: Colin Ihrig Reviewed-By: Matteo Collina Reviewed-By: Ben Noordhuis --- deps/v8/src/log.cc | 194 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 144 insertions(+), 50 deletions(-) (limited to 'deps/v8/src/log.cc') diff --git a/deps/v8/src/log.cc b/deps/v8/src/log.cc index 83ca726c59..0ba024b987 100644 --- a/deps/v8/src/log.cc +++ b/deps/v8/src/log.cc @@ -850,7 +850,7 @@ void Logger::CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, ? static_cast(timer_.Elapsed().InMicroseconds()) : -1; msg.Append("code-deopt,%d,%d,", since_epoch, code->CodeSize()); - msg.AppendAddress(code->address()); + msg.AppendAddress(code->instruction_start()); // Deoptimization position. std::ostringstream deopt_location; @@ -884,7 +884,7 @@ void Logger::CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, void Logger::CurrentTimeEvent() { if (!log_->IsEnabled()) return; - DCHECK(FLAG_log_timer_events || FLAG_prof_cpp); + DCHECK(FLAG_log_internal_timer_events); Log::MessageBuilder msg(log_); int since_epoch = static_cast(timer_.Elapsed().InMicroseconds()); msg.Append("current-time,%d", since_epoch); @@ -1053,8 +1053,8 @@ void AppendCodeCreateHeader(Log::MessageBuilder* msg, ? static_cast(timer->Elapsed().InMicroseconds()) : -1; msg->Append("%d,", timestamp); - msg->AppendAddress(code->address()); - msg->Append(",%d,", code->ExecutableSize()); + msg->AppendAddress(code->instruction_start()); + msg->Append(",%d,", code->instruction_size()); } } // namespace @@ -1119,22 +1119,141 @@ void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, Name* source, int line, int column) { if (!is_logging_code_events()) return; if (!FLAG_log_code || !log_->IsEnabled()) return; - Log::MessageBuilder msg(log_); - AppendCodeCreateHeader(&msg, tag, code, &timer_); - std::unique_ptr name = - shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); - msg.Append("\"%s ", name.get()); - if (source->IsString()) { - std::unique_ptr sourcestr = String::cast(source)->ToCString( - DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); - msg.Append("%s", sourcestr.get()); - } else { - msg.AppendSymbolName(Symbol::cast(source)); + + { + Log::MessageBuilder msg(log_); + AppendCodeCreateHeader(&msg, tag, code, &timer_); + std::unique_ptr name = + shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); + msg.Append("\"%s ", name.get()); + if (source->IsString()) { + std::unique_ptr sourcestr = String::cast(source)->ToCString( + DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); + msg.Append("%s", sourcestr.get()); + } else { + msg.AppendSymbolName(Symbol::cast(source)); + } + msg.Append(":%d:%d\",", line, column); + msg.AppendAddress(shared->address()); + msg.Append(",%s", ComputeMarker(shared, code)); + msg.WriteToLogFile(); + } + + if (FLAG_log_source_code) { + Object* script_object = shared->script(); + if (script_object->IsScript()) { + // Make sure the script is written to the log file. + std::ostringstream os; + Script* script = Script::cast(script_object); + int script_id = script->id(); + if (logged_source_code_.find(script_id) == logged_source_code_.end()) { + // This script has not been logged yet. + logged_source_code_.insert(script_id); + Object* source_object = script->source(); + if (source_object->IsString()) { + Log::MessageBuilder msg(log_); + String* source_code = String::cast(source_object); + os << "script," << script_id << ",\""; + msg.AppendUnbufferedCString(os.str().c_str()); + + // Log the script name. + if (script->name()->IsString()) { + msg.AppendUnbufferedHeapString(String::cast(script->name())); + msg.AppendUnbufferedCString("\",\""); + } else { + msg.AppendUnbufferedCString("\",\""); + } + + // Log the source code. + msg.AppendUnbufferedHeapString(source_code); + os.str(""); + os << "\"" << std::endl; + msg.AppendUnbufferedCString(os.str().c_str()); + os.str(""); + } + } + + // We log source code information in the form: + // + // code-source-info ,