| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "api.h" | 5 #include "api.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
| 8 #include <cmath> // For isnan. | 8 #include <cmath> // For isnan. |
| 9 #include "../include/v8-debug.h" | 9 #include "../include/v8-debug.h" |
| 10 #include "../include/v8-profiler.h" | 10 #include "../include/v8-profiler.h" |
| (...skipping 6786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6797 i::Handle<i::Object> foreign = isolate->factory()->undefined_value(); | 6797 i::Handle<i::Object> foreign = isolate->factory()->undefined_value(); |
| 6798 if (that != NULL) { | 6798 if (that != NULL) { |
| 6799 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that)); | 6799 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that)); |
| 6800 } | 6800 } |
| 6801 isolate->debugger()->SetEventListener(foreign, | 6801 isolate->debugger()->SetEventListener(foreign, |
| 6802 Utils::OpenHandle(*data, true)); | 6802 Utils::OpenHandle(*data, true)); |
| 6803 return true; | 6803 return true; |
| 6804 } | 6804 } |
| 6805 | 6805 |
| 6806 | 6806 |
| 6807 bool Debug::SetDebugEventListener(v8::Handle<v8::Object> that, | |
| 6808 Handle<Value> data) { | |
| 6809 i::Isolate* isolate = i::Isolate::Current(); | |
| 6810 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false); | |
| 6811 ENTER_V8(isolate); | |
| 6812 isolate->debugger()->SetEventListener(Utils::OpenHandle(*that), | |
| 6813 Utils::OpenHandle(*data, true)); | |
| 6814 return true; | |
| 6815 } | |
| 6816 | |
| 6817 | |
| 6818 void Debug::DebugBreak(Isolate* isolate) { | 6807 void Debug::DebugBreak(Isolate* isolate) { |
| 6819 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->DebugBreak(); | 6808 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->DebugBreak(); |
| 6820 } | 6809 } |
| 6821 | 6810 |
| 6822 | 6811 |
| 6823 void Debug::CancelDebugBreak(Isolate* isolate) { | 6812 void Debug::CancelDebugBreak(Isolate* isolate) { |
| 6824 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6813 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6825 internal_isolate->stack_guard()->Continue(i::DEBUGBREAK); | 6814 internal_isolate->stack_guard()->Continue(i::DEBUGBREAK); |
| 6826 } | 6815 } |
| 6827 | 6816 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6843 void Debug::SendCommand(Isolate* isolate, | 6832 void Debug::SendCommand(Isolate* isolate, |
| 6844 const uint16_t* command, | 6833 const uint16_t* command, |
| 6845 int length, | 6834 int length, |
| 6846 ClientData* client_data) { | 6835 ClientData* client_data) { |
| 6847 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6836 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6848 internal_isolate->debugger()->ProcessCommand( | 6837 internal_isolate->debugger()->ProcessCommand( |
| 6849 i::Vector<const uint16_t>(command, length), client_data); | 6838 i::Vector<const uint16_t>(command, length), client_data); |
| 6850 } | 6839 } |
| 6851 | 6840 |
| 6852 | 6841 |
| 6853 void Debug::SetHostDispatchHandler(HostDispatchHandler handler, | |
| 6854 int period) { | |
| 6855 i::Isolate* isolate = i::Isolate::Current(); | |
| 6856 EnsureInitializedForIsolate(isolate, "v8::Debug::SetHostDispatchHandler"); | |
| 6857 ENTER_V8(isolate); | |
| 6858 isolate->debugger()->SetHostDispatchHandler( | |
| 6859 handler, i::TimeDelta::FromMilliseconds(period)); | |
| 6860 } | |
| 6861 | |
| 6862 | |
| 6863 void Debug::SetDebugMessageDispatchHandler( | 6842 void Debug::SetDebugMessageDispatchHandler( |
| 6864 DebugMessageDispatchHandler handler, bool provide_locker) { | 6843 DebugMessageDispatchHandler handler, bool provide_locker) { |
| 6865 i::Isolate* isolate = i::Isolate::Current(); | 6844 i::Isolate* isolate = i::Isolate::Current(); |
| 6866 EnsureInitializedForIsolate(isolate, | 6845 EnsureInitializedForIsolate(isolate, |
| 6867 "v8::Debug::SetDebugMessageDispatchHandler"); | 6846 "v8::Debug::SetDebugMessageDispatchHandler"); |
| 6868 ENTER_V8(isolate); | 6847 ENTER_V8(isolate); |
| 6869 isolate->debugger()->SetDebugMessageDispatchHandler( | 6848 isolate->debugger()->SetDebugMessageDispatchHandler( |
| 6870 handler, provide_locker); | 6849 handler, provide_locker); |
| 6871 } | 6850 } |
| 6872 | 6851 |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7594 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7573 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7595 Address callback_address = | 7574 Address callback_address = |
| 7596 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7575 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7597 VMState<EXTERNAL> state(isolate); | 7576 VMState<EXTERNAL> state(isolate); |
| 7598 ExternalCallbackScope call_scope(isolate, callback_address); | 7577 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7599 callback(info); | 7578 callback(info); |
| 7600 } | 7579 } |
| 7601 | 7580 |
| 7602 | 7581 |
| 7603 } } // namespace v8::internal | 7582 } } // namespace v8::internal |
| OLD | NEW |