Index: src/runtime/runtime-internal.cc |
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc |
index 54337bf86dfbf99e6a12e955356371b103b664f5..e3890df342ed414eeb68aa9425755d46a737f10f 100644 |
--- a/src/runtime/runtime-internal.cc |
+++ b/src/runtime/runtime-internal.cc |
@@ -550,7 +550,7 @@ RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) { |
isolate->counters()->runtime_call_stats()->Reset(); |
return *result; |
} else { |
- DCHECK_EQ(1, args.length()); |
+ DCHECK_LE(args.length(), 2); |
std::FILE* f; |
if (args[0]->IsString()) { |
// With a string argument, the results are appended to that file. |
@@ -566,6 +566,13 @@ RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) { |
DCHECK(fd == 1 || fd == 2); |
f = fd == 1 ? stdout : stderr; |
} |
+ // The second argument (if any) is a message header to be printed. |
+ if (args.length() >= 2) { |
+ CONVERT_ARG_HANDLE_CHECKED(String, arg1, 1); |
+ arg1->PrintOn(f); |
+ std::fputc('\n', f); |
+ std::fflush(f); |
+ } |
OFStream stats_stream(f); |
isolate->counters()->runtime_call_stats()->Print(stats_stream); |
isolate->counters()->runtime_call_stats()->Reset(); |