Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: src/api.cc

Issue 298863011: Merge the classes Debug and Debugger. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename EnterDebugger Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/assembler-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 6794 matching lines...) Expand 10 before | Expand all | Expand 10 after
6805 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) { 6805 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) {
6806 i::Isolate* isolate = i::Isolate::Current(); 6806 i::Isolate* isolate = i::Isolate::Current();
6807 EnsureInitializedForIsolate(isolate, "v8::Debug::SetDebugEventListener()"); 6807 EnsureInitializedForIsolate(isolate, "v8::Debug::SetDebugEventListener()");
6808 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false); 6808 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false);
6809 ENTER_V8(isolate); 6809 ENTER_V8(isolate);
6810 i::HandleScope scope(isolate); 6810 i::HandleScope scope(isolate);
6811 i::Handle<i::Object> foreign = isolate->factory()->undefined_value(); 6811 i::Handle<i::Object> foreign = isolate->factory()->undefined_value();
6812 if (that != NULL) { 6812 if (that != NULL) {
6813 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that)); 6813 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that));
6814 } 6814 }
6815 isolate->debugger()->SetEventListener(foreign, 6815 isolate->debug()->SetEventListener(foreign,
6816 Utils::OpenHandle(*data, true)); 6816 Utils::OpenHandle(*data, true));
6817 return true; 6817 return true;
6818 } 6818 }
6819 6819
6820 6820
6821 void Debug::DebugBreak(Isolate* isolate) { 6821 void Debug::DebugBreak(Isolate* isolate) {
6822 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak(); 6822 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak();
6823 } 6823 }
6824 6824
6825 6825
6826 void Debug::CancelDebugBreak(Isolate* isolate) { 6826 void Debug::CancelDebugBreak(Isolate* isolate) {
6827 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 6827 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
6828 internal_isolate->stack_guard()->ClearDebugBreak(); 6828 internal_isolate->stack_guard()->ClearDebugBreak();
6829 } 6829 }
6830 6830
6831 6831
6832 void Debug::DebugBreakForCommand(Isolate* isolate, ClientData* data) { 6832 void Debug::DebugBreakForCommand(Isolate* isolate, ClientData* data) {
6833 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 6833 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
6834 internal_isolate->debugger()->EnqueueDebugCommand(data); 6834 internal_isolate->debug()->EnqueueDebugCommand(data);
6835 } 6835 }
6836 6836
6837 6837
6838 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) { 6838 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) {
6839 i::Isolate* isolate = i::Isolate::Current(); 6839 i::Isolate* isolate = i::Isolate::Current();
6840 EnsureInitializedForIsolate(isolate, "v8::Debug::SetMessageHandler"); 6840 EnsureInitializedForIsolate(isolate, "v8::Debug::SetMessageHandler");
6841 ENTER_V8(isolate); 6841 ENTER_V8(isolate);
6842 isolate->debugger()->SetMessageHandler(handler); 6842 isolate->debug()->SetMessageHandler(handler);
6843 } 6843 }
6844 6844
6845 6845
6846 void Debug::SendCommand(Isolate* isolate, 6846 void Debug::SendCommand(Isolate* isolate,
6847 const uint16_t* command, 6847 const uint16_t* command,
6848 int length, 6848 int length,
6849 ClientData* client_data) { 6849 ClientData* client_data) {
6850 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 6850 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
6851 internal_isolate->debugger()->EnqueueCommandMessage( 6851 internal_isolate->debug()->EnqueueCommandMessage(
6852 i::Vector<const uint16_t>(command, length), client_data); 6852 i::Vector<const uint16_t>(command, length), client_data);
6853 } 6853 }
6854 6854
6855 6855
6856 Local<Value> Debug::Call(v8::Handle<v8::Function> fun, 6856 Local<Value> Debug::Call(v8::Handle<v8::Function> fun,
6857 v8::Handle<v8::Value> data) { 6857 v8::Handle<v8::Value> data) {
6858 i::Isolate* isolate = i::Isolate::Current(); 6858 i::Isolate* isolate = i::Isolate::Current();
6859 if (!isolate->IsInitialized()) return Local<Value>(); 6859 if (!isolate->IsInitialized()) return Local<Value>();
6860 ON_BAILOUT(isolate, "v8::Debug::Call()", return Local<Value>()); 6860 ON_BAILOUT(isolate, "v8::Debug::Call()", return Local<Value>());
6861 ENTER_V8(isolate); 6861 ENTER_V8(isolate);
6862 i::MaybeHandle<i::Object> maybe_result; 6862 i::MaybeHandle<i::Object> maybe_result;
6863 EXCEPTION_PREAMBLE(isolate); 6863 EXCEPTION_PREAMBLE(isolate);
6864 if (data.IsEmpty()) { 6864 if (data.IsEmpty()) {
6865 maybe_result = isolate->debugger()->Call( 6865 maybe_result = isolate->debug()->Call(
6866 Utils::OpenHandle(*fun), isolate->factory()->undefined_value()); 6866 Utils::OpenHandle(*fun), isolate->factory()->undefined_value());
6867 } else { 6867 } else {
6868 maybe_result = isolate->debugger()->Call( 6868 maybe_result = isolate->debug()->Call(
6869 Utils::OpenHandle(*fun), Utils::OpenHandle(*data)); 6869 Utils::OpenHandle(*fun), Utils::OpenHandle(*data));
6870 } 6870 }
6871 i::Handle<i::Object> result; 6871 i::Handle<i::Object> result;
6872 has_pending_exception = !maybe_result.ToHandle(&result); 6872 has_pending_exception = !maybe_result.ToHandle(&result);
6873 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); 6873 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
6874 return Utils::ToLocal(result); 6874 return Utils::ToLocal(result);
6875 } 6875 }
6876 6876
6877 6877
6878 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) { 6878 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
(...skipping 19 matching lines...) Expand all
6898 v8::Handle<v8::Value> argv[kArgc] = { obj }; 6898 v8::Handle<v8::Value> argv[kArgc] = { obj };
6899 result = v8_fun->Call(Utils::ToLocal(debug), kArgc, argv); 6899 result = v8_fun->Call(Utils::ToLocal(debug), kArgc, argv);
6900 has_pending_exception = result.IsEmpty(); 6900 has_pending_exception = result.IsEmpty();
6901 } 6901 }
6902 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); 6902 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
6903 return scope.Escape(result); 6903 return scope.Escape(result);
6904 } 6904 }
6905 6905
6906 6906
6907 void Debug::ProcessDebugMessages() { 6907 void Debug::ProcessDebugMessages() {
6908 i::Execution::ProcessDebugMessages(i::Isolate::Current(), true); 6908 i::Isolate::Current()->debug()->ProcessDebugMessages(true);
6909 } 6909 }
6910 6910
6911 6911
6912 Local<Context> Debug::GetDebugContext() { 6912 Local<Context> Debug::GetDebugContext() {
6913 i::Isolate* isolate = i::Isolate::Current(); 6913 i::Isolate* isolate = i::Isolate::Current();
6914 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()"); 6914 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()");
6915 ENTER_V8(isolate); 6915 ENTER_V8(isolate);
6916 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext()); 6916 return Utils::ToLocal(i::Isolate::Current()->debug()->GetDebugContext());
6917 } 6917 }
6918 6918
6919 6919
6920 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { 6920 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) {
6921 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 6921 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
6922 internal_isolate->debugger()->set_live_edit_enabled(enable); 6922 internal_isolate->debug()->set_live_edit_enabled(enable);
6923 } 6923 }
6924 6924
6925 6925
6926 Handle<String> CpuProfileNode::GetFunctionName() const { 6926 Handle<String> CpuProfileNode::GetFunctionName() const {
6927 i::Isolate* isolate = i::Isolate::Current(); 6927 i::Isolate* isolate = i::Isolate::Current();
6928 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 6928 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
6929 const i::CodeEntry* entry = node->entry(); 6929 const i::CodeEntry* entry = node->entry();
6930 i::Handle<i::String> name = 6930 i::Handle<i::String> name =
6931 isolate->factory()->InternalizeUtf8String(entry->name()); 6931 isolate->factory()->InternalizeUtf8String(entry->name());
6932 if (!entry->has_name_prefix()) { 6932 if (!entry->has_name_prefix()) {
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
7565 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7565 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7566 Address callback_address = 7566 Address callback_address =
7567 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7567 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7568 VMState<EXTERNAL> state(isolate); 7568 VMState<EXTERNAL> state(isolate);
7569 ExternalCallbackScope call_scope(isolate, callback_address); 7569 ExternalCallbackScope call_scope(isolate, callback_address);
7570 callback(info); 7570 callback(info);
7571 } 7571 }
7572 7572
7573 7573
7574 } } // namespace v8::internal 7574 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698