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 #ifndef V8_D8_H_ | 5 #ifndef V8_D8_H_ |
6 #define V8_D8_H_ | 6 #define V8_D8_H_ |
7 | 7 |
8 #ifndef V8_SHARED | 8 #ifndef V8_SHARED |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 int* offset) const; | 207 int* offset) const; |
208 | 208 |
209 template <typename T> | 209 template <typename T> |
210 T Read(int* offset) const { | 210 T Read(int* offset) const { |
211 T value; | 211 T value; |
212 ReadMemory(&value, sizeof(value), offset); | 212 ReadMemory(&value, sizeof(value), offset); |
213 return value; | 213 return value; |
214 } | 214 } |
215 | 215 |
216 private: | 216 private: |
217 i::List<uint8_t> data; | 217 i::List<uint8_t> data_; |
218 i::List<ArrayBuffer::Contents> array_buffer_contents; | 218 i::List<ArrayBuffer::Contents> array_buffer_contents_; |
219 i::List<SharedArrayBuffer::Contents> shared_array_buffer_contents; | 219 i::List<SharedArrayBuffer::Contents> shared_array_buffer_contents_; |
220 }; | 220 }; |
221 | 221 |
222 | 222 |
223 class SerializationDataQueue { | 223 class SerializationDataQueue { |
224 public: | 224 public: |
225 void Enqueue(SerializationData* data); | 225 void Enqueue(SerializationData* data); |
226 bool Dequeue(SerializationData** data); | 226 bool Dequeue(SerializationData** data); |
227 bool IsEmpty(); | 227 bool IsEmpty(); |
228 void Clear(); | 228 void Clear(); |
229 | 229 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 Worker* worker_; | 266 Worker* worker_; |
267 }; | 267 }; |
268 | 268 |
269 enum State { | 269 enum State { |
270 IDLE, // The worker thread hasn't been started yet | 270 IDLE, // The worker thread hasn't been started yet |
271 RUNNING, // The worker thread is running and hasn't been terminated | 271 RUNNING, // The worker thread is running and hasn't been terminated |
272 TERMINATED // The worker thread has been terminated and will soon finish | 272 TERMINATED // The worker thread has been terminated and will soon finish |
273 }; | 273 }; |
274 | 274 |
275 void ExecuteInThread(); | 275 void ExecuteInThread(); |
276 void Cleanup(); | |
277 static void PostMessageOut(const v8::FunctionCallbackInfo<v8::Value>& args); | 276 static void PostMessageOut(const v8::FunctionCallbackInfo<v8::Value>& args); |
278 | 277 |
279 base::Semaphore in_semaphore_; | 278 base::Semaphore in_semaphore_; |
280 base::Semaphore out_semaphore_; | 279 base::Semaphore out_semaphore_; |
281 SerializationDataQueue in_queue_; | 280 SerializationDataQueue in_queue_; |
282 SerializationDataQueue out_queue_; | 281 SerializationDataQueue out_queue_; |
283 base::Thread* thread_; | 282 base::Thread* thread_; |
284 char* script_; | 283 char* script_; |
285 base::Atomic32 state_; | 284 base::Atomic32 state_; |
286 base::Atomic32 join_called_; | 285 base::Atomic32 join_called_; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 static void RunShell(Isolate* isolate); | 491 static void RunShell(Isolate* isolate); |
493 static bool SetOptions(int argc, char* argv[]); | 492 static bool SetOptions(int argc, char* argv[]); |
494 static Handle<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); | 493 static Handle<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); |
495 }; | 494 }; |
496 | 495 |
497 | 496 |
498 } // namespace v8 | 497 } // namespace v8 |
499 | 498 |
500 | 499 |
501 #endif // V8_D8_H_ | 500 #endif // V8_D8_H_ |
OLD | NEW |