| Index: src/log.cc
|
| diff --git a/src/log.cc b/src/log.cc
|
| index 4230cba91ada710b9e0372cf86f70c5e3a88202a..98e9b92873665d53d91ca05c90875a0b72724a45 100644
|
| --- a/src/log.cc
|
| +++ b/src/log.cc
|
| @@ -765,6 +765,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
|
| msg.Append(*p);
|
| }
|
| msg.Append('"');
|
| + LowLevelCodeCreateEvent(code, &msg);
|
| if (FLAG_compress_log) {
|
| ASSERT(compression_helper_ != NULL);
|
| if (!compression_helper_->HandleMessage(&msg)) return;
|
| @@ -784,6 +785,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name) {
|
| msg.Append("%s,%s,", log_events_[CODE_CREATION_EVENT], log_events_[tag]);
|
| msg.AppendAddress(code->address());
|
| msg.Append(",%d,\"%s\"", code->ExecutableSize(), *str);
|
| + LowLevelCodeCreateEvent(code, &msg);
|
| if (FLAG_compress_log) {
|
| ASSERT(compression_helper_ != NULL);
|
| if (!compression_helper_->HandleMessage(&msg)) return;
|
| @@ -808,6 +810,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
|
| msg.AppendAddress(code->address());
|
| msg.Append(",%d,\"%s %s:%d\"",
|
| code->ExecutableSize(), *str, *sourcestr, line);
|
| + LowLevelCodeCreateEvent(code, &msg);
|
| if (FLAG_compress_log) {
|
| ASSERT(compression_helper_ != NULL);
|
| if (!compression_helper_->HandleMessage(&msg)) return;
|
| @@ -825,6 +828,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) {
|
| msg.Append("%s,%s,", log_events_[CODE_CREATION_EVENT], log_events_[tag]);
|
| msg.AppendAddress(code->address());
|
| msg.Append(",%d,\"args_count: %d\"", code->ExecutableSize(), args_count);
|
| + LowLevelCodeCreateEvent(code, &msg);
|
| if (FLAG_compress_log) {
|
| ASSERT(compression_helper_ != NULL);
|
| if (!compression_helper_->HandleMessage(&msg)) return;
|
| @@ -835,6 +839,17 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) {
|
| }
|
|
|
|
|
| +void Logger::CodeMovingGCEvent() {
|
| +#ifdef ENABLE_LOGGING_AND_PROFILING
|
| + if (!Log::IsEnabled() || !FLAG_log_code || !FLAG_ll_prof) return;
|
| + LogMessageBuilder msg;
|
| + msg.Append("%s\n", log_events_[CODE_MOVING_GC]);
|
| + msg.WriteToLogFile();
|
| + OS::SignalCodeMovingGC();
|
| +#endif
|
| +}
|
| +
|
| +
|
| void Logger::RegExpCodeCreateEvent(Code* code, String* source) {
|
| #ifdef ENABLE_LOGGING_AND_PROFILING
|
| if (!Log::IsEnabled() || !FLAG_log_code) return;
|
| @@ -845,6 +860,7 @@ void Logger::RegExpCodeCreateEvent(Code* code, String* source) {
|
| msg.Append(",%d,\"", code->ExecutableSize());
|
| msg.AppendDetailed(source, false);
|
| msg.Append('\"');
|
| + LowLevelCodeCreateEvent(code, &msg);
|
| if (FLAG_compress_log) {
|
| ASSERT(compression_helper_ != NULL);
|
| if (!compression_helper_->HandleMessage(&msg)) return;
|
| @@ -1340,6 +1356,34 @@ void Logger::LogCodeObject(Object* object) {
|
| }
|
|
|
|
|
| +void Logger::LogCodeInfo() {
|
| +#ifdef ENABLE_LOGGING_AND_PROFILING
|
| + if (!Log::IsEnabled() || !FLAG_log_code || !FLAG_ll_prof) return;
|
| +#if V8_TARGET_ARCH_IA32
|
| + const char arch[] = "ia32";
|
| +#elif V8_TARGET_ARCH_X64
|
| + const char arch[] = "x64";
|
| +#elif V8_TARGET_ARCH_ARM
|
| + const char arch[] = "arm";
|
| +#else
|
| + const char arch[] = "unknown";
|
| +#endif
|
| + LogMessageBuilder msg;
|
| + msg.Append("code-info,%s,%d\n", arch, Code::kHeaderSize);
|
| + msg.WriteToLogFile();
|
| +#endif // ENABLE_LOGGING_AND_PROFILING
|
| +}
|
| +
|
| +
|
| +void Logger::LowLevelCodeCreateEvent(Code* code, LogMessageBuilder* msg) {
|
| + if (!FLAG_ll_prof || Log::output_code_handle_ == NULL) return;
|
| + int pos = static_cast<int>(ftell(Log::output_code_handle_));
|
| + fwrite(code->instruction_start(), 1, code->instruction_size(),
|
| + Log::output_code_handle_);
|
| + msg->Append(",%d", pos);
|
| +}
|
| +
|
| +
|
| void Logger::LogCodeObjects() {
|
| AssertNoAllocation no_alloc;
|
| HeapIterator iterator;
|
| @@ -1451,6 +1495,12 @@ bool Logger::Setup() {
|
| // --prof implies --log-code.
|
| if (FLAG_prof) FLAG_log_code = true;
|
|
|
| + // --ll-prof implies --log-code and --log-snapshot-positions.
|
| + if (FLAG_ll_prof) {
|
| + FLAG_log_code = true;
|
| + FLAG_log_snapshot_positions = true;
|
| + }
|
| +
|
| // --prof_lazy controls --log-code, implies --noprof_auto.
|
| if (FLAG_prof_lazy) {
|
| FLAG_log_code = false;
|
| @@ -1512,6 +1562,8 @@ bool Logger::Setup() {
|
|
|
| ASSERT(VMState::is_outermost_external());
|
|
|
| + if (FLAG_ll_prof) LogCodeInfo();
|
| +
|
| ticker_ = new Ticker(kSamplingIntervalMs);
|
|
|
| if (FLAG_sliding_state_window && sliding_state_window_ == NULL) {
|
|
|