1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 // Top include for all V8 .cc files.
13 // Google3 special flag handling.
14 #if defined(DEBUG) && defined(NDEBUG)
15 // V8 only uses DEBUG and whenever it is set we are building a debug
16 // version of V8. We do not use NDEBUG and simply undef it here for
20 #endif // defined(GOOGLE3)
22 // V8 only uses DEBUG, but included external files
23 // may use NDEBUG - make sure they are consistent.
24 #if defined(DEBUG) && defined(NDEBUG)
25 #error both DEBUG and NDEBUG are set
29 #include "../include/v8.h"
30 #include "../include/v8-platform.h"
31 #include "v8globals.h"
33 #include "allocation.h"
34 #include "assert-scope.h"
39 #include "objects-inl.h"
40 #include "spaces-inl.h"
42 #include "incremental-marking-inl.h"
43 #include "mark-compact-inl.h"
45 #include "handles-inl.h"
46 #include "types-inl.h"
54 class V8 : public AllStatic {
58 // If Initialize is called with des == NULL, the initial state is
59 // created from scratch. If a non-null Deserializer is given, the
60 // initial state is created by reading the deserialized data into an
62 static bool Initialize(Deserializer* des);
63 static void TearDown();
65 // Report process out of memory. Implementation found in api.cc.
66 static void FatalProcessOutOfMemory(const char* location,
67 bool take_snapshot = false);
69 // Allows an entropy source to be provided for use in random number
71 static void SetEntropySource(EntropySource source);
72 // Support for return-address rewriting profilers.
73 static void SetReturnAddressLocationResolver(
74 ReturnAddressLocationResolver resolver);
75 // Support for entry hooking JITed code.
76 static void SetFunctionEntryHook(FunctionEntryHook entry_hook);
78 static v8::ArrayBuffer::Allocator* ArrayBufferAllocator() {
79 return array_buffer_allocator_;
82 static void SetArrayBufferAllocator(v8::ArrayBuffer::Allocator *allocator) {
83 CHECK_EQ(NULL, array_buffer_allocator_);
84 array_buffer_allocator_ = allocator;
87 static void InitializePlatform(v8::Platform* platform);
88 static void ShutdownPlatform();
89 static v8::Platform* GetCurrentPlatform();
92 static void InitializeOncePerProcessImpl();
93 static void InitializeOncePerProcess();
95 // Allocator for external array buffers.
96 static v8::ArrayBuffer::Allocator* array_buffer_allocator_;
97 // v8::Platform to use.
98 static v8::Platform* platform_;
102 // JavaScript defines two kinds of 'nil'.
103 enum NilValue { kNullValue, kUndefinedValue };
106 } } // namespace v8::internal