| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 static int Hash(const char* name); | 112 static int Hash(const char* name); |
| 113 static bool Match(void* key1, void* key2); | 113 static bool Match(void* key1, void* key2); |
| 114 i::HashMap hash_map_; | 114 i::HashMap hash_map_; |
| 115 }; | 115 }; |
| 116 #endif // V8_SHARED | 116 #endif // V8_SHARED |
| 117 | 117 |
| 118 | 118 |
| 119 #ifndef V8_SHARED |
| 120 class LineEditor { |
| 121 public: |
| 122 enum Type { DUMB = 0, READLINE = 1 }; |
| 123 LineEditor(Type type, const char* name); |
| 124 virtual ~LineEditor() { } |
| 125 |
| 126 virtual i::SmartArrayPointer<char> Prompt(const char* prompt) = 0; |
| 127 virtual bool Open() { return true; } |
| 128 virtual bool Close() { return true; } |
| 129 virtual void AddHistory(const char* str) { } |
| 130 |
| 131 const char* name() { return name_; } |
| 132 static LineEditor* Get(); |
| 133 private: |
| 134 Type type_; |
| 135 const char* name_; |
| 136 LineEditor* next_; |
| 137 static LineEditor* first_; |
| 138 }; |
| 139 #endif // V8_SHARED |
| 140 |
| 141 |
| 119 class SourceGroup { | 142 class SourceGroup { |
| 120 public: | 143 public: |
| 121 SourceGroup() : | 144 SourceGroup() : |
| 122 #ifndef V8_SHARED | 145 #ifndef V8_SHARED |
| 123 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), | 146 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
| 124 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), | 147 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
| 125 thread_(NULL), | 148 thread_(NULL), |
| 126 #endif // V8_SHARED | 149 #endif // V8_SHARED |
| 127 argv_(NULL), | 150 argv_(NULL), |
| 128 begin_offset_(0), | 151 begin_offset_(0), |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 static Handle<Value> ChangeDirectory(const Arguments& args); | 329 static Handle<Value> ChangeDirectory(const Arguments& args); |
| 307 static Handle<Value> SetEnvironment(const Arguments& args); | 330 static Handle<Value> SetEnvironment(const Arguments& args); |
| 308 static Handle<Value> UnsetEnvironment(const Arguments& args); | 331 static Handle<Value> UnsetEnvironment(const Arguments& args); |
| 309 static Handle<Value> SetUMask(const Arguments& args); | 332 static Handle<Value> SetUMask(const Arguments& args); |
| 310 static Handle<Value> MakeDirectory(const Arguments& args); | 333 static Handle<Value> MakeDirectory(const Arguments& args); |
| 311 static Handle<Value> RemoveDirectory(const Arguments& args); | 334 static Handle<Value> RemoveDirectory(const Arguments& args); |
| 312 | 335 |
| 313 static void AddOSMethods(Handle<ObjectTemplate> os_template); | 336 static void AddOSMethods(Handle<ObjectTemplate> os_template); |
| 314 #ifndef V8_SHARED | 337 #ifndef V8_SHARED |
| 315 static const char* kHistoryFileName; | 338 static const char* kHistoryFileName; |
| 339 static const int kMaxHistoryEntries; |
| 340 static LineEditor* console; |
| 316 #endif // V8_SHARED | 341 #endif // V8_SHARED |
| 317 static const char* kPrompt; | 342 static const char* kPrompt; |
| 318 static ShellOptions options; | 343 static ShellOptions options; |
| 319 | 344 |
| 320 private: | 345 private: |
| 321 static Persistent<Context> evaluation_context_; | 346 static Persistent<Context> evaluation_context_; |
| 322 #ifndef V8_SHARED | 347 #ifndef V8_SHARED |
| 323 static Persistent<Context> utility_context_; | 348 static Persistent<Context> utility_context_; |
| 324 static CounterMap* counter_map_; | 349 static CounterMap* counter_map_; |
| 325 // We statically allocate a set of local counters to be used if we | 350 // We statically allocate a set of local counters to be used if we |
| (...skipping 10 matching lines...) Expand all Loading... |
| 336 static void RunShell(); | 361 static void RunShell(); |
| 337 static bool SetOptions(int argc, char* argv[]); | 362 static bool SetOptions(int argc, char* argv[]); |
| 338 static Handle<ObjectTemplate> CreateGlobalTemplate(); | 363 static Handle<ObjectTemplate> CreateGlobalTemplate(); |
| 339 static Handle<Value> CreateExternalArray(const Arguments& args, | 364 static Handle<Value> CreateExternalArray(const Arguments& args, |
| 340 ExternalArrayType type, | 365 ExternalArrayType type, |
| 341 size_t element_size); | 366 size_t element_size); |
| 342 static void ExternalArrayWeakCallback(Persistent<Value> object, void* data); | 367 static void ExternalArrayWeakCallback(Persistent<Value> object, void* data); |
| 343 }; | 368 }; |
| 344 | 369 |
| 345 | 370 |
| 346 #ifndef V8_SHARED | |
| 347 class LineEditor { | |
| 348 public: | |
| 349 enum Type { DUMB = 0, READLINE = 1 }; | |
| 350 LineEditor(Type type, const char* name); | |
| 351 virtual ~LineEditor() { } | |
| 352 | |
| 353 virtual i::SmartArrayPointer<char> Prompt(const char* prompt) = 0; | |
| 354 virtual bool Open() { return true; } | |
| 355 virtual bool Close() { return true; } | |
| 356 virtual void AddHistory(const char* str) { } | |
| 357 | |
| 358 const char* name() { return name_; } | |
| 359 static LineEditor* Get(); | |
| 360 private: | |
| 361 Type type_; | |
| 362 const char* name_; | |
| 363 LineEditor* next_; | |
| 364 static LineEditor* first_; | |
| 365 }; | |
| 366 #endif // V8_SHARED | |
| 367 | |
| 368 | |
| 369 } // namespace v8 | 371 } // namespace v8 |
| 370 | 372 |
| 371 | 373 |
| 372 #endif // V8_D8_H_ | 374 #endif // V8_D8_H_ |
| OLD | NEW |