OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/base/once.h" | 8 #include "src/base/once.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
11 #include "src/crankshaft/lithium-allocator.h" | 11 #include "src/crankshaft/lithium-allocator.h" |
12 #include "src/debug/debug.h" | 12 #include "src/debug/debug.h" |
13 #include "src/deoptimizer.h" | 13 #include "src/deoptimizer.h" |
14 #include "src/elements.h" | 14 #include "src/elements.h" |
15 #include "src/frames.h" | 15 #include "src/frames.h" |
16 #include "src/isolate.h" | 16 #include "src/isolate.h" |
| 17 #include "src/libsampler/v8-sampler.h" |
17 #include "src/objects.h" | 18 #include "src/objects.h" |
18 #include "src/profiler/heap-profiler.h" | 19 #include "src/profiler/heap-profiler.h" |
19 #include "src/profiler/sampler.h" | |
20 #include "src/runtime-profiler.h" | 20 #include "src/runtime-profiler.h" |
21 #include "src/snapshot/natives.h" | 21 #include "src/snapshot/natives.h" |
22 #include "src/snapshot/snapshot.h" | 22 #include "src/snapshot/snapshot.h" |
23 | 23 |
24 | 24 |
25 namespace v8 { | 25 namespace v8 { |
26 namespace internal { | 26 namespace internal { |
27 | 27 |
28 V8_DECLARE_ONCE(init_once); | 28 V8_DECLARE_ONCE(init_once); |
29 | 29 |
(...skipping 11 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 void V8::TearDown() { | 44 void V8::TearDown() { |
45 Bootstrapper::TearDownExtensions(); | 45 Bootstrapper::TearDownExtensions(); |
46 ElementsAccessor::TearDown(); | 46 ElementsAccessor::TearDown(); |
47 LOperand::TearDownCaches(); | 47 LOperand::TearDownCaches(); |
48 ExternalReference::TearDownMathExpData(); | 48 ExternalReference::TearDownMathExpData(); |
49 RegisteredExtension::UnregisterAll(); | 49 RegisteredExtension::UnregisterAll(); |
50 Isolate::GlobalTearDown(); | 50 Isolate::GlobalTearDown(); |
51 Sampler::TearDown(); | 51 sampler::Sampler::TearDown(); |
52 FlagList::ResetAllFlags(); // Frees memory held by string arguments. | 52 FlagList::ResetAllFlags(); // Frees memory held by string arguments. |
53 } | 53 } |
54 | 54 |
55 | 55 |
56 void V8::InitializeOncePerProcessImpl() { | 56 void V8::InitializeOncePerProcessImpl() { |
57 FlagList::EnforceFlagImplications(); | 57 FlagList::EnforceFlagImplications(); |
58 | 58 |
59 if (FLAG_predictable && FLAG_random_seed == 0) { | 59 if (FLAG_predictable && FLAG_random_seed == 0) { |
60 // Avoid random seeds in predictable mode. | 60 // Avoid random seeds in predictable mode. |
61 FLAG_random_seed = 12347; | 61 FLAG_random_seed = 12347; |
62 } | 62 } |
63 | 63 |
64 if (FLAG_stress_compaction) { | 64 if (FLAG_stress_compaction) { |
65 FLAG_force_marking_deque_overflows = true; | 65 FLAG_force_marking_deque_overflows = true; |
66 FLAG_gc_global = true; | 66 FLAG_gc_global = true; |
67 FLAG_max_semi_space_size = 1; | 67 FLAG_max_semi_space_size = 1; |
68 } | 68 } |
69 | 69 |
70 if (FLAG_turbo && strcmp(FLAG_turbo_filter, "~~") == 0) { | 70 if (FLAG_turbo && strcmp(FLAG_turbo_filter, "~~") == 0) { |
71 const char* filter_flag = "--turbo-filter=*"; | 71 const char* filter_flag = "--turbo-filter=*"; |
72 FlagList::SetFlagsFromString(filter_flag, StrLength(filter_flag)); | 72 FlagList::SetFlagsFromString(filter_flag, StrLength(filter_flag)); |
73 } | 73 } |
74 | 74 |
75 base::OS::Initialize(FLAG_random_seed, FLAG_hard_abort, FLAG_gc_fake_mmap); | 75 base::OS::Initialize(FLAG_random_seed, FLAG_hard_abort, FLAG_gc_fake_mmap); |
76 | 76 |
77 Isolate::InitializeOncePerProcess(); | 77 Isolate::InitializeOncePerProcess(); |
78 | 78 |
79 Sampler::SetUp(); | 79 sampler::Sampler::SetUp(); |
80 CpuFeatures::Probe(false); | 80 CpuFeatures::Probe(false); |
81 ElementsAccessor::InitializeOncePerProcess(); | 81 ElementsAccessor::InitializeOncePerProcess(); |
82 LOperand::SetUpCaches(); | 82 LOperand::SetUpCaches(); |
83 SetUpJSCallerSavedCodeData(); | 83 SetUpJSCallerSavedCodeData(); |
84 ExternalReference::SetUp(); | 84 ExternalReference::SetUp(); |
85 Bootstrapper::InitializeOncePerProcess(); | 85 Bootstrapper::InitializeOncePerProcess(); |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 void V8::InitializeOncePerProcess() { | 89 void V8::InitializeOncePerProcess() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 void V8::SetSnapshotBlob(StartupData* snapshot_blob) { | 125 void V8::SetSnapshotBlob(StartupData* snapshot_blob) { |
126 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 126 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
127 base::CallOnce(&init_snapshot_once, &SetSnapshotFromFile, snapshot_blob); | 127 base::CallOnce(&init_snapshot_once, &SetSnapshotFromFile, snapshot_blob); |
128 #else | 128 #else |
129 CHECK(false); | 129 CHECK(false); |
130 #endif | 130 #endif |
131 } | 131 } |
132 } // namespace internal | 132 } // namespace internal |
133 } // namespace v8 | 133 } // namespace v8 |
OLD | NEW |