2011-06-16 06:37:49 +00:00
|
|
|
// Copyright 2011 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Top include for all V8 .cc files.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef V8_V8_H_
|
|
|
|
#define V8_V8_H_
|
|
|
|
|
2014-12-09 10:57:16 +00:00
|
|
|
#if defined(GOOGLE3) || defined(DCHECK_ALWAYS_ON)
|
|
|
|
// Google3 and Chromium special flag handling.
|
2008-08-13 09:32:07 +00:00
|
|
|
#if defined(DEBUG) && defined(NDEBUG)
|
2011-06-16 06:37:49 +00:00
|
|
|
// V8 only uses DEBUG and whenever it is set we are building a debug
|
|
|
|
// version of V8. We do not use NDEBUG and simply undef it here for
|
|
|
|
// consistency.
|
2008-08-13 09:32:07 +00:00
|
|
|
#undef NDEBUG
|
2008-07-03 15:10:15 +00:00
|
|
|
#endif
|
2008-08-13 09:32:07 +00:00
|
|
|
#endif // defined(GOOGLE3)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// V8 only uses DEBUG, but included external files
|
|
|
|
// may use NDEBUG - make sure they are consistent.
|
|
|
|
#if defined(DEBUG) && defined(NDEBUG)
|
|
|
|
#error both DEBUG and NDEBUG are set
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Basic includes
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "include/v8.h"
|
|
|
|
#include "include/v8-platform.h"
|
2014-06-30 13:25:46 +00:00
|
|
|
#include "src/checks.h" // NOLINT
|
2014-06-20 08:40:11 +00:00
|
|
|
#include "src/allocation.h" // NOLINT
|
|
|
|
#include "src/assert-scope.h" // NOLINT
|
|
|
|
#include "src/utils.h" // NOLINT
|
|
|
|
#include "src/flags.h" // NOLINT
|
|
|
|
#include "src/globals.h" // NOLINT
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Objects & heap
|
2014-06-20 08:40:11 +00:00
|
|
|
#include "src/objects-inl.h" // NOLINT
|
2014-08-05 08:18:22 +00:00
|
|
|
#include "src/heap/spaces-inl.h" // NOLINT
|
|
|
|
#include "src/heap/heap-inl.h" // NOLINT
|
|
|
|
#include "src/heap/incremental-marking-inl.h" // NOLINT
|
|
|
|
#include "src/heap/mark-compact-inl.h" // NOLINT
|
2014-06-20 08:40:11 +00:00
|
|
|
#include "src/log-inl.h" // NOLINT
|
|
|
|
#include "src/handles-inl.h" // NOLINT
|
|
|
|
#include "src/types-inl.h" // NOLINT
|
|
|
|
#include "src/zone-inl.h" // NOLINT
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
class V8 : public AllStatic {
|
|
|
|
public:
|
|
|
|
// Global actions.
|
|
|
|
|
2014-09-19 08:01:35 +00:00
|
|
|
static bool Initialize();
|
2013-10-02 09:01:40 +00:00
|
|
|
static void TearDown();
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Report process out of memory. Implementation found in api.cc.
|
2010-08-05 14:12:50 +00:00
|
|
|
static void FatalProcessOutOfMemory(const char* location,
|
|
|
|
bool take_snapshot = false);
|
2009-06-15 08:04:47 +00:00
|
|
|
|
2011-07-17 09:16:28 +00:00
|
|
|
// Allows an entropy source to be provided for use in random number
|
|
|
|
// generation.
|
|
|
|
static void SetEntropySource(EntropySource source);
|
2012-02-27 15:15:53 +00:00
|
|
|
// Support for return-address rewriting profilers.
|
|
|
|
static void SetReturnAddressLocationResolver(
|
|
|
|
ReturnAddressLocationResolver resolver);
|
2013-06-28 13:40:41 +00:00
|
|
|
// Support for entry hooking JITed code.
|
|
|
|
static void SetFunctionEntryHook(FunctionEntryHook entry_hook);
|
2009-06-15 08:04:47 +00:00
|
|
|
|
2013-06-11 10:41:14 +00:00
|
|
|
static v8::ArrayBuffer::Allocator* ArrayBufferAllocator() {
|
|
|
|
return array_buffer_allocator_;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SetArrayBufferAllocator(v8::ArrayBuffer::Allocator *allocator) {
|
|
|
|
CHECK_EQ(NULL, array_buffer_allocator_);
|
|
|
|
array_buffer_allocator_ = allocator;
|
|
|
|
}
|
|
|
|
|
2013-11-21 14:07:06 +00:00
|
|
|
static void InitializePlatform(v8::Platform* platform);
|
|
|
|
static void ShutdownPlatform();
|
|
|
|
static v8::Platform* GetCurrentPlatform();
|
|
|
|
|
2014-11-24 12:44:34 +00:00
|
|
|
static void SetNativesBlob(StartupData* natives_blob);
|
|
|
|
static void SetSnapshotBlob(StartupData* snapshot_blob);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
2012-03-12 13:56:56 +00:00
|
|
|
static void InitializeOncePerProcessImpl();
|
2011-03-31 16:17:37 +00:00
|
|
|
static void InitializeOncePerProcess();
|
|
|
|
|
2013-06-11 10:41:14 +00:00
|
|
|
// Allocator for external array buffers.
|
|
|
|
static v8::ArrayBuffer::Allocator* array_buffer_allocator_;
|
2013-11-21 14:07:06 +00:00
|
|
|
// v8::Platform to use.
|
|
|
|
static v8::Platform* platform_;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2011-09-19 14:50:33 +00:00
|
|
|
|
|
|
|
// JavaScript defines two kinds of 'nil'.
|
|
|
|
enum NilValue { kNullValue, kUndefinedValue };
|
|
|
|
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_V8_H_
|