Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index 8bdf26f4c27bbb4bd063196b0be3ad76d6552d6f..43b867bafcd6384d55f893e52174cb9de21cc718 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -34,9 +34,9 @@ |
#endif |
#include "src/d8.h" |
+#include "src/api.h" |
#ifndef V8_SHARED |
-#include "src/api.h" |
#include "src/base/cpu.h" |
#include "src/base/logging.h" |
#include "src/base/platform/platform.h" |
@@ -46,6 +46,8 @@ |
#include "src/v8.h" |
#endif // !V8_SHARED |
+#include "src/sampler-thread.h" |
+ |
#if !defined(_WIN32) && !defined(_WIN64) |
#include <unistd.h> // NOLINT |
#endif |
@@ -1158,6 +1160,7 @@ void SourceGroup::Execute(Isolate* isolate) { |
} else if (arg[0] == '-') { |
// Ignore other options. They have been parsed already. |
} else { |
+ v8::SamplerThread* sampler = new SamplerThread(isolate); |
// Use all other arguments as names of files to load and run. |
HandleScope handle_scope(isolate); |
Handle<String> file_name = String::NewFromUtf8(isolate, arg); |
@@ -1166,10 +1169,12 @@ void SourceGroup::Execute(Isolate* isolate) { |
printf("Error reading '%s'\n", arg); |
Shell::Exit(1); |
} |
+ sampler->Start(); |
if (!Shell::ExecuteString(isolate, source, file_name, false, true)) { |
exception_was_thrown = true; |
break; |
} |
+ sampler->Stop(); |
} |
} |
if (exception_was_thrown != Shell::options.expected_to_throw) { |
@@ -1365,6 +1370,8 @@ bool Shell::SetOptions(int argc, char* argv[]) { |
int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) { |
+ v8::SamplerThread* sampler = new SamplerThread(isolate); |
+ delete sampler; |
#ifndef V8_SHARED |
for (int i = 1; i < options.num_isolates; ++i) { |
options.isolate_sources[i].StartExecuteInThread(); |