| Index: src/v8.cc
|
| diff --git a/src/v8.cc b/src/v8.cc
|
| index c35230d053b4866bffc16797ae650a68ea5b6110..0f01818ecd99812c11f231b01d098a28746d6e39 100644
|
| --- a/src/v8.cc
|
| +++ b/src/v8.cc
|
| @@ -32,6 +32,9 @@
|
| #include "elements.h"
|
| #include "bootstrapper.h"
|
| #include "debug.h"
|
| +#ifdef V8_USE_DEFAULT_PLATFORM
|
| +#include "default-platform.h"
|
| +#endif
|
| #include "deoptimizer.h"
|
| #include "frames.h"
|
| #include "heap-profiler.h"
|
| @@ -52,6 +55,7 @@ V8_DECLARE_ONCE(init_once);
|
|
|
| List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL;
|
| v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL;
|
| +v8::Platform* V8::platform_ = NULL;
|
|
|
|
|
| bool V8::Initialize(Deserializer* des) {
|
| @@ -100,6 +104,12 @@ void V8::TearDown() {
|
| call_completed_callbacks_ = NULL;
|
|
|
| Sampler::TearDown();
|
| +
|
| +#ifdef V8_USE_DEFAULT_PLATFORM
|
| + DefaultPlatform* platform = static_cast<DefaultPlatform*>(platform_);
|
| + platform_ = NULL;
|
| + delete platform;
|
| +#endif
|
| }
|
|
|
|
|
| @@ -109,25 +119,6 @@ void V8::SetReturnAddressLocationResolver(
|
| }
|
|
|
|
|
| -// Used by JavaScript APIs
|
| -uint32_t V8::Random(Context* context) {
|
| - ASSERT(context->IsNativeContext());
|
| - ByteArray* seed = context->random_seed();
|
| - uint32_t* state = reinterpret_cast<uint32_t*>(seed->GetDataStartAddress());
|
| -
|
| - // When we get here, the RNG must have been initialized,
|
| - // see the Genesis constructor in file bootstrapper.cc.
|
| - ASSERT_NE(0, state[0]);
|
| - ASSERT_NE(0, state[1]);
|
| -
|
| - // Mix the bits. Never replaces state[i] with 0 if it is nonzero.
|
| - state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16);
|
| - state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16);
|
| -
|
| - return (state[0] << 14) + (state[1] & 0x3FFFF);
|
| -}
|
| -
|
| -
|
| void V8::AddCallCompletedCallback(CallCompletedCallback callback) {
|
| if (call_completed_callbacks_ == NULL) { // Lazy init.
|
| call_completed_callbacks_ = new List<CallCompletedCallback>();
|
| @@ -179,38 +170,9 @@ void V8::InitializeOncePerProcessImpl() {
|
| FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2;
|
| }
|
|
|
| - if (FLAG_concurrent_recompilation &&
|
| - (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs)) {
|
| - FLAG_concurrent_recompilation = false;
|
| - FLAG_concurrent_osr = false;
|
| - PrintF("Concurrent recompilation has been disabled for tracing.\n");
|
| - }
|
| -
|
| - if (FLAG_sweeper_threads <= 0) {
|
| - if (FLAG_concurrent_sweeping) {
|
| - FLAG_sweeper_threads = SystemThreadManager::
|
| - NumberOfParallelSystemThreads(
|
| - SystemThreadManager::CONCURRENT_SWEEPING);
|
| - } else if (FLAG_parallel_sweeping) {
|
| - FLAG_sweeper_threads = SystemThreadManager::
|
| - NumberOfParallelSystemThreads(
|
| - SystemThreadManager::PARALLEL_SWEEPING);
|
| - }
|
| - if (FLAG_sweeper_threads == 0) {
|
| - FLAG_concurrent_sweeping = false;
|
| - FLAG_parallel_sweeping = false;
|
| - }
|
| - } else if (!FLAG_concurrent_sweeping && !FLAG_parallel_sweeping) {
|
| - FLAG_sweeper_threads = 0;
|
| - }
|
| -
|
| - if (FLAG_concurrent_recompilation &&
|
| - SystemThreadManager::NumberOfParallelSystemThreads(
|
| - SystemThreadManager::CONCURRENT_RECOMPILATION) == 0) {
|
| - FLAG_concurrent_recompilation = false;
|
| - FLAG_concurrent_osr = false;
|
| - }
|
| -
|
| +#ifdef V8_USE_DEFAULT_PLATFORM
|
| + platform_ = new DefaultPlatform;
|
| +#endif
|
| Sampler::SetUp();
|
| CPU::SetUp();
|
| OS::PostSetUp();
|
| @@ -226,4 +188,23 @@ void V8::InitializeOncePerProcess() {
|
| CallOnce(&init_once, &InitializeOncePerProcessImpl);
|
| }
|
|
|
| +
|
| +void V8::InitializePlatform(v8::Platform* platform) {
|
| + ASSERT(!platform_);
|
| + ASSERT(platform);
|
| + platform_ = platform;
|
| +}
|
| +
|
| +
|
| +void V8::ShutdownPlatform() {
|
| + ASSERT(platform_);
|
| + platform_ = NULL;
|
| +}
|
| +
|
| +
|
| +v8::Platform* V8::GetCurrentPlatform() {
|
| + ASSERT(platform_);
|
| + return platform_;
|
| +}
|
| +
|
| } } // namespace v8::internal
|
|
|