| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 #ifdef ENABLE_DEBUGGER_SUPPORT | 53 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 54 | 54 |
| 55 | 55 |
| 56 Debug::Debug(Isolate* isolate) | 56 Debug::Debug(Isolate* isolate) |
| 57 : has_break_points_(false), | 57 : has_break_points_(false), |
| 58 script_cache_(NULL), | 58 script_cache_(NULL), |
| 59 debug_info_list_(NULL), | 59 debug_info_list_(NULL), |
| 60 disable_break_(false), | 60 disable_break_(false), |
| 61 break_on_exception_(false), | 61 break_on_exception_(false), |
| 62 break_on_uncaught_exception_(true), | 62 break_on_uncaught_exception_(false), |
| 63 debug_break_return_(NULL), | 63 debug_break_return_(NULL), |
| 64 debug_break_slot_(NULL), | 64 debug_break_slot_(NULL), |
| 65 isolate_(isolate) { | 65 isolate_(isolate) { |
| 66 memset(registers_, 0, sizeof(JSCallerSavedBuffer)); | 66 memset(registers_, 0, sizeof(JSCallerSavedBuffer)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 | 69 |
| 70 Debug::~Debug() { | 70 Debug::~Debug() { |
| 71 } | 71 } |
| 72 | 72 |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset) = | 625 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset) = |
| 626 Smi::FromInt(StackFrame::INTERNAL); | 626 Smi::FromInt(StackFrame::INTERNAL); |
| 627 | 627 |
| 628 return reinterpret_cast<Object**>(&Memory::Object_at( | 628 return reinterpret_cast<Object**>(&Memory::Object_at( |
| 629 fp + StandardFrameConstants::kContextOffset)); | 629 fp + StandardFrameConstants::kContextOffset)); |
| 630 } | 630 } |
| 631 | 631 |
| 632 const int Debug::kFrameDropperFrameSize = 4; | 632 const int Debug::kFrameDropperFrameSize = 4; |
| 633 | 633 |
| 634 | 634 |
| 635 | |
| 636 | |
| 637 | |
| 638 void ScriptCache::Add(Handle<Script> script) { | 635 void ScriptCache::Add(Handle<Script> script) { |
| 639 Isolate* isolate = Isolate::Current(); | 636 Isolate* isolate = Isolate::Current(); |
| 640 // Create an entry in the hash map for the script. | 637 // Create an entry in the hash map for the script. |
| 641 int id = Smi::cast(script->id())->value(); | 638 int id = Smi::cast(script->id())->value(); |
| 642 HashMap::Entry* entry = | 639 HashMap::Entry* entry = |
| 643 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); | 640 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); |
| 644 if (entry->value != NULL) { | 641 if (entry->value != NULL) { |
| 645 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); | 642 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); |
| 646 return; | 643 return; |
| 647 } | 644 } |
| (...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2817 // it starts. | 2814 // it starts. |
| 2818 // Provide stub message handler; V8 auto-continues each suspend | 2815 // Provide stub message handler; V8 auto-continues each suspend |
| 2819 // when there is no message handler; we doesn't need it. | 2816 // when there is no message handler; we doesn't need it. |
| 2820 // Once become suspended, V8 will stay so indefinitely long, until remote | 2817 // Once become suspended, V8 will stay so indefinitely long, until remote |
| 2821 // debugger connects and issues "continue" command. | 2818 // debugger connects and issues "continue" command. |
| 2822 Debugger::message_handler_ = StubMessageHandler2; | 2819 Debugger::message_handler_ = StubMessageHandler2; |
| 2823 v8::Debug::DebugBreak(); | 2820 v8::Debug::DebugBreak(); |
| 2824 } | 2821 } |
| 2825 | 2822 |
| 2826 if (Socket::Setup()) { | 2823 if (Socket::Setup()) { |
| 2827 agent_ = new DebuggerAgent(isolate_, name, port); | 2824 if (agent_ == NULL) { |
| 2828 agent_->Start(); | 2825 agent_ = new DebuggerAgent(isolate_, name, port); |
| 2826 agent_->Start(); |
| 2827 } |
| 2829 return true; | 2828 return true; |
| 2830 } | 2829 } |
| 2831 | 2830 |
| 2832 return false; | 2831 return false; |
| 2833 } | 2832 } |
| 2834 | 2833 |
| 2835 | 2834 |
| 2836 void Debugger::StopAgent() { | 2835 void Debugger::StopAgent() { |
| 2837 ASSERT(Isolate::Current() == isolate_); | 2836 ASSERT(Isolate::Current() == isolate_); |
| 2838 if (agent_ != NULL) { | 2837 if (agent_ != NULL) { |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3118 } | 3117 } |
| 3119 | 3118 |
| 3120 | 3119 |
| 3121 void LockingCommandMessageQueue::Clear() { | 3120 void LockingCommandMessageQueue::Clear() { |
| 3122 ScopedLock sl(lock_); | 3121 ScopedLock sl(lock_); |
| 3123 queue_.Clear(); | 3122 queue_.Clear(); |
| 3124 } | 3123 } |
| 3125 | 3124 |
| 3126 | 3125 |
| 3127 MessageDispatchHelperThread::MessageDispatchHelperThread(Isolate* isolate) | 3126 MessageDispatchHelperThread::MessageDispatchHelperThread(Isolate* isolate) |
| 3128 : Thread(isolate), sem_(OS::CreateSemaphore(0)), mutex_(OS::CreateMutex()), | 3127 : Thread(isolate, "v8:MsgDispHelpr"), |
| 3128 sem_(OS::CreateSemaphore(0)), mutex_(OS::CreateMutex()), |
| 3129 already_signalled_(false) { | 3129 already_signalled_(false) { |
| 3130 } | 3130 } |
| 3131 | 3131 |
| 3132 | 3132 |
| 3133 MessageDispatchHelperThread::~MessageDispatchHelperThread() { | 3133 MessageDispatchHelperThread::~MessageDispatchHelperThread() { |
| 3134 delete mutex_; | 3134 delete mutex_; |
| 3135 delete sem_; | 3135 delete sem_; |
| 3136 } | 3136 } |
| 3137 | 3137 |
| 3138 | 3138 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3158 { | 3158 { |
| 3159 Locker locker; | 3159 Locker locker; |
| 3160 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3160 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
| 3161 } | 3161 } |
| 3162 } | 3162 } |
| 3163 } | 3163 } |
| 3164 | 3164 |
| 3165 #endif // ENABLE_DEBUGGER_SUPPORT | 3165 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3166 | 3166 |
| 3167 } } // namespace v8::internal | 3167 } } // namespace v8::internal |
| OLD | NEW |