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