| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 #endif | 147 #endif |
| 148 | 148 |
| 149 static Handle<Value> Print(const Arguments& args); | 149 static Handle<Value> Print(const Arguments& args); |
| 150 static Handle<Value> Write(const Arguments& args); | 150 static Handle<Value> Write(const Arguments& args); |
| 151 static Handle<Value> Yield(const Arguments& args); | 151 static Handle<Value> Yield(const Arguments& args); |
| 152 static Handle<Value> Quit(const Arguments& args); | 152 static Handle<Value> Quit(const Arguments& args); |
| 153 static Handle<Value> Version(const Arguments& args); | 153 static Handle<Value> Version(const Arguments& args); |
| 154 static Handle<Value> Read(const Arguments& args); | 154 static Handle<Value> Read(const Arguments& args); |
| 155 static Handle<Value> ReadLine(const Arguments& args); | 155 static Handle<Value> ReadLine(const Arguments& args); |
| 156 static Handle<Value> Load(const Arguments& args); | 156 static Handle<Value> Load(const Arguments& args); |
| 157 static Handle<Value> Int8Array(const Arguments& args); |
| 158 static Handle<Value> Uint8Array(const Arguments& args); |
| 159 static Handle<Value> Int16Array(const Arguments& args); |
| 160 static Handle<Value> Uint16Array(const Arguments& args); |
| 161 static Handle<Value> Int32Array(const Arguments& args); |
| 162 static Handle<Value> Uint32Array(const Arguments& args); |
| 163 static Handle<Value> Float32Array(const Arguments& args); |
| 164 static Handle<Value> Float64Array(const Arguments& args); |
| 165 static Handle<Value> PixelArray(const Arguments& args); |
| 157 // The OS object on the global object contains methods for performing | 166 // The OS object on the global object contains methods for performing |
| 158 // operating system calls: | 167 // operating system calls: |
| 159 // | 168 // |
| 160 // os.system("program_name", ["arg1", "arg2", ...], timeout1, timeout2) will | 169 // os.system("program_name", ["arg1", "arg2", ...], timeout1, timeout2) will |
| 161 // run the command, passing the arguments to the program. The standard output | 170 // run the command, passing the arguments to the program. The standard output |
| 162 // of the program will be picked up and returned as a multiline string. If | 171 // of the program will be picked up and returned as a multiline string. If |
| 163 // timeout1 is present then it should be a number. -1 indicates no timeout | 172 // timeout1 is present then it should be a number. -1 indicates no timeout |
| 164 // and a positive number is used as a timeout in milliseconds that limits the | 173 // and a positive number is used as a timeout in milliseconds that limits the |
| 165 // time spent waiting between receiving output characters from the program. | 174 // time spent waiting between receiving output characters from the program. |
| 166 // timeout2, if present, should be a number indicating the limit in | 175 // timeout2, if present, should be a number indicating the limit in |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 private: | 207 private: |
| 199 static Persistent<Context> utility_context_; | 208 static Persistent<Context> utility_context_; |
| 200 static Persistent<Context> evaluation_context_; | 209 static Persistent<Context> evaluation_context_; |
| 201 static CounterMap* counter_map_; | 210 static CounterMap* counter_map_; |
| 202 // We statically allocate a set of local counters to be used if we | 211 // We statically allocate a set of local counters to be used if we |
| 203 // don't want to store the stats in a memory-mapped file | 212 // don't want to store the stats in a memory-mapped file |
| 204 static CounterCollection local_counters_; | 213 static CounterCollection local_counters_; |
| 205 static CounterCollection* counters_; | 214 static CounterCollection* counters_; |
| 206 static i::OS::MemoryMappedFile* counters_file_; | 215 static i::OS::MemoryMappedFile* counters_file_; |
| 207 static Counter* GetCounter(const char* name, bool is_histogram); | 216 static Counter* GetCounter(const char* name, bool is_histogram); |
| 217 static Handle<Value> CreateExternalArray(const Arguments& args, |
| 218 ExternalArrayType type, |
| 219 int element_size); |
| 220 static void ExternalArrayWeakCallback(Persistent<Value> object, void* data); |
| 208 }; | 221 }; |
| 209 | 222 |
| 210 | 223 |
| 211 class LineEditor { | 224 class LineEditor { |
| 212 public: | 225 public: |
| 213 enum Type { DUMB = 0, READLINE = 1 }; | 226 enum Type { DUMB = 0, READLINE = 1 }; |
| 214 LineEditor(Type type, const char* name); | 227 LineEditor(Type type, const char* name); |
| 215 virtual ~LineEditor() { } | 228 virtual ~LineEditor() { } |
| 216 | 229 |
| 217 virtual i::SmartPointer<char> Prompt(const char* prompt) = 0; | 230 virtual i::SmartPointer<char> Prompt(const char* prompt) = 0; |
| 218 virtual bool Open() { return true; } | 231 virtual bool Open() { return true; } |
| 219 virtual bool Close() { return true; } | 232 virtual bool Close() { return true; } |
| 220 virtual void AddHistory(const char* str) { } | 233 virtual void AddHistory(const char* str) { } |
| 221 | 234 |
| 222 const char* name() { return name_; } | 235 const char* name() { return name_; } |
| 223 static LineEditor* Get(); | 236 static LineEditor* Get(); |
| 224 private: | 237 private: |
| 225 Type type_; | 238 Type type_; |
| 226 const char* name_; | 239 const char* name_; |
| 227 LineEditor* next_; | 240 LineEditor* next_; |
| 228 static LineEditor* first_; | 241 static LineEditor* first_; |
| 229 }; | 242 }; |
| 230 | 243 |
| 231 | 244 |
| 232 } // namespace v8 | 245 } // namespace v8 |
| 233 | 246 |
| 234 | 247 |
| 235 #endif // V8_D8_H_ | 248 #endif // V8_D8_H_ |
| OLD | NEW |