v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
v8.h
Go to the documentation of this file.
1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 //
29 // Top include for all V8 .cc files.
30 //
31 
32 #ifndef V8_V8_H_
33 #define V8_V8_H_
34 
35 #if defined(GOOGLE3)
36 // Google3 special flag handling.
37 #if defined(DEBUG) && defined(NDEBUG)
38 // V8 only uses DEBUG and whenever it is set we are building a debug
39 // version of V8. We do not use NDEBUG and simply undef it here for
40 // consistency.
41 #undef NDEBUG
42 #endif
43 #endif // defined(GOOGLE3)
44 
45 // V8 only uses DEBUG, but included external files
46 // may use NDEBUG - make sure they are consistent.
47 #if defined(DEBUG) && defined(NDEBUG)
48 #error both DEBUG and NDEBUG are set
49 #endif
50 
51 // Basic includes
52 #include "../include/v8.h"
53 #include "../include/v8-platform.h"
54 #include "v8globals.h"
55 #include "v8checks.h"
56 #include "allocation.h"
57 #include "assert-scope.h"
58 #include "v8utils.h"
59 #include "flags.h"
60 
61 // Objects & heap
62 #include "objects-inl.h"
63 #include "spaces-inl.h"
64 #include "heap-inl.h"
66 #include "mark-compact-inl.h"
67 #include "log-inl.h"
68 #include "handles-inl.h"
69 #include "zone-inl.h"
70 
71 namespace v8 {
72 namespace internal {
73 
74 class Deserializer;
75 
76 class V8 : public AllStatic {
77  public:
78  // Global actions.
79 
80  // If Initialize is called with des == NULL, the initial state is
81  // created from scratch. If a non-null Deserializer is given, the
82  // initial state is created by reading the deserialized data into an
83  // empty heap.
84  static bool Initialize(Deserializer* des);
85  static void TearDown();
86 
87  // Report process out of memory. Implementation found in api.cc.
88  static void FatalProcessOutOfMemory(const char* location,
89  bool take_snapshot = false);
90 
91  // Allows an entropy source to be provided for use in random number
92  // generation.
93  static void SetEntropySource(EntropySource source);
94  // Support for return-address rewriting profilers.
97  // Support for entry hooking JITed code.
98  static void SetFunctionEntryHook(FunctionEntryHook entry_hook);
99 
100  static void AddCallCompletedCallback(CallCompletedCallback callback);
102  static void FireCallCompletedCallback(Isolate* isolate);
103 
104  static void RunMicrotasks(Isolate* isolate);
105 
107  return array_buffer_allocator_;
108  }
109 
111  CHECK_EQ(NULL, array_buffer_allocator_);
112  array_buffer_allocator_ = allocator;
113  }
114 
115  static void InitializePlatform(v8::Platform* platform);
116  static void ShutdownPlatform();
118 
119  private:
120  static void InitializeOncePerProcessImpl();
121  static void InitializeOncePerProcess();
122 
123  // List of callbacks when a Call completes.
124  static List<CallCompletedCallback>* call_completed_callbacks_;
125  // Allocator for external array buffers.
126  static v8::ArrayBuffer::Allocator* array_buffer_allocator_;
127  // v8::Platform to use.
128  static v8::Platform* platform_;
129 };
130 
131 
132 // JavaScript defines two kinds of 'nil'.
134 
135 
136 } } // namespace v8::internal
137 
138 namespace i = v8::internal;
139 
140 #endif // V8_V8_H_
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
Definition: flags.cc:269
static bool Initialize(Deserializer *des)
Definition: v8.cc:61
#define CHECK_EQ(expected, value)
Definition: checks.h:252
void(* CallCompletedCallback)()
Definition: v8.h:4043
static void SetArrayBufferAllocator(v8::ArrayBuffer::Allocator *allocator)
Definition: v8.h:110
static void FireCallCompletedCallback(Isolate *isolate)
Definition: v8.cc:151
static void ShutdownPlatform()
Definition: v8.cc:227
static v8::ArrayBuffer::Allocator * ArrayBufferAllocator()
Definition: v8.h:106
void(* FunctionEntryHook)(uintptr_t function, uintptr_t return_addr_location)
Definition: v8.h:4509
NilValue
Definition: v8.h:133
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
Definition: v8.h:4494
static void RemoveCallCompletedCallback(CallCompletedCallback callback)
Definition: v8.cc:141
static void SetEntropySource(EntropySource source)
static void AddCallCompletedCallback(CallCompletedCallback callback)
Definition: v8.cc:130
static void SetReturnAddressLocationResolver(ReturnAddressLocationResolver resolver)
Definition: v8.cc:124
static void TearDown()
Definition: v8.cc:93
bool(* EntropySource)(unsigned char *buffer, size_t length)
Definition: v8.h:4478
static void InitializePlatform(v8::Platform *platform)
Definition: v8.cc:220
static void RunMicrotasks(Isolate *isolate)
Definition: v8.cc:172
static void SetFunctionEntryHook(FunctionEntryHook entry_hook)
static void FatalProcessOutOfMemory(const char *location, bool take_snapshot=false)
static v8::Platform * GetCurrentPlatform()
Definition: v8.cc:233