| Index: src/d8.h
|
| diff --git a/src/d8.h b/src/d8.h
|
| index 7f0272710b4b160f9b1a5a90ea4f4b5e8309cc65..e121fb38d1c9fe88e2e7386a6c73040dc8750a22 100644
|
| --- a/src/d8.h
|
| +++ b/src/d8.h
|
| @@ -28,16 +28,23 @@
|
| #ifndef V8_D8_H_
|
| #define V8_D8_H_
|
|
|
| -#include "allocation.h"
|
| +
|
| +#ifndef D8_LIGHT
|
| #include "v8.h"
|
| +#include "allocation.h"
|
| #include "hashmap.h"
|
| +#else
|
| +#include "../include/v8.h"
|
| +#endif // D8_LIGHT
|
|
|
| namespace v8 {
|
|
|
| -
|
| +#ifndef D8_LIGHT
|
| namespace i = v8::internal;
|
| +#endif // D8_LIGHT
|
|
|
|
|
| +#ifndef D8_LIGHT
|
| // A single counter in a counter collection.
|
| class Counter {
|
| public:
|
| @@ -110,17 +117,20 @@ class CounterMap {
|
| static bool Match(void* key1, void* key2);
|
| i::HashMap hash_map_;
|
| };
|
| +#endif // D8_LIGHT
|
|
|
|
|
| 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) { }
|
| + SourceGroup() :
|
| +#ifndef D8_LIGHT
|
| + next_semaphore_(v8::internal::OS::CreateSemaphore(0)),
|
| + done_semaphore_(v8::internal::OS::CreateSemaphore(0)),
|
| + thread_(NULL),
|
| +#endif // D8_LIGHT
|
| + argv_(NULL),
|
| + begin_offset_(0),
|
| + end_offset_(0) { }
|
|
|
| void Begin(char** argv, int offset) {
|
| argv_ = const_cast<const char**>(argv);
|
| @@ -131,6 +141,7 @@ class SourceGroup {
|
|
|
| void Execute();
|
|
|
| +#ifndef D8_LIGHT
|
| void StartExecuteInThread();
|
| void WaitForThread();
|
|
|
| @@ -154,6 +165,7 @@ class SourceGroup {
|
| i::Semaphore* next_semaphore_;
|
| i::Semaphore* done_semaphore_;
|
| i::Thread* thread_;
|
| +#endif // D8_LIGHT
|
|
|
| void ExitShell(int exit_code);
|
| Handle<String> ReadFile(const char* name);
|
| @@ -166,34 +178,42 @@ class SourceGroup {
|
|
|
| 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) { }
|
| -
|
| + ShellOptions() :
|
| +#ifndef D8_LIGHT
|
| + use_preemption(true),
|
| + preemption_interval(10),
|
| + parallel_files(NULL),
|
| +#endif // D8_LIGHT
|
| + script_executed(false),
|
| + last_run(true),
|
| + stress_opt(false),
|
| + stress_deopt(false),
|
| + interactive_shell(false),
|
| + test_shell(false),
|
| + num_isolates(1),
|
| + isolate_sources(NULL) { }
|
| +
|
| +#ifndef D8_LIGHT
|
| + bool use_preemption;
|
| + int preemption_interval;
|
| + i::List< i::Vector<const char> >* parallel_files;
|
| +#endif // D8_LIGHT
|
| 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 {
|
| +class Shell
|
| +#ifndef D8_LIGHT
|
| +: public i::AllStatic
|
| +#endif // D8_LIGHT
|
| +{
|
| public:
|
| static bool ExecuteString(Handle<String> source,
|
| Handle<Value> name,
|
| @@ -201,6 +221,14 @@ class Shell: public i::AllStatic {
|
| bool report_exceptions);
|
| static const char* ToCString(const v8::String::Utf8Value& value);
|
| static void ReportException(TryCatch* try_catch);
|
| + static Handle<String> ReadFile(const char* name);
|
| + static Persistent<Context> CreateEvaluationContext();
|
| + static int RunMain(int argc, char* argv[]);
|
| + static int Main(int argc, char* argv[]);
|
| +
|
| +#ifndef D8_LIGHT
|
| + static Handle<Array> GetCompletions(Handle<String> text,
|
| + Handle<String> full);
|
| static void OnExit();
|
| static int* LookupCounter(const char* name);
|
| static void* CreateHistogram(const char* name,
|
| @@ -209,18 +237,8 @@ class Shell: public i::AllStatic {
|
| size_t buckets);
|
| static void AddHistogramSample(void* histogram, int sample);
|
| static void MapCounters(const char* name);
|
| - static Handle<String> ReadFile(const char* name);
|
| - 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[]);
|
| - static int Main(int argc, char* argv[]);
|
| - static Handle<ObjectTemplate> CreateGlobalTemplate();
|
| - static Handle<Array> GetCompletions(Handle<String> text,
|
| - Handle<String> full);
|
| +#endif // D8_LIGHT
|
| +
|
| #ifdef ENABLE_DEBUGGER_SUPPORT
|
| static Handle<Object> DebugMessageDetails(Handle<String> message);
|
| static Handle<Value> DebugCommandToJSONRequest(Handle<String> command);
|
| @@ -283,15 +301,16 @@ class Shell: public i::AllStatic {
|
| static Handle<Value> RemoveDirectory(const Arguments& args);
|
|
|
| static void AddOSMethods(Handle<ObjectTemplate> os_template);
|
| -
|
| +#ifndef D8_LIGHT
|
| static const char* kHistoryFileName;
|
| +#endif // D8_LIGHT
|
| static const char* kPrompt;
|
| -
|
| static ShellOptions options;
|
|
|
| private:
|
| - static Persistent<Context> utility_context_;
|
| static Persistent<Context> evaluation_context_;
|
| +#ifndef D8_LIGHT
|
| + static Persistent<Context> utility_context_;
|
| static CounterMap* counter_map_;
|
| // We statically allocate a set of local counters to be used if we
|
| // don't want to store the stats in a memory-mapped file
|
| @@ -299,7 +318,14 @@ class Shell: public i::AllStatic {
|
| static CounterCollection* counters_;
|
| static i::OS::MemoryMappedFile* counters_file_;
|
| static i::Mutex* context_mutex_;
|
| +
|
| static Counter* GetCounter(const char* name, bool is_histogram);
|
| + static void InstallUtilityScript();
|
| +#endif // D8_LIGHT
|
| + static void Initialize();
|
| + static void RunShell();
|
| + static bool SetOptions(int argc, char* argv[]);
|
| + static Handle<ObjectTemplate> CreateGlobalTemplate();
|
| static Handle<Value> CreateExternalArray(const Arguments& args,
|
| ExternalArrayType type,
|
| size_t element_size);
|
| @@ -307,6 +333,7 @@ class Shell: public i::AllStatic {
|
| };
|
|
|
|
|
| +#ifndef D8_LIGHT
|
| class LineEditor {
|
| public:
|
| enum Type { DUMB = 0, READLINE = 1 };
|
| @@ -326,6 +353,7 @@ class LineEditor {
|
| LineEditor* next_;
|
| static LineEditor* first_;
|
| };
|
| +#endif // D8_LIGHT
|
|
|
|
|
| } // namespace v8
|
|
|