V8 Project
v8.h
Go to the documentation of this file.
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.
4 
5 //
6 // Top include for all V8 .cc files.
7 //
8 
9 #ifndef V8_V8_H_
10 #define V8_V8_H_
11 
12 #if defined(GOOGLE3)
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
17 // consistency.
18 #undef NDEBUG
19 #endif
20 #endif // defined(GOOGLE3)
21 
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
26 #endif
27 
28 // Basic includes
29 #include "include/v8.h"
30 #include "include/v8-platform.h"
31 #include "src/checks.h" // NOLINT
32 #include "src/allocation.h" // NOLINT
33 #include "src/assert-scope.h" // NOLINT
34 #include "src/utils.h" // NOLINT
35 #include "src/flags.h" // NOLINT
36 #include "src/globals.h" // NOLINT
37 
38 // Objects & heap
39 #include "src/objects-inl.h" // NOLINT
40 #include "src/heap/spaces-inl.h" // NOLINT
41 #include "src/heap/heap-inl.h" // NOLINT
42 #include "src/heap/incremental-marking-inl.h" // NOLINT
43 #include "src/heap/mark-compact-inl.h" // NOLINT
44 #include "src/log-inl.h" // NOLINT
45 #include "src/handles-inl.h" // NOLINT
46 #include "src/types-inl.h" // NOLINT
47 #include "src/zone-inl.h" // NOLINT
48 
49 namespace v8 {
50 namespace internal {
51 
52 class V8 : public AllStatic {
53  public:
54  // Global actions.
55 
56  static bool Initialize();
57  static void TearDown();
58 
59  // Report process out of memory. Implementation found in api.cc.
60  static void FatalProcessOutOfMemory(const char* location,
61  bool take_snapshot = false);
62 
63  // Allows an entropy source to be provided for use in random number
64  // generation.
65  static void SetEntropySource(EntropySource source);
66  // Support for return-address rewriting profilers.
69  // Support for entry hooking JITed code.
70  static void SetFunctionEntryHook(FunctionEntryHook entry_hook);
71 
74  }
75 
78  array_buffer_allocator_ = allocator;
79  }
80 
81  static void InitializePlatform(v8::Platform* platform);
82  static void ShutdownPlatform();
84 
85  private:
86  static void InitializeOncePerProcessImpl();
87  static void InitializeOncePerProcess();
88 
89  // Allocator for external array buffers.
91  // v8::Platform to use.
93 };
94 
95 
96 // JavaScript defines two kinds of 'nil'.
98 
99 
100 } } // namespace v8::internal
101 
102 #endif // V8_V8_H_
Allocator that V8 uses to allocate |ArrayBuffer|'s memory.
Definition: v8.h:2859
V8 Platform abstraction layer.
Definition: v8-platform.h:28
static void ShutdownPlatform()
Definition: v8.cc:109
static void SetArrayBufferAllocator(v8::ArrayBuffer::Allocator *allocator)
Definition: v8.h:76
static v8::Platform * platform_
Definition: v8.h:92
static void TearDown()
Definition: v8.cc:42
static bool Initialize()
Definition: v8.cc:36
static v8::ArrayBuffer::Allocator * array_buffer_allocator_
Definition: v8.h:90
static v8::Platform * GetCurrentPlatform()
Definition: v8.cc:115
static void InitializePlatform(v8::Platform *platform)
Definition: v8.cc:102
static void FatalProcessOutOfMemory(const char *location, bool take_snapshot=false)
static v8::ArrayBuffer::Allocator * ArrayBufferAllocator()
Definition: v8.h:72
static void SetReturnAddressLocationResolver(ReturnAddressLocationResolver resolver)
Definition: v8.cc:55
static void InitializeOncePerProcess()
Definition: v8.cc:97
static void SetFunctionEntryHook(FunctionEntryHook entry_hook)
static void InitializeOncePerProcessImpl()
Definition: v8.cc:61
static void SetEntropySource(EntropySource source)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define CHECK_EQ(expected, value)
Definition: logging.h:169
NilValue
Definition: v8.h:97
@ kNullValue
Definition: v8.h:97
@ kUndefinedValue
Definition: v8.h:97
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
ReturnAddressLocationResolver is used as a callback function when v8 is resolving the location of a r...
Definition: v8.h:4936
void(* FunctionEntryHook)(uintptr_t function, uintptr_t return_addr_location)
FunctionEntryHook is the type of the profile entry hook called at entry to any generated function whe...
Definition: v8.h:4263
bool(* EntropySource)(unsigned char *buffer, size_t length)
EntropySource is used as a callback function when v8 needs a source of entropy.
Definition: v8.h:4920