#include "src/base/cpu.h"
#include "src/base/logging.h"
#include "src/base/platform/platform.h"
+#include "src/base/sys-info.h"
#include "src/d8-debug.h"
#include "src/debug.h"
#include "src/natives.h"
#if !defined(_WIN32) && !defined(_WIN64)
#include <unistd.h> // NOLINT
-#endif
+#else
+#include <windows.h> // NOLINT
+#if defined(_MSC_VER)
+#include <crtdbg.h> // NOLINT
+#endif // defined(_MSC_VER)
+#endif // !defined(_WIN32) && !defined(_WIN64)
#ifndef DCHECK
#define DCHECK(condition) assert(condition)
Isolate* v8_isolate = args.GetIsolate();
i::Heap* heap = reinterpret_cast<i::Isolate*>(v8_isolate)->heap();
args.GetReturnValue().Set(heap->synthetic_time());
-
} else {
base::TimeDelta delta =
base::TimeTicks::HighResolutionNow() - kInitialTicks;
class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
public:
- virtual void* Allocate(size_t) V8_OVERRIDE {
+ virtual void* Allocate(size_t) OVERRIDE {
return malloc(0);
}
- virtual void* AllocateUninitialized(size_t length) V8_OVERRIDE {
+ virtual void* AllocateUninitialized(size_t length) OVERRIDE {
return malloc(0);
}
- virtual void Free(void* p, size_t) V8_OVERRIDE {
+ virtual void Free(void* p, size_t) OVERRIDE {
free(p);
}
};
int Shell::Main(int argc, char* argv[]) {
+#if (defined(_WIN32) || defined(_WIN64))
+ UINT new_flags =
+ SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
+ UINT existing_flags = SetErrorMode(new_flags);
+ SetErrorMode(existing_flags | new_flags);
+#if defined(_MSC_VER)
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _set_error_mode(_OUT_TO_STDERR);
+#endif // defined(_MSC_VER)
+#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);
+ v8::V8::Initialize();
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
StartupDataHandler startup_data(options.natives_blob, options.snapshot_blob);
#endif
v8::V8::SetArrayBufferAllocator(&array_buffer_allocator);
}
int result = 0;
- Isolate* isolate = Isolate::New();
+ Isolate::CreateParams create_params;
+#if !defined(V8_SHARED) && defined(ENABLE_GDB_JIT_INTERFACE)
+ if (i::FLAG_gdbjit) {
+ create_params.code_event_handler = i::GDBJITInterface::EventHandler;
+ }
+#endif
+#ifdef ENABLE_VTUNE_JIT_INTERFACE
+ vTune::InitializeVtuneForV8(create_params);
+#endif
#ifndef V8_SHARED
- v8::ResourceConstraints constraints;
- constraints.ConfigureDefaults(base::OS::TotalPhysicalMemory(),
- base::OS::MaxVirtualMemory(),
- base::OS::NumberOfProcessorsOnline());
- v8::SetResourceConstraints(isolate, &constraints);
+ create_params.constraints.ConfigureDefaults(
+ base::SysInfo::AmountOfPhysicalMemory(),
+ base::SysInfo::AmountOfVirtualMemory(),
+ base::SysInfo::NumberOfProcessors());
#endif
+ Isolate* isolate = Isolate::New(create_params);
DumbLineEditor dumb_line_editor(isolate);
{
Isolate::Scope scope(isolate);
Initialize(isolate);
-#if !defined(V8_SHARED) && defined(ENABLE_GDB_JIT_INTERFACE)
- if (i::FLAG_gdbjit) {
- v8::V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault,
- i::GDBJITInterface::EventHandler);
- }
-#endif
-#ifdef ENABLE_VTUNE_JIT_INTERFACE
- vTune::InitializeVtuneForV8();
-#endif
PerIsolateData data(isolate);
InitializeDebugger(isolate);