| Index: src/d8.h
|
| diff --git a/src/d8.h b/src/d8.h
|
| index e22546999325a34a52aa002c05e473a852e5f100..7f0272710b4b160f9b1a5a90ea4f4b5e8309cc65 100644
|
| --- a/src/d8.h
|
| +++ b/src/d8.h
|
| @@ -112,6 +112,87 @@ class CounterMap {
|
| };
|
|
|
|
|
| +class SourceGroup {
|
| + public:
|
| + SourceGroup()
|
| + : next_semaphore_(v8::internal::OS::CreateSemaphore(0)),
|
| + done_semaphore_(v8::internal::OS::CreateSemaphore(0)),
|
| + thread_(NULL),
|
| + argv_(NULL),
|
| + begin_offset_(0),
|
| + end_offset_(0) { }
|
| +
|
| + void Begin(char** argv, int offset) {
|
| + argv_ = const_cast<const char**>(argv);
|
| + begin_offset_ = offset;
|
| + }
|
| +
|
| + void End(int offset) { end_offset_ = offset; }
|
| +
|
| + void Execute();
|
| +
|
| + void StartExecuteInThread();
|
| + void WaitForThread();
|
| +
|
| + private:
|
| + class IsolateThread : public i::Thread {
|
| + public:
|
| + explicit IsolateThread(SourceGroup* group)
|
| + : i::Thread(GetThreadOptions()), group_(group) {}
|
| +
|
| + virtual void Run() {
|
| + group_->ExecuteInThread();
|
| + }
|
| +
|
| + private:
|
| + SourceGroup* group_;
|
| + };
|
| +
|
| + static i::Thread::Options GetThreadOptions();
|
| + void ExecuteInThread();
|
| +
|
| + i::Semaphore* next_semaphore_;
|
| + i::Semaphore* done_semaphore_;
|
| + i::Thread* thread_;
|
| +
|
| + void ExitShell(int exit_code);
|
| + Handle<String> ReadFile(const char* name);
|
| +
|
| + const char** argv_;
|
| + int begin_offset_;
|
| + int end_offset_;
|
| +};
|
| +
|
| +
|
| +class ShellOptions {
|
| + public:
|
| + ShellOptions()
|
| + : script_executed(false),
|
| + last_run(true),
|
| + stress_opt(false),
|
| + stress_deopt(false),
|
| + interactive_shell(false),
|
| + test_shell(false),
|
| + use_preemption(true),
|
| + preemption_interval(10),
|
| + num_isolates(1),
|
| + isolate_sources(NULL),
|
| + parallel_files(NULL) { }
|
| +
|
| + bool script_executed;
|
| + bool last_run;
|
| + bool stress_opt;
|
| + bool stress_deopt;
|
| + bool interactive_shell;
|
| + bool test_shell;
|
| + bool use_preemption;
|
| + int preemption_interval;
|
| + int num_isolates;
|
| + SourceGroup* isolate_sources;
|
| + i::List< i::Vector<const char> >* parallel_files;
|
| +};
|
| +
|
| +
|
| class Shell: public i::AllStatic {
|
| public:
|
| static bool ExecuteString(Handle<String> source,
|
| @@ -129,12 +210,13 @@ class Shell: public i::AllStatic {
|
| static void AddHistogramSample(void* histogram, int sample);
|
| static void MapCounters(const char* name);
|
| static Handle<String> ReadFile(const char* name);
|
| - static void Initialize(bool test_shell);
|
| - static void RenewEvaluationContext();
|
| + static void Initialize();
|
| + static Persistent<Context> CreateEvaluationContext();
|
| static void InstallUtilityScript();
|
| static void RunShell();
|
| + static bool SetOptions(int argc, char* argv[]);
|
| static int RunScript(char* filename);
|
| - static int RunMain(int argc, char* argv[], bool* executed);
|
| + static int RunMain(int argc, char* argv[]);
|
| static int Main(int argc, char* argv[]);
|
| static Handle<ObjectTemplate> CreateGlobalTemplate();
|
| static Handle<Array> GetCompletions(Handle<String> text,
|
| @@ -205,6 +287,8 @@ class Shell: public i::AllStatic {
|
| static const char* kHistoryFileName;
|
| static const char* kPrompt;
|
|
|
| + static ShellOptions options;
|
| +
|
| private:
|
| static Persistent<Context> utility_context_;
|
| static Persistent<Context> evaluation_context_;
|
| @@ -214,6 +298,7 @@ class Shell: public i::AllStatic {
|
| static CounterCollection local_counters_;
|
| static CounterCollection* counters_;
|
| static i::OS::MemoryMappedFile* counters_file_;
|
| + static i::Mutex* context_mutex_;
|
| static Counter* GetCounter(const char* name, bool is_histogram);
|
| static Handle<Value> CreateExternalArray(const Arguments& args,
|
| ExternalArrayType type,
|
|
|