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 | |
142 class SourceGroup { | 119 class SourceGroup { |
143 public: | 120 public: |
144 SourceGroup() : | 121 SourceGroup() : |
145 #ifndef V8_SHARED | 122 #ifndef V8_SHARED |
146 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), | 123 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
147 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), | 124 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
148 thread_(NULL), | 125 thread_(NULL), |
149 #endif // V8_SHARED | 126 #endif // V8_SHARED |
150 argv_(NULL), | 127 argv_(NULL), |
151 begin_offset_(0), | 128 begin_offset_(0), |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 static Handle<Value> ChangeDirectory(const Arguments& args); | 306 static Handle<Value> ChangeDirectory(const Arguments& args); |
330 static Handle<Value> SetEnvironment(const Arguments& args); | 307 static Handle<Value> SetEnvironment(const Arguments& args); |
331 static Handle<Value> UnsetEnvironment(const Arguments& args); | 308 static Handle<Value> UnsetEnvironment(const Arguments& args); |
332 static Handle<Value> SetUMask(const Arguments& args); | 309 static Handle<Value> SetUMask(const Arguments& args); |
333 static Handle<Value> MakeDirectory(const Arguments& args); | 310 static Handle<Value> MakeDirectory(const Arguments& args); |
334 static Handle<Value> RemoveDirectory(const Arguments& args); | 311 static Handle<Value> RemoveDirectory(const Arguments& args); |
335 | 312 |
336 static void AddOSMethods(Handle<ObjectTemplate> os_template); | 313 static void AddOSMethods(Handle<ObjectTemplate> os_template); |
337 #ifndef V8_SHARED | 314 #ifndef V8_SHARED |
338 static const char* kHistoryFileName; | 315 static const char* kHistoryFileName; |
339 static LineEditor* console; | |
340 #endif // V8_SHARED | 316 #endif // V8_SHARED |
341 static const char* kPrompt; | 317 static const char* kPrompt; |
342 static ShellOptions options; | 318 static ShellOptions options; |
343 | 319 |
344 private: | 320 private: |
345 static Persistent<Context> evaluation_context_; | 321 static Persistent<Context> evaluation_context_; |
346 #ifndef V8_SHARED | 322 #ifndef V8_SHARED |
347 static Persistent<Context> utility_context_; | 323 static Persistent<Context> utility_context_; |
348 static CounterMap* counter_map_; | 324 static CounterMap* counter_map_; |
349 // We statically allocate a set of local counters to be used if we | 325 // We statically allocate a set of local counters to be used if we |
(...skipping 10 matching lines...) Expand all Loading... |
360 static void RunShell(); | 336 static void RunShell(); |
361 static bool SetOptions(int argc, char* argv[]); | 337 static bool SetOptions(int argc, char* argv[]); |
362 static Handle<ObjectTemplate> CreateGlobalTemplate(); | 338 static Handle<ObjectTemplate> CreateGlobalTemplate(); |
363 static Handle<Value> CreateExternalArray(const Arguments& args, | 339 static Handle<Value> CreateExternalArray(const Arguments& args, |
364 ExternalArrayType type, | 340 ExternalArrayType type, |
365 size_t element_size); | 341 size_t element_size); |
366 static void ExternalArrayWeakCallback(Persistent<Value> object, void* data); | 342 static void ExternalArrayWeakCallback(Persistent<Value> object, void* data); |
367 }; | 343 }; |
368 | 344 |
369 | 345 |
| 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 |
370 } // namespace v8 | 369 } // namespace v8 |
371 | 370 |
372 | 371 |
373 #endif // V8_D8_H_ | 372 #endif // V8_D8_H_ |
OLD | NEW |