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" |
11 #include "src/list.h" | 11 #include "src/list.h" |
12 #include "src/v8.h" | 12 #include "src/v8.h" |
13 #else | 13 #else |
14 #include "include/v8.h" | 14 #include "include/v8.h" |
15 #include "src/base/compiler-specific.h" | 15 #include "src/base/compiler-specific.h" |
16 #endif // !V8_SHARED | 16 #endif // !V8_SHARED |
17 | 17 |
| 18 #include "src/base/once.h" |
| 19 |
| 20 |
18 namespace v8 { | 21 namespace v8 { |
19 | 22 |
20 | 23 |
21 #ifndef V8_SHARED | 24 #ifndef V8_SHARED |
22 // A single counter in a counter collection. | 25 // A single counter in a counter collection. |
23 class Counter { | 26 class Counter { |
24 public: | 27 public: |
25 static const int kMaxNameSize = 64; | 28 static const int kMaxNameSize = 64; |
26 int32_t* Bind(const char* name, bool histogram); | 29 int32_t* Bind(const char* name, bool histogram); |
27 int32_t* ptr() { return &count_; } | 30 int32_t* ptr() { return &count_; } |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 static void RealmSwitch(const v8::FunctionCallbackInfo<v8::Value>& args); | 407 static void RealmSwitch(const v8::FunctionCallbackInfo<v8::Value>& args); |
405 static void RealmEval(const v8::FunctionCallbackInfo<v8::Value>& args); | 408 static void RealmEval(const v8::FunctionCallbackInfo<v8::Value>& args); |
406 static void RealmSharedGet(Local<String> property, | 409 static void RealmSharedGet(Local<String> property, |
407 const PropertyCallbackInfo<Value>& info); | 410 const PropertyCallbackInfo<Value>& info); |
408 static void RealmSharedSet(Local<String> property, | 411 static void RealmSharedSet(Local<String> property, |
409 Local<Value> value, | 412 Local<Value> value, |
410 const PropertyCallbackInfo<void>& info); | 413 const PropertyCallbackInfo<void>& info); |
411 | 414 |
412 static void Print(const v8::FunctionCallbackInfo<v8::Value>& args); | 415 static void Print(const v8::FunctionCallbackInfo<v8::Value>& args); |
413 static void Write(const v8::FunctionCallbackInfo<v8::Value>& args); | 416 static void Write(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 417 static void QuitOnce(v8::FunctionCallbackInfo<v8::Value>* args); |
414 static void Quit(const v8::FunctionCallbackInfo<v8::Value>& args); | 418 static void Quit(const v8::FunctionCallbackInfo<v8::Value>& args); |
415 static void Version(const v8::FunctionCallbackInfo<v8::Value>& args); | 419 static void Version(const v8::FunctionCallbackInfo<v8::Value>& args); |
416 static void Read(const v8::FunctionCallbackInfo<v8::Value>& args); | 420 static void Read(const v8::FunctionCallbackInfo<v8::Value>& args); |
417 static void ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args); | 421 static void ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args); |
418 static Handle<String> ReadFromStdin(Isolate* isolate); | 422 static Handle<String> ReadFromStdin(Isolate* isolate); |
419 static void ReadLine(const v8::FunctionCallbackInfo<v8::Value>& args) { | 423 static void ReadLine(const v8::FunctionCallbackInfo<v8::Value>& args) { |
420 args.GetReturnValue().Set(ReadFromStdin(args.GetIsolate())); | 424 args.GetReturnValue().Set(ReadFromStdin(args.GetIsolate())); |
421 } | 425 } |
422 static void Load(const v8::FunctionCallbackInfo<v8::Value>& args); | 426 static void Load(const v8::FunctionCallbackInfo<v8::Value>& args); |
423 static void WorkerNew(const v8::FunctionCallbackInfo<v8::Value>& args); | 427 static void WorkerNew(const v8::FunctionCallbackInfo<v8::Value>& args); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 465 |
462 static void AddOSMethods(v8::Isolate* isolate, | 466 static void AddOSMethods(v8::Isolate* isolate, |
463 Handle<ObjectTemplate> os_template); | 467 Handle<ObjectTemplate> os_template); |
464 | 468 |
465 static const char* kPrompt; | 469 static const char* kPrompt; |
466 static ShellOptions options; | 470 static ShellOptions options; |
467 static ArrayBuffer::Allocator* array_buffer_allocator; | 471 static ArrayBuffer::Allocator* array_buffer_allocator; |
468 | 472 |
469 private: | 473 private: |
470 static Persistent<Context> evaluation_context_; | 474 static Persistent<Context> evaluation_context_; |
| 475 static base::OnceType quit_once_; |
471 #ifndef V8_SHARED | 476 #ifndef V8_SHARED |
472 static Persistent<Context> utility_context_; | 477 static Persistent<Context> utility_context_; |
473 static CounterMap* counter_map_; | 478 static CounterMap* counter_map_; |
474 // We statically allocate a set of local counters to be used if we | 479 // We statically allocate a set of local counters to be used if we |
475 // don't want to store the stats in a memory-mapped file | 480 // don't want to store the stats in a memory-mapped file |
476 static CounterCollection local_counters_; | 481 static CounterCollection local_counters_; |
477 static CounterCollection* counters_; | 482 static CounterCollection* counters_; |
478 static base::OS::MemoryMappedFile* counters_file_; | 483 static base::OS::MemoryMappedFile* counters_file_; |
479 static base::Mutex context_mutex_; | 484 static base::Mutex context_mutex_; |
480 static const base::TimeTicks kInitialTicks; | 485 static const base::TimeTicks kInitialTicks; |
(...skipping 11 matching lines...) Expand all Loading... |
492 static void RunShell(Isolate* isolate); | 497 static void RunShell(Isolate* isolate); |
493 static bool SetOptions(int argc, char* argv[]); | 498 static bool SetOptions(int argc, char* argv[]); |
494 static Handle<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); | 499 static Handle<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); |
495 }; | 500 }; |
496 | 501 |
497 | 502 |
498 } // namespace v8 | 503 } // namespace v8 |
499 | 504 |
500 | 505 |
501 #endif // V8_D8_H_ | 506 #endif // V8_D8_H_ |
OLD | NEW |