V8 Project
v8.cc
Go to the documentation of this file.
1 // Copyright 2012 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 #include "src/v8.h"
6 
7 #include "src/assembler.h"
8 #include "src/base/once.h"
10 #include "src/bootstrapper.h"
11 #include "src/compiler/pipeline.h"
12 #include "src/debug.h"
13 #include "src/deoptimizer.h"
14 #include "src/elements.h"
15 #include "src/frames.h"
16 #include "src/heap/store-buffer.h"
17 #include "src/heap-profiler.h"
18 #include "src/hydrogen.h"
19 #include "src/isolate.h"
20 #include "src/lithium-allocator.h"
21 #include "src/objects.h"
22 #include "src/runtime-profiler.h"
23 #include "src/sampler.h"
24 #include "src/serialize.h"
25 
26 
27 namespace v8 {
28 namespace internal {
29 
30 V8_DECLARE_ONCE(init_once);
31 
34 
35 
38  return true;
39 }
40 
41 
42 void V8::TearDown() {
43  Bootstrapper::TearDownExtensions();
47  ExternalReference::TearDownMathExpData();
51  FlagList::ResetAllFlags(); // Frees memory held by string arguments.
52 }
53 
54 
57  StackFrame::SetReturnAddressLocationResolver(resolver);
58 }
59 
60 
63 
64  if (FLAG_predictable && FLAG_random_seed == 0) {
65  // Avoid random seeds in predictable mode.
66  FLAG_random_seed = 12347;
67  }
68 
69  if (FLAG_stress_compaction) {
70  FLAG_force_marking_deque_overflows = true;
71  FLAG_gc_global = true;
72  FLAG_max_semi_space_size = 1;
73  }
74 
75  base::OS::Initialize(FLAG_random_seed, FLAG_hard_abort, FLAG_gc_fake_mmap);
76 
78 
80  CpuFeatures::Probe(false);
82  // The custom exp implementation needs 16KB of lookup data; initialize it
83  // on demand.
85 #ifdef _WIN64
86  init_modulo_function();
87 #endif
92  ExternalReference::SetUp();
93  Bootstrapper::InitializeOncePerProcess();
94 }
95 
96 
99 }
100 
101 
103  CHECK(!platform_);
104  CHECK(platform);
105  platform_ = platform;
106 }
107 
108 
110  CHECK(platform_);
111  platform_ = NULL;
112 }
113 
114 
116  DCHECK(platform_);
117  return platform_;
118 }
119 
120 } } // namespace v8::internal
Allocator that V8 uses to allocate |ArrayBuffer|'s memory.
Definition: v8.h:2859
V8 Platform abstraction layer.
Definition: v8-platform.h:28
static void UnregisterAll()
Definition: api.cc:387
static void Initialize(int64_t random_seed, bool hard_abort, const char *const gc_fake_mmap)
static void Probe(bool cross_compile)
Definition: assembler.h:172
static void InitializeOncePerProcess()
Definition: elements.cc:1736
static void EnforceFlagImplications()
Definition: flags.cc:545
static void ResetAllFlags()
Definition: flags.cc:508
static void InitializeOncePerProcess()
Definition: isolate.cc:152
static void GlobalTearDown()
Definition: isolate.cc:1585
static void TearDownCaches()
Definition: lithium.cc:160
static void SetUpCaches()
Definition: lithium.cc:153
static void SetUp()
Definition: sampler.cc:621
static void TearDown()
Definition: sampler.cc:629
static void ShutdownPlatform()
Definition: v8.cc:109
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 SetReturnAddressLocationResolver(ReturnAddressLocationResolver resolver)
Definition: v8.cc:55
static void InitializeOncePerProcess()
Definition: v8.cc:97
static void InitializeOncePerProcessImpl()
Definition: v8.cc:61
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(condition)
Definition: logging.h:36
#define DCHECK(condition)
Definition: logging.h:205
void CallOnce(OnceType *once, NoArgFunction init_func)
Definition: once.h:82
V8_DECLARE_ONCE(initialize_gc_once)
void init_fast_sqrt_function()
void init_memcopy_functions()
Definition: utils.cc:381
void SetUpJSCallerSavedCodeData()
Definition: frames.cc:1591
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