| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 #ifdef ENABLE_DEBUGGER_SUPPORT | 294 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 295 static Handle<Object> DebugMessageDetails(Isolate* isolate, | 295 static Handle<Object> DebugMessageDetails(Isolate* isolate, |
| 296 Handle<String> message); | 296 Handle<String> message); |
| 297 static Handle<Value> DebugCommandToJSONRequest(Isolate* isolate, | 297 static Handle<Value> DebugCommandToJSONRequest(Isolate* isolate, |
| 298 Handle<String> command); | 298 Handle<String> command); |
| 299 static void DispatchDebugMessages(); | 299 static void DispatchDebugMessages(); |
| 300 #endif // ENABLE_DEBUGGER_SUPPORT | 300 #endif // ENABLE_DEBUGGER_SUPPORT |
| 301 #endif // V8_SHARED | 301 #endif // V8_SHARED |
| 302 | 302 |
| 303 static Handle<Value> RealmCurrent(const Arguments& args); | 303 static void RealmCurrent(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 304 static Handle<Value> RealmOwner(const Arguments& args); | 304 static void RealmOwner(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 305 static Handle<Value> RealmGlobal(const Arguments& args); | 305 static void RealmGlobal(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 306 static Handle<Value> RealmCreate(const Arguments& args); | 306 static void RealmCreate(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 307 static Handle<Value> RealmDispose(const Arguments& args); | 307 static void RealmDispose(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 308 static Handle<Value> RealmSwitch(const Arguments& args); | 308 static void RealmSwitch(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 309 static Handle<Value> RealmEval(const Arguments& args); | 309 static void RealmEval(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 310 static Handle<Value> RealmSharedGet(Local<String> property, | 310 static void RealmSharedGet(Local<String> property, |
| 311 const AccessorInfo& info); | 311 const PropertyCallbackInfo<Value>& info); |
| 312 static void RealmSharedSet(Local<String> property, | 312 static void RealmSharedSet(Local<String> property, |
| 313 Local<Value> value, | 313 Local<Value> value, |
| 314 const AccessorInfo& info); | 314 const PropertyCallbackInfo<void>& info); |
| 315 | 315 |
| 316 static Handle<Value> Print(const Arguments& args); | 316 static void Print(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 317 static Handle<Value> Write(const Arguments& args); | 317 static void Write(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 318 static Handle<Value> Quit(const Arguments& args); | 318 static void Quit(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 319 static Handle<Value> Version(const Arguments& args); | 319 static void Version(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 320 static Handle<Value> EnableProfiler(const Arguments& args); | 320 static void EnableProfiler(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 321 static Handle<Value> DisableProfiler(const Arguments& args); | 321 static void DisableProfiler(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 322 static Handle<Value> Read(const Arguments& args); | 322 static void Read(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 323 static Handle<Value> ReadBuffer(const Arguments& args); | 323 static void ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 324 static Handle<String> ReadFromStdin(Isolate* isolate); | 324 static Handle<String> ReadFromStdin(Isolate* isolate); |
| 325 static Handle<Value> ReadLine(const Arguments& args) { | 325 static void ReadLine(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 326 return ReadFromStdin(args.GetIsolate()); | 326 args.GetReturnValue().Set(ReadFromStdin(args.GetIsolate())); |
| 327 } | 327 } |
| 328 static Handle<Value> Load(const Arguments& args); | 328 static void Load(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 329 static Handle<Value> ArrayBuffer(const Arguments& args); | 329 static void ArrayBuffer(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 330 static Handle<Value> Int8Array(const Arguments& args); | 330 static void Int8Array(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 331 static Handle<Value> Uint8Array(const Arguments& args); | 331 static void Uint8Array(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 332 static Handle<Value> Int16Array(const Arguments& args); | 332 static void Int16Array(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 333 static Handle<Value> Uint16Array(const Arguments& args); | 333 static void Uint16Array(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 334 static Handle<Value> Int32Array(const Arguments& args); | 334 static void Int32Array(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 335 static Handle<Value> Uint32Array(const Arguments& args); | 335 static void Uint32Array(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 336 static Handle<Value> Float32Array(const Arguments& args); | 336 static void Float32Array(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 337 static Handle<Value> Float64Array(const Arguments& args); | 337 static void Float64Array(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 338 static Handle<Value> Uint8ClampedArray(const Arguments& args); | 338 static void Uint8ClampedArray( |
| 339 static Handle<Value> ArrayBufferSlice(const Arguments& args); | 339 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 340 static Handle<Value> ArraySubArray(const Arguments& args); | 340 static void ArrayBufferSlice(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 341 static Handle<Value> ArraySet(const Arguments& args); | 341 static void ArraySubArray(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 342 static void ArraySet(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 342 // The OS object on the global object contains methods for performing | 343 // The OS object on the global object contains methods for performing |
| 343 // operating system calls: | 344 // operating system calls: |
| 344 // | 345 // |
| 345 // os.system("program_name", ["arg1", "arg2", ...], timeout1, timeout2) will | 346 // os.system("program_name", ["arg1", "arg2", ...], timeout1, timeout2) will |
| 346 // run the command, passing the arguments to the program. The standard output | 347 // run the command, passing the arguments to the program. The standard output |
| 347 // of the program will be picked up and returned as a multiline string. If | 348 // of the program will be picked up and returned as a multiline string. If |
| 348 // timeout1 is present then it should be a number. -1 indicates no timeout | 349 // timeout1 is present then it should be a number. -1 indicates no timeout |
| 349 // and a positive number is used as a timeout in milliseconds that limits the | 350 // and a positive number is used as a timeout in milliseconds that limits the |
| 350 // time spent waiting between receiving output characters from the program. | 351 // time spent waiting between receiving output characters from the program. |
| 351 // timeout2, if present, should be a number indicating the limit in | 352 // timeout2, if present, should be a number indicating the limit in |
| 352 // milliseconds on the total running time of the program. Exceptions are | 353 // milliseconds on the total running time of the program. Exceptions are |
| 353 // thrown on timeouts or other errors or if the exit status of the program | 354 // thrown on timeouts or other errors or if the exit status of the program |
| 354 // indicates an error. | 355 // indicates an error. |
| 355 // | 356 // |
| 356 // os.chdir(dir) changes directory to the given directory. Throws an | 357 // os.chdir(dir) changes directory to the given directory. Throws an |
| 357 // exception/ on error. | 358 // exception/ on error. |
| 358 // | 359 // |
| 359 // os.setenv(variable, value) sets an environment variable. Repeated calls to | 360 // os.setenv(variable, value) sets an environment variable. Repeated calls to |
| 360 // this method leak memory due to the API of setenv in the standard C library. | 361 // this method leak memory due to the API of setenv in the standard C library. |
| 361 // | 362 // |
| 362 // os.umask(alue) calls the umask system call and returns the old umask. | 363 // os.umask(alue) calls the umask system call and returns the old umask. |
| 363 // | 364 // |
| 364 // os.mkdirp(name, mask) creates a directory. The mask (if present) is anded | 365 // os.mkdirp(name, mask) creates a directory. The mask (if present) is anded |
| 365 // with the current umask. Intermediate directories are created if necessary. | 366 // with the current umask. Intermediate directories are created if necessary. |
| 366 // An exception is not thrown if the directory already exists. Analogous to | 367 // An exception is not thrown if the directory already exists. Analogous to |
| 367 // the "mkdir -p" command. | 368 // the "mkdir -p" command. |
| 368 static Handle<Value> OSObject(const Arguments& args); | 369 static void OSObject(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 369 static Handle<Value> System(const Arguments& args); | 370 static void System(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 370 static Handle<Value> ChangeDirectory(const Arguments& args); | 371 static void ChangeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 371 static Handle<Value> SetEnvironment(const Arguments& args); | 372 static void SetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 372 static Handle<Value> UnsetEnvironment(const Arguments& args); | 373 static void UnsetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 373 static Handle<Value> SetUMask(const Arguments& args); | 374 static void SetUMask(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 374 static Handle<Value> MakeDirectory(const Arguments& args); | 375 static void MakeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 375 static Handle<Value> RemoveDirectory(const Arguments& args); | 376 static void RemoveDirectory(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 376 | 377 |
| 377 static void AddOSMethods(Handle<ObjectTemplate> os_template); | 378 static void AddOSMethods(Handle<ObjectTemplate> os_template); |
| 378 | 379 |
| 379 static const char* kPrompt; | 380 static const char* kPrompt; |
| 380 static ShellOptions options; | 381 static ShellOptions options; |
| 381 | 382 |
| 382 private: | 383 private: |
| 383 static Persistent<Context> evaluation_context_; | 384 static Persistent<Context> evaluation_context_; |
| 384 #ifndef V8_SHARED | 385 #ifndef V8_SHARED |
| 385 static Persistent<Context> utility_context_; | 386 static Persistent<Context> utility_context_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 405 Handle<Object> buffer, | 406 Handle<Object> buffer, |
| 406 int32_t size); | 407 int32_t size); |
| 407 static Handle<Object> CreateExternalArray(Isolate* isolate, | 408 static Handle<Object> CreateExternalArray(Isolate* isolate, |
| 408 Handle<Object> array, | 409 Handle<Object> array, |
| 409 Handle<Object> buffer, | 410 Handle<Object> buffer, |
| 410 ExternalArrayType type, | 411 ExternalArrayType type, |
| 411 int32_t length, | 412 int32_t length, |
| 412 int32_t byteLength, | 413 int32_t byteLength, |
| 413 int32_t byteOffset, | 414 int32_t byteOffset, |
| 414 int32_t element_size); | 415 int32_t element_size); |
| 415 static Handle<Value> CreateExternalArray(const Arguments& args, | 416 static void CreateExternalArray( |
| 416 ExternalArrayType type, | 417 const v8::FunctionCallbackInfo<v8::Value>& args, |
| 417 int32_t element_size); | 418 ExternalArrayType type, |
| 419 int32_t element_size); |
| 418 static void ExternalArrayWeakCallback(Isolate* isolate, | 420 static void ExternalArrayWeakCallback(Isolate* isolate, |
| 419 Persistent<Object>* object, | 421 Persistent<Object>* object, |
| 420 uint8_t* data); | 422 uint8_t* data); |
| 421 }; | 423 }; |
| 422 | 424 |
| 423 | 425 |
| 424 } // namespace v8 | 426 } // namespace v8 |
| 425 | 427 |
| 426 | 428 |
| 427 #endif // V8_D8_H_ | 429 #endif // V8_D8_H_ |
| OLD | NEW |