Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1139)

Side by Side Diff: src/v8.cc

Issue 148593004: A64: Synchronize with r18084. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/v8.h ('k') | src/v8-counters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 14 matching lines...) Expand all
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "assembler.h" 30 #include "assembler.h"
31 #include "isolate.h" 31 #include "isolate.h"
32 #include "elements.h" 32 #include "elements.h"
33 #include "bootstrapper.h" 33 #include "bootstrapper.h"
34 #include "debug.h" 34 #include "debug.h"
35 #ifdef V8_USE_DEFAULT_PLATFORM
36 #include "default-platform.h"
37 #endif
35 #include "deoptimizer.h" 38 #include "deoptimizer.h"
36 #include "frames.h" 39 #include "frames.h"
37 #include "heap-profiler.h" 40 #include "heap-profiler.h"
38 #include "hydrogen.h" 41 #include "hydrogen.h"
39 #include "lithium-allocator.h" 42 #include "lithium-allocator.h"
40 #include "objects.h" 43 #include "objects.h"
41 #include "once.h" 44 #include "once.h"
42 #include "platform.h" 45 #include "platform.h"
43 #include "sampler.h" 46 #include "sampler.h"
44 #include "runtime-profiler.h" 47 #include "runtime-profiler.h"
45 #include "serialize.h" 48 #include "serialize.h"
46 #include "store-buffer.h" 49 #include "store-buffer.h"
47 50
48 namespace v8 { 51 namespace v8 {
49 namespace internal { 52 namespace internal {
50 53
51 V8_DECLARE_ONCE(init_once); 54 V8_DECLARE_ONCE(init_once);
52 55
53 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; 56 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL;
54 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; 57 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL;
58 v8::Platform* V8::platform_ = NULL;
55 59
56 60
57 bool V8::Initialize(Deserializer* des) { 61 bool V8::Initialize(Deserializer* des) {
58 InitializeOncePerProcess(); 62 InitializeOncePerProcess();
59 63
60 // The current thread may not yet had entered an isolate to run. 64 // The current thread may not yet had entered an isolate to run.
61 // Note the Isolate::Current() may be non-null because for various 65 // Note the Isolate::Current() may be non-null because for various
62 // initialization purposes an initializing thread may be assigned an isolate 66 // initialization purposes an initializing thread may be assigned an isolate
63 // but not actually enter it. 67 // but not actually enter it.
64 if (i::Isolate::CurrentPerIsolateThreadData() == NULL) { 68 if (i::Isolate::CurrentPerIsolateThreadData() == NULL) {
(...skipping 28 matching lines...) Expand all
93 ElementsAccessor::TearDown(); 97 ElementsAccessor::TearDown();
94 LOperand::TearDownCaches(); 98 LOperand::TearDownCaches();
95 ExternalReference::TearDownMathExpData(); 99 ExternalReference::TearDownMathExpData();
96 RegisteredExtension::UnregisterAll(); 100 RegisteredExtension::UnregisterAll();
97 Isolate::GlobalTearDown(); 101 Isolate::GlobalTearDown();
98 102
99 delete call_completed_callbacks_; 103 delete call_completed_callbacks_;
100 call_completed_callbacks_ = NULL; 104 call_completed_callbacks_ = NULL;
101 105
102 Sampler::TearDown(); 106 Sampler::TearDown();
107
108 #ifdef V8_USE_DEFAULT_PLATFORM
109 DefaultPlatform* platform = static_cast<DefaultPlatform*>(platform_);
110 platform_ = NULL;
111 delete platform;
112 #endif
103 } 113 }
104 114
105 115
106 void V8::SetReturnAddressLocationResolver( 116 void V8::SetReturnAddressLocationResolver(
107 ReturnAddressLocationResolver resolver) { 117 ReturnAddressLocationResolver resolver) {
108 StackFrame::SetReturnAddressLocationResolver(resolver); 118 StackFrame::SetReturnAddressLocationResolver(resolver);
109 } 119 }
110 120
111 121
112 // Used by JavaScript APIs
113 uint32_t V8::Random(Context* context) {
114 ASSERT(context->IsNativeContext());
115 ByteArray* seed = context->random_seed();
116 uint32_t* state = reinterpret_cast<uint32_t*>(seed->GetDataStartAddress());
117
118 // When we get here, the RNG must have been initialized,
119 // see the Genesis constructor in file bootstrapper.cc.
120 ASSERT_NE(0, state[0]);
121 ASSERT_NE(0, state[1]);
122
123 // Mix the bits. Never replaces state[i] with 0 if it is nonzero.
124 state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16);
125 state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16);
126
127 return (state[0] << 14) + (state[1] & 0x3FFFF);
128 }
129
130
131 void V8::AddCallCompletedCallback(CallCompletedCallback callback) { 122 void V8::AddCallCompletedCallback(CallCompletedCallback callback) {
132 if (call_completed_callbacks_ == NULL) { // Lazy init. 123 if (call_completed_callbacks_ == NULL) { // Lazy init.
133 call_completed_callbacks_ = new List<CallCompletedCallback>(); 124 call_completed_callbacks_ = new List<CallCompletedCallback>();
134 } 125 }
135 for (int i = 0; i < call_completed_callbacks_->length(); i++) { 126 for (int i = 0; i < call_completed_callbacks_->length(); i++) {
136 if (callback == call_completed_callbacks_->at(i)) return; 127 if (callback == call_completed_callbacks_->at(i)) return;
137 } 128 }
138 call_completed_callbacks_->Add(callback); 129 call_completed_callbacks_->Add(callback);
139 } 130 }
140 131
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 163
173 164
174 void V8::InitializeOncePerProcessImpl() { 165 void V8::InitializeOncePerProcessImpl() {
175 FlagList::EnforceFlagImplications(); 166 FlagList::EnforceFlagImplications();
176 if (FLAG_stress_compaction) { 167 if (FLAG_stress_compaction) {
177 FLAG_force_marking_deque_overflows = true; 168 FLAG_force_marking_deque_overflows = true;
178 FLAG_gc_global = true; 169 FLAG_gc_global = true;
179 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; 170 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2;
180 } 171 }
181 172
173 #ifdef V8_USE_DEFAULT_PLATFORM
174 platform_ = new DefaultPlatform;
175 #endif
182 Sampler::SetUp(); 176 Sampler::SetUp();
183 CPU::SetUp(); 177 CPU::SetUp();
184 OS::PostSetUp(); 178 OS::PostSetUp();
185 ElementsAccessor::InitializeOncePerProcess(); 179 ElementsAccessor::InitializeOncePerProcess();
186 LOperand::SetUpCaches(); 180 LOperand::SetUpCaches();
187 SetUpJSCallerSavedCodeData(); 181 SetUpJSCallerSavedCodeData();
188 ExternalReference::SetUp(); 182 ExternalReference::SetUp();
189 Bootstrapper::InitializeOncePerProcess(); 183 Bootstrapper::InitializeOncePerProcess();
190 } 184 }
191 185
192 186
193 void V8::InitializeOncePerProcess() { 187 void V8::InitializeOncePerProcess() {
194 CallOnce(&init_once, &InitializeOncePerProcessImpl); 188 CallOnce(&init_once, &InitializeOncePerProcessImpl);
195 } 189 }
196 190
191
192 void V8::InitializePlatform(v8::Platform* platform) {
193 ASSERT(!platform_);
194 ASSERT(platform);
195 platform_ = platform;
196 }
197
198
199 void V8::ShutdownPlatform() {
200 ASSERT(platform_);
201 platform_ = NULL;
202 }
203
204
205 v8::Platform* V8::GetCurrentPlatform() {
206 ASSERT(platform_);
207 return platform_;
208 }
209
197 } } // namespace v8::internal 210 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/v8.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698