| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 global_template->Set(String::New("version"), FunctionTemplate::New(Version)); | 405 global_template->Set(String::New("version"), FunctionTemplate::New(Version)); |
| 406 | 406 |
| 407 Handle<ObjectTemplate> os_templ = ObjectTemplate::New(); | 407 Handle<ObjectTemplate> os_templ = ObjectTemplate::New(); |
| 408 AddOSMethods(os_templ); | 408 AddOSMethods(os_templ); |
| 409 global_template->Set(String::New("os"), os_templ); | 409 global_template->Set(String::New("os"), os_templ); |
| 410 | 410 |
| 411 utility_context_ = Context::New(NULL, global_template); | 411 utility_context_ = Context::New(NULL, global_template); |
| 412 utility_context_->SetSecurityToken(Undefined()); | 412 utility_context_->SetSecurityToken(Undefined()); |
| 413 Context::Scope utility_scope(utility_context_); | 413 Context::Scope utility_scope(utility_context_); |
| 414 | 414 |
| 415 i::JSArguments js_args = i::FLAG_js_arguments; | |
| 416 i::Handle<i::FixedArray> arguments_array = | |
| 417 i::Factory::NewFixedArray(js_args.argc()); | |
| 418 for (int j = 0; j < js_args.argc(); j++) { | |
| 419 i::Handle<i::String> arg = | |
| 420 i::Factory::NewStringFromUtf8(i::CStrVector(js_args[j])); | |
| 421 arguments_array->set(j, *arg); | |
| 422 } | |
| 423 i::Handle<i::JSArray> arguments_jsarray = | |
| 424 i::Factory::NewJSArrayWithElements(arguments_array); | |
| 425 global_template->Set(String::New("arguments"), | 415 global_template->Set(String::New("arguments"), |
| 426 Utils::ToLocal(arguments_jsarray)); | 416 V8::GetJSArguments()); |
| 427 | 417 |
| 428 #ifdef ENABLE_DEBUGGER_SUPPORT | 418 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 429 // Install the debugger object in the utility scope | 419 // Install the debugger object in the utility scope |
| 430 i::Debug::Load(); | 420 i::Debug::Load(); |
| 431 i::JSObject* debug = i::Debug::debug_context()->global(); | 421 i::JSObject* debug = i::Debug::debug_context()->global(); |
| 432 utility_context_->Global()->Set(String::New("$debug"), | 422 utility_context_->Global()->Set(String::New("$debug"), |
| 433 Utils::ToLocal(&debug)); | 423 Utils::ToLocal(&debug)); |
| 434 #endif | 424 #endif |
| 435 | 425 |
| 436 // Run the d8 shell utility script in the utility context | 426 // Run the d8 shell utility script in the utility context |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 return 0; | 734 return 0; |
| 745 } | 735 } |
| 746 | 736 |
| 747 | 737 |
| 748 } // namespace v8 | 738 } // namespace v8 |
| 749 | 739 |
| 750 | 740 |
| 751 int main(int argc, char* argv[]) { | 741 int main(int argc, char* argv[]) { |
| 752 return v8::Shell::Main(argc, argv); | 742 return v8::Shell::Main(argc, argv); |
| 753 } | 743 } |
| OLD | NEW |