| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 { | 119 class LineEditor { |
| 121 public: | 120 public: |
| 122 enum Type { DUMB = 0, READLINE = 1 }; | 121 enum Type { DUMB = 0, READLINE = 1 }; |
| 123 LineEditor(Type type, const char* name); | 122 LineEditor(Type type, const char* name); |
| 124 virtual ~LineEditor() { } | 123 virtual ~LineEditor() { } |
| 125 | 124 |
| 126 virtual i::SmartArrayPointer<char> Prompt(const char* prompt) = 0; | 125 virtual Handle<String> Prompt(const char* prompt) = 0; |
| 127 virtual bool Open() { return true; } | 126 virtual bool Open() { return true; } |
| 128 virtual bool Close() { return true; } | 127 virtual bool Close() { return true; } |
| 129 virtual void AddHistory(const char* str) { } | 128 virtual void AddHistory(const char* str) { } |
| 130 | 129 |
| 131 const char* name() { return name_; } | 130 const char* name() { return name_; } |
| 132 static LineEditor* Get(); | 131 static LineEditor* Get(); |
| 133 private: | 132 private: |
| 134 Type type_; | 133 Type type_; |
| 135 const char* name_; | 134 const char* name_; |
| 136 LineEditor* next_; | 135 LineEditor* next_; |
| 137 static LineEditor* first_; | 136 static LineEditor* first_; |
| 138 }; | 137 }; |
| 139 #endif // V8_SHARED | |
| 140 | 138 |
| 141 | 139 |
| 142 class SourceGroup { | 140 class SourceGroup { |
| 143 public: | 141 public: |
| 144 SourceGroup() : | 142 SourceGroup() : |
| 145 #ifndef V8_SHARED | 143 #ifndef V8_SHARED |
| 146 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), | 144 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
| 147 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), | 145 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
| 148 thread_(NULL), | 146 thread_(NULL), |
| 149 #endif // V8_SHARED | 147 #endif // V8_SHARED |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 #endif | 278 #endif |
| 281 | 279 |
| 282 static Handle<Value> Print(const Arguments& args); | 280 static Handle<Value> Print(const Arguments& args); |
| 283 static Handle<Value> Write(const Arguments& args); | 281 static Handle<Value> Write(const Arguments& args); |
| 284 static Handle<Value> Yield(const Arguments& args); | 282 static Handle<Value> Yield(const Arguments& args); |
| 285 static Handle<Value> Quit(const Arguments& args); | 283 static Handle<Value> Quit(const Arguments& args); |
| 286 static Handle<Value> Version(const Arguments& args); | 284 static Handle<Value> Version(const Arguments& args); |
| 287 static Handle<Value> EnableProfiler(const Arguments& args); | 285 static Handle<Value> EnableProfiler(const Arguments& args); |
| 288 static Handle<Value> DisableProfiler(const Arguments& args); | 286 static Handle<Value> DisableProfiler(const Arguments& args); |
| 289 static Handle<Value> Read(const Arguments& args); | 287 static Handle<Value> Read(const Arguments& args); |
| 290 static Handle<Value> ReadLine(const Arguments& args); | 288 static Handle<String> ReadFromStdin(); |
| 289 static Handle<Value> ReadLine(const Arguments& args) { |
| 290 return ReadFromStdin(); |
| 291 } |
| 291 static Handle<Value> Load(const Arguments& args); | 292 static Handle<Value> Load(const Arguments& args); |
| 292 static Handle<Value> ArrayBuffer(const Arguments& args); | 293 static Handle<Value> ArrayBuffer(const Arguments& args); |
| 293 static Handle<Value> Int8Array(const Arguments& args); | 294 static Handle<Value> Int8Array(const Arguments& args); |
| 294 static Handle<Value> Uint8Array(const Arguments& args); | 295 static Handle<Value> Uint8Array(const Arguments& args); |
| 295 static Handle<Value> Int16Array(const Arguments& args); | 296 static Handle<Value> Int16Array(const Arguments& args); |
| 296 static Handle<Value> Uint16Array(const Arguments& args); | 297 static Handle<Value> Uint16Array(const Arguments& args); |
| 297 static Handle<Value> Int32Array(const Arguments& args); | 298 static Handle<Value> Int32Array(const Arguments& args); |
| 298 static Handle<Value> Uint32Array(const Arguments& args); | 299 static Handle<Value> Uint32Array(const Arguments& args); |
| 299 static Handle<Value> Float32Array(const Arguments& args); | 300 static Handle<Value> Float32Array(const Arguments& args); |
| 300 static Handle<Value> Float64Array(const Arguments& args); | 301 static Handle<Value> Float64Array(const Arguments& args); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 328 static Handle<Value> OSObject(const Arguments& args); | 329 static Handle<Value> OSObject(const Arguments& args); |
| 329 static Handle<Value> System(const Arguments& args); | 330 static Handle<Value> System(const Arguments& args); |
| 330 static Handle<Value> ChangeDirectory(const Arguments& args); | 331 static Handle<Value> ChangeDirectory(const Arguments& args); |
| 331 static Handle<Value> SetEnvironment(const Arguments& args); | 332 static Handle<Value> SetEnvironment(const Arguments& args); |
| 332 static Handle<Value> UnsetEnvironment(const Arguments& args); | 333 static Handle<Value> UnsetEnvironment(const Arguments& args); |
| 333 static Handle<Value> SetUMask(const Arguments& args); | 334 static Handle<Value> SetUMask(const Arguments& args); |
| 334 static Handle<Value> MakeDirectory(const Arguments& args); | 335 static Handle<Value> MakeDirectory(const Arguments& args); |
| 335 static Handle<Value> RemoveDirectory(const Arguments& args); | 336 static Handle<Value> RemoveDirectory(const Arguments& args); |
| 336 | 337 |
| 337 static void AddOSMethods(Handle<ObjectTemplate> os_template); | 338 static void AddOSMethods(Handle<ObjectTemplate> os_template); |
| 338 #ifndef V8_SHARED | 339 |
| 339 static const char* kHistoryFileName; | |
| 340 static const int kMaxHistoryEntries; | |
| 341 static LineEditor* console; | 340 static LineEditor* console; |
| 342 #endif // V8_SHARED | |
| 343 static const char* kPrompt; | 341 static const char* kPrompt; |
| 344 static ShellOptions options; | 342 static ShellOptions options; |
| 345 | 343 |
| 346 private: | 344 private: |
| 347 static Persistent<Context> evaluation_context_; | 345 static Persistent<Context> evaluation_context_; |
| 348 #ifndef V8_SHARED | 346 #ifndef V8_SHARED |
| 349 static Persistent<Context> utility_context_; | 347 static Persistent<Context> utility_context_; |
| 350 static CounterMap* counter_map_; | 348 static CounterMap* counter_map_; |
| 351 // We statically allocate a set of local counters to be used if we | 349 // We statically allocate a set of local counters to be used if we |
| 352 // don't want to store the stats in a memory-mapped file | 350 // don't want to store the stats in a memory-mapped file |
| (...skipping 13 matching lines...) Expand all Loading... |
| 366 ExternalArrayType type, | 364 ExternalArrayType type, |
| 367 size_t element_size); | 365 size_t element_size); |
| 368 static void ExternalArrayWeakCallback(Persistent<Value> object, void* data); | 366 static void ExternalArrayWeakCallback(Persistent<Value> object, void* data); |
| 369 }; | 367 }; |
| 370 | 368 |
| 371 | 369 |
| 372 } // namespace v8 | 370 } // namespace v8 |
| 373 | 371 |
| 374 | 372 |
| 375 #endif // V8_D8_H_ | 373 #endif // V8_D8_H_ |
| OLD | NEW |