summaryrefslogtreecommitdiff
path: root/deps/v8/src/d8.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/d8.cc')
-rw-r--r--deps/v8/src/d8.cc36
1 files changed, 22 insertions, 14 deletions
diff --git a/deps/v8/src/d8.cc b/deps/v8/src/d8.cc
index 7fa6f8c42e..38a4b8ec1a 100644
--- a/deps/v8/src/d8.cc
+++ b/deps/v8/src/d8.cc
@@ -45,7 +45,7 @@
#include "src/basic-block-profiler.h"
#include "src/d8-debug.h"
#include "src/debug.h"
-#include "src/natives.h"
+#include "src/snapshot/natives.h"
#include "src/v8.h"
#endif // !V8_SHARED
@@ -72,6 +72,10 @@
namespace v8 {
+namespace {
+v8::Platform* g_platform = NULL;
+} // namespace
+
static Handle<Value> Throw(Isolate* isolate, const char* message) {
return isolate->ThrowException(String::NewFromUtf8(isolate, message));
@@ -963,15 +967,9 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
void Shell::Initialize(Isolate* isolate) {
#ifndef V8_SHARED
- Shell::counter_map_ = new CounterMap();
// Set up counters
if (i::StrLength(i::FLAG_map_counters) != 0)
MapCounters(isolate, i::FLAG_map_counters);
- if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) {
- isolate->SetCounterFunction(LookupCounter);
- isolate->SetCreateHistogramFunction(CreateHistogram);
- isolate->SetAddHistogramSampleFunction(AddHistogramSample);
- }
#endif // !V8_SHARED
}
@@ -1295,9 +1293,11 @@ void SourceGroup::ExecuteInThread() {
}
}
if (Shell::options.send_idle_notification) {
- const int kLongIdlePauseInMs = 1000;
+ const double kLongIdlePauseInSeconds = 1.0;
isolate->ContextDisposedNotification();
- isolate->IdleNotification(kLongIdlePauseInMs);
+ isolate->IdleNotificationDeadline(
+ g_platform->MonotonicallyIncreasingTime() +
+ kLongIdlePauseInSeconds);
}
if (Shell::options.invoke_weak_callbacks) {
// By sending a low memory notifications, we will try hard to collect
@@ -1493,9 +1493,10 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) {
}
}
if (options.send_idle_notification) {
- const int kLongIdlePauseInMs = 1000;
+ const double kLongIdlePauseInSeconds = 1.0;
isolate->ContextDisposedNotification();
- isolate->IdleNotification(kLongIdlePauseInMs);
+ isolate->IdleNotificationDeadline(
+ g_platform->MonotonicallyIncreasingTime() + kLongIdlePauseInSeconds);
}
if (options.invoke_weak_callbacks) {
// By sending a low memory notifications, we will try hard to collect all
@@ -1607,8 +1608,8 @@ int Shell::Main(int argc, char* argv[]) {
#endif // defined(_WIN32) || defined(_WIN64)
if (!SetOptions(argc, argv)) return 1;
v8::V8::InitializeICU(options.icu_data_file);
- v8::Platform* platform = v8::platform::CreateDefaultPlatform();
- v8::V8::InitializePlatform(platform);
+ g_platform = v8::platform::CreateDefaultPlatform();
+ v8::V8::InitializePlatform(g_platform);
v8::V8::Initialize();
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
v8::StartupDataHandler startup_data(argv[0], options.natives_blob,
@@ -1639,6 +1640,13 @@ int Shell::Main(int argc, char* argv[]) {
base::SysInfo::AmountOfPhysicalMemory(),
base::SysInfo::AmountOfVirtualMemory(),
base::SysInfo::NumberOfProcessors());
+
+ Shell::counter_map_ = new CounterMap();
+ if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) {
+ create_params.counter_lookup_callback = LookupCounter;
+ create_params.create_histogram_callback = CreateHistogram;
+ create_params.add_histogram_sample_callback = AddHistogramSample;
+ }
#endif
Isolate* isolate = Isolate::New(create_params);
DumbLineEditor dumb_line_editor(isolate);
@@ -1704,7 +1712,7 @@ int Shell::Main(int argc, char* argv[]) {
isolate->Dispose();
V8::Dispose();
V8::ShutdownPlatform();
- delete platform;
+ delete g_platform;
return result;
}