Index: src/d8.h |
diff --git a/src/d8.h b/src/d8.h |
index e22546999325a34a52aa002c05e473a852e5f100..67a3e56d479b78da748a4adcb48403c69ea0f702 100644 |
--- a/src/d8.h |
+++ b/src/d8.h |
@@ -112,6 +112,93 @@ class CounterMap { |
}; |
+class SourceGroup { |
+ public: |
+ SourceGroup() : |
Søren Thygesen Gjesse
2011/07/08 08:09:12
Formatting, should be ':' on new line with 4 space
|
+#if !(defined(USING_V8_SHARED) || defined(V8_SHARED)) |
Søren Thygesen Gjesse
2011/07/08 08:09:12
I think we need a comment somewhere on why thid #i
|
+ next_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
+ done_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
+ thread_(NULL), |
+#endif // USING_V8_SHARED |
Søren Thygesen Gjesse
2011/07/08 08:09:12
#endif comment not matching #if condition.
|
+ 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(); |
+ |
+#if !(defined(USING_V8_SHARED) || defined(V8_SHARED)) |
+ void StartExecuteInThread(); |
+ void WaitForThread(); |
+#endif // USING_V8_SHARED |
Søren Thygesen Gjesse
2011/07/08 08:09:12
Ditto.
|
+ |
+ private: |
+#if !(defined(USING_V8_SHARED) || defined(V8_SHARED)) |
+ 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(); |
+ void ExitShell(int exit_code); |
+ Handle<String> ReadFile(const char* name); |
+ |
+ i::Semaphore* next_semaphore_; |
+ i::Semaphore* done_semaphore_; |
+ i::Thread* thread_; |
+#endif // USING_V8_SHARED |
Søren Thygesen Gjesse
2011/07/08 08:09:12
Ditto.
|
+ |
+ const char** argv_; |
+ int begin_offset_; |
+ int end_offset_; |
+}; |
+ |
+ |
+class ShellOptions { |
+ public: |
+ ShellOptions() : |
Søren Thygesen Gjesse
2011/07/08 08:09:12
Code style (seee http://google-styleguide.googleco
|
+ script_executed(false), |
+ last_run(true), |
+ FLAG_stress_opt(false), |
Søren Thygesen Gjesse
2011/07/08 08:09:12
Now that this is in a class I think we should drop
|
+ FLAG_stress_deopt(false), |
+ FLAG_interactive_shell(false), |
+ FLAG_test_shell(false), |
+ FLAG_preemption(true), |
+ preemption_interval(10), |
+ num_isolates(1), |
+ isolate_sources(NULL), |
+ parallel_files(NULL) { } |
+ |
+ bool script_executed; |
+ bool last_run; |
+ bool FLAG_stress_opt; |
+ bool FLAG_stress_deopt; |
+ bool FLAG_interactive_shell; |
+ bool FLAG_test_shell; |
+ bool FLAG_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 +216,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(); |
Yang
2011/07/07 16:04:49
renamed this to reflect that it's used in several
|
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 +293,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 +304,7 @@ class Shell: public i::AllStatic { |
static CounterCollection local_counters_; |
static CounterCollection* counters_; |
Søren Thygesen Gjesse
2011/07/08 08:09:12
Should these accesses to internals be protected by
|
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, |