| 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 i::Handle<i::Script>(i::Script::cast(script_fun->shared()->script())); | 453 i::Handle<i::Script>(i::Script::cast(script_fun->shared()->script())); |
| 454 script_object->set_type(i::Smi::FromInt(i::SCRIPT_TYPE_NATIVE)); | 454 script_object->set_type(i::Smi::FromInt(i::SCRIPT_TYPE_NATIVE)); |
| 455 | 455 |
| 456 // Create the evaluation context | 456 // Create the evaluation context |
| 457 evaluation_context_ = Context::New(NULL, global_template); | 457 evaluation_context_ = Context::New(NULL, global_template); |
| 458 evaluation_context_->SetSecurityToken(Undefined()); | 458 evaluation_context_->SetSecurityToken(Undefined()); |
| 459 | 459 |
| 460 #ifdef ENABLE_DEBUGGER_SUPPORT | 460 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 461 // Set the security token of the debug context to allow access. | 461 // Set the security token of the debug context to allow access. |
| 462 i::Debug::debug_context()->set_security_token(i::Heap::undefined_value()); | 462 i::Debug::debug_context()->set_security_token(i::Heap::undefined_value()); |
| 463 |
| 464 // Start the debugger agent if requested. |
| 465 if (i::FLAG_debugger_agent) { |
| 466 v8::Debug::EnableAgent("d8 shell", i::FLAG_debugger_port); |
| 467 } |
| 468 |
| 469 // Start the in-process debugger if requested. |
| 470 if (i::FLAG_debugger && !i::FLAG_debugger_agent) { |
| 471 v8::Debug::SetDebugEventListener(HandleDebugEvent); |
| 472 } |
| 463 #endif | 473 #endif |
| 464 } | 474 } |
| 465 | 475 |
| 466 | 476 |
| 467 void Shell::OnExit() { | 477 void Shell::OnExit() { |
| 468 if (i::FLAG_dump_counters) { | 478 if (i::FLAG_dump_counters) { |
| 469 ::printf("+----------------------------------------+-------------+\n"); | 479 ::printf("+----------------------------------------+-------------+\n"); |
| 470 ::printf("| Name | Value |\n"); | 480 ::printf("| Name | Value |\n"); |
| 471 ::printf("+----------------------------------------+-------------+\n"); | 481 ::printf("+----------------------------------------+-------------+\n"); |
| 472 for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) { | 482 for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 if (threads.length() > 0 && use_preemption) { | 724 if (threads.length() > 0 && use_preemption) { |
| 715 Locker::StartPreemption(preemption_interval); | 725 Locker::StartPreemption(preemption_interval); |
| 716 } | 726 } |
| 717 | 727 |
| 718 #ifdef ENABLE_DEBUGGER_SUPPORT | 728 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 719 // Run the remote debugger if requested. | 729 // Run the remote debugger if requested. |
| 720 if (i::FLAG_remote_debugger) { | 730 if (i::FLAG_remote_debugger) { |
| 721 RunRemoteDebugger(i::FLAG_debugger_port); | 731 RunRemoteDebugger(i::FLAG_debugger_port); |
| 722 return 0; | 732 return 0; |
| 723 } | 733 } |
| 724 | |
| 725 // Start the debugger agent if requested. | |
| 726 if (i::FLAG_debugger_agent) { | |
| 727 v8::Debug::EnableAgent("d8 shell", i::FLAG_debugger_port); | |
| 728 } | |
| 729 | |
| 730 // Start the in-process debugger if requested. | |
| 731 if (i::FLAG_debugger && !i::FLAG_debugger_agent) { | |
| 732 v8::Debug::SetDebugEventListener(HandleDebugEvent); | |
| 733 } | |
| 734 #endif | 734 #endif |
| 735 } | 735 } |
| 736 if (run_shell) | 736 if (run_shell) |
| 737 RunShell(); | 737 RunShell(); |
| 738 for (int i = 0; i < threads.length(); i++) { | 738 for (int i = 0; i < threads.length(); i++) { |
| 739 i::Thread* thread = threads[i]; | 739 i::Thread* thread = threads[i]; |
| 740 thread->Join(); | 740 thread->Join(); |
| 741 delete thread; | 741 delete thread; |
| 742 } | 742 } |
| 743 OnExit(); | 743 OnExit(); |
| 744 return 0; | 744 return 0; |
| 745 } | 745 } |
| 746 | 746 |
| 747 | 747 |
| 748 } // namespace v8 | 748 } // namespace v8 |
| 749 | 749 |
| 750 | 750 |
| 751 int main(int argc, char* argv[]) { | 751 int main(int argc, char* argv[]) { |
| 752 return v8::Shell::Main(argc, argv); | 752 return v8::Shell::Main(argc, argv); |
| 753 } | 753 } |
| OLD | NEW |