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 6760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6771 i::Handle<i::Object> result = isolate->factory()->NewError(message); | 6771 i::Handle<i::Object> result = isolate->factory()->NewError(message); |
6772 error = *result; | 6772 error = *result; |
6773 } | 6773 } |
6774 i::Handle<i::Object> result(error, isolate); | 6774 i::Handle<i::Object> result(error, isolate); |
6775 return Utils::ToLocal(result); | 6775 return Utils::ToLocal(result); |
6776 } | 6776 } |
6777 | 6777 |
6778 | 6778 |
6779 // --- D e b u g S u p p o r t --- | 6779 // --- D e b u g S u p p o r t --- |
6780 | 6780 |
6781 bool Debug::SetDebugEventListener2(EventCallback2 that, Handle<Value> data) { | 6781 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) { |
6782 i::Isolate* isolate = i::Isolate::Current(); | 6782 i::Isolate* isolate = i::Isolate::Current(); |
6783 EnsureInitializedForIsolate(isolate, "v8::Debug::SetDebugEventListener2()"); | 6783 EnsureInitializedForIsolate(isolate, "v8::Debug::SetDebugEventListener()"); |
6784 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener2()", return false); | 6784 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false); |
6785 ENTER_V8(isolate); | 6785 ENTER_V8(isolate); |
6786 i::HandleScope scope(isolate); | 6786 i::HandleScope scope(isolate); |
6787 i::Handle<i::Object> foreign = isolate->factory()->undefined_value(); | 6787 i::Handle<i::Object> foreign = isolate->factory()->undefined_value(); |
6788 if (that != NULL) { | 6788 if (that != NULL) { |
6789 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that)); | 6789 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that)); |
6790 } | 6790 } |
6791 isolate->debugger()->SetEventListener(foreign, | 6791 isolate->debugger()->SetEventListener(foreign, |
6792 Utils::OpenHandle(*data, true)); | 6792 Utils::OpenHandle(*data, true)); |
6793 return true; | 6793 return true; |
6794 } | 6794 } |
6795 | 6795 |
6796 | 6796 |
6797 void Debug::DebugBreak(Isolate* isolate) { | 6797 void Debug::DebugBreak(Isolate* isolate) { |
6798 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak(); | 6798 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak(); |
6799 } | 6799 } |
6800 | 6800 |
6801 | 6801 |
6802 void Debug::CancelDebugBreak(Isolate* isolate) { | 6802 void Debug::CancelDebugBreak(Isolate* isolate) { |
6803 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6803 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6804 internal_isolate->stack_guard()->ClearDebugBreak(); | 6804 internal_isolate->stack_guard()->ClearDebugBreak(); |
6805 } | 6805 } |
6806 | 6806 |
6807 | 6807 |
6808 void Debug::DebugBreakForCommand(Isolate* isolate, ClientData* data) { | 6808 void Debug::DebugBreakForCommand(Isolate* isolate, ClientData* data) { |
6809 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6809 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6810 internal_isolate->debugger()->EnqueueDebugCommand(data); | 6810 internal_isolate->debugger()->EnqueueDebugCommand(data); |
6811 } | 6811 } |
6812 | 6812 |
6813 | 6813 |
6814 void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) { | 6814 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) { |
6815 i::Isolate* isolate = i::Isolate::Current(); | 6815 i::Isolate* isolate = i::Isolate::Current(); |
6816 EnsureInitializedForIsolate(isolate, "v8::Debug::SetMessageHandler"); | 6816 EnsureInitializedForIsolate(isolate, "v8::Debug::SetMessageHandler"); |
6817 ENTER_V8(isolate); | 6817 ENTER_V8(isolate); |
6818 isolate->debugger()->SetMessageHandler(handler); | 6818 isolate->debugger()->SetMessageHandler(handler); |
6819 } | 6819 } |
6820 | 6820 |
6821 | 6821 |
6822 void Debug::SendCommand(Isolate* isolate, | 6822 void Debug::SendCommand(Isolate* isolate, |
6823 const uint16_t* command, | 6823 const uint16_t* command, |
6824 int length, | 6824 int length, |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7563 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7563 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7564 Address callback_address = | 7564 Address callback_address = |
7565 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7565 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7566 VMState<EXTERNAL> state(isolate); | 7566 VMState<EXTERNAL> state(isolate); |
7567 ExternalCallbackScope call_scope(isolate, callback_address); | 7567 ExternalCallbackScope call_scope(isolate, callback_address); |
7568 callback(info); | 7568 callback(info); |
7569 } | 7569 } |
7570 | 7570 |
7571 | 7571 |
7572 } } // namespace v8::internal | 7572 } } // namespace v8::internal |
OLD | NEW |