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

Side by Side Diff: src/api.cc

Issue 301633005: Merge Debugger and Debug. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 6795 matching lines...) Expand 10 before | Expand all | Expand 10 after
6806 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) { 6806 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) {
6807 i::Isolate* isolate = i::Isolate::Current(); 6807 i::Isolate* isolate = i::Isolate::Current();
6808 EnsureInitializedForIsolate(isolate, "v8::Debug::SetDebugEventListener()"); 6808 EnsureInitializedForIsolate(isolate, "v8::Debug::SetDebugEventListener()");
6809 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false); 6809 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false);
6810 ENTER_V8(isolate); 6810 ENTER_V8(isolate);
6811 i::HandleScope scope(isolate); 6811 i::HandleScope scope(isolate);
6812 i::Handle<i::Object> foreign = isolate->factory()->undefined_value(); 6812 i::Handle<i::Object> foreign = isolate->factory()->undefined_value();
6813 if (that != NULL) { 6813 if (that != NULL) {
6814 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that)); 6814 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that));
6815 } 6815 }
6816 isolate->debugger()->SetEventListener(foreign, 6816 isolate->debug()->SetEventListener(foreign,
6817 Utils::OpenHandle(*data, true)); 6817 Utils::OpenHandle(*data, true));
6818 return true; 6818 return true;
6819 } 6819 }
6820 6820
6821 6821
6822 void Debug::DebugBreak(Isolate* isolate) { 6822 void Debug::DebugBreak(Isolate* isolate) {
6823 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak(); 6823 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak();
6824 } 6824 }
6825 6825
6826 6826
6827 void Debug::CancelDebugBreak(Isolate* isolate) { 6827 void Debug::CancelDebugBreak(Isolate* isolate) {
6828 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 6828 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
6829 internal_isolate->stack_guard()->ClearDebugBreak(); 6829 internal_isolate->stack_guard()->ClearDebugBreak();
6830 } 6830 }
6831 6831
6832 6832
6833 void Debug::DebugBreakForCommand(Isolate* isolate, ClientData* data) { 6833 void Debug::DebugBreakForCommand(Isolate* isolate, ClientData* data) {
6834 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 6834 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
6835 internal_isolate->debugger()->EnqueueDebugCommand(data); 6835 internal_isolate->debug()->EnqueueDebugCommand(data);
6836 } 6836 }
6837 6837
6838 6838
6839 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) { 6839 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) {
6840 i::Isolate* isolate = i::Isolate::Current(); 6840 i::Isolate* isolate = i::Isolate::Current();
6841 EnsureInitializedForIsolate(isolate, "v8::Debug::SetMessageHandler"); 6841 EnsureInitializedForIsolate(isolate, "v8::Debug::SetMessageHandler");
6842 ENTER_V8(isolate); 6842 ENTER_V8(isolate);
6843 isolate->debugger()->SetMessageHandler(handler); 6843 isolate->debug()->SetMessageHandler(handler);
6844 } 6844 }
6845 6845
6846 6846
6847 void Debug::SendCommand(Isolate* isolate, 6847 void Debug::SendCommand(Isolate* isolate,
6848 const uint16_t* command, 6848 const uint16_t* command,
6849 int length, 6849 int length,
6850 ClientData* client_data) { 6850 ClientData* client_data) {
6851 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 6851 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
6852 internal_isolate->debugger()->EnqueueCommandMessage( 6852 internal_isolate->debug()->EnqueueCommandMessage(
6853 i::Vector<const uint16_t>(command, length), client_data); 6853 i::Vector<const uint16_t>(command, length), client_data);
6854 } 6854 }
6855 6855
6856 6856
6857 Local<Value> Debug::Call(v8::Handle<v8::Function> fun, 6857 Local<Value> Debug::Call(v8::Handle<v8::Function> fun,
6858 v8::Handle<v8::Value> data) { 6858 v8::Handle<v8::Value> data) {
6859 i::Isolate* isolate = i::Isolate::Current(); 6859 i::Isolate* isolate = i::Isolate::Current();
6860 if (!isolate->IsInitialized()) return Local<Value>(); 6860 if (!isolate->IsInitialized()) return Local<Value>();
6861 ON_BAILOUT(isolate, "v8::Debug::Call()", return Local<Value>()); 6861 ON_BAILOUT(isolate, "v8::Debug::Call()", return Local<Value>());
6862 ENTER_V8(isolate); 6862 ENTER_V8(isolate);
6863 i::MaybeHandle<i::Object> maybe_result; 6863 i::MaybeHandle<i::Object> maybe_result;
6864 EXCEPTION_PREAMBLE(isolate); 6864 EXCEPTION_PREAMBLE(isolate);
6865 if (data.IsEmpty()) { 6865 if (data.IsEmpty()) {
6866 maybe_result = isolate->debugger()->Call( 6866 maybe_result = isolate->debug()->Call(
6867 Utils::OpenHandle(*fun), isolate->factory()->undefined_value()); 6867 Utils::OpenHandle(*fun), isolate->factory()->undefined_value());
6868 } else { 6868 } else {
6869 maybe_result = isolate->debugger()->Call( 6869 maybe_result = isolate->debug()->Call(
6870 Utils::OpenHandle(*fun), Utils::OpenHandle(*data)); 6870 Utils::OpenHandle(*fun), Utils::OpenHandle(*data));
6871 } 6871 }
6872 i::Handle<i::Object> result; 6872 i::Handle<i::Object> result;
6873 has_pending_exception = !maybe_result.ToHandle(&result); 6873 has_pending_exception = !maybe_result.ToHandle(&result);
6874 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); 6874 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
6875 return Utils::ToLocal(result); 6875 return Utils::ToLocal(result);
6876 } 6876 }
6877 6877
6878 6878
6879 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) { 6879 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
(...skipping 27 matching lines...) Expand all
6907 6907
6908 void Debug::ProcessDebugMessages() { 6908 void Debug::ProcessDebugMessages() {
6909 i::Execution::ProcessDebugMessages(i::Isolate::Current(), true); 6909 i::Execution::ProcessDebugMessages(i::Isolate::Current(), true);
6910 } 6910 }
6911 6911
6912 6912
6913 Local<Context> Debug::GetDebugContext() { 6913 Local<Context> Debug::GetDebugContext() {
6914 i::Isolate* isolate = i::Isolate::Current(); 6914 i::Isolate* isolate = i::Isolate::Current();
6915 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()"); 6915 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()");
6916 ENTER_V8(isolate); 6916 ENTER_V8(isolate);
6917 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext()); 6917 return Utils::ToLocal(i::Isolate::Current()->debug()->GetDebugContext());
6918 } 6918 }
6919 6919
6920 6920
6921 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { 6921 void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) {
6922 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 6922 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
6923 internal_isolate->debugger()->set_live_edit_enabled(enable); 6923 internal_isolate->debug()->set_live_edit_enabled(enable);
6924 } 6924 }
6925 6925
6926 6926
6927 Handle<String> CpuProfileNode::GetFunctionName() const { 6927 Handle<String> CpuProfileNode::GetFunctionName() const {
6928 i::Isolate* isolate = i::Isolate::Current(); 6928 i::Isolate* isolate = i::Isolate::Current();
6929 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 6929 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
6930 const i::CodeEntry* entry = node->entry(); 6930 const i::CodeEntry* entry = node->entry();
6931 i::Handle<i::String> name = 6931 i::Handle<i::String> name =
6932 isolate->factory()->InternalizeUtf8String(entry->name()); 6932 isolate->factory()->InternalizeUtf8String(entry->name());
6933 if (!entry->has_name_prefix()) { 6933 if (!entry->has_name_prefix()) {
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
7566 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7566 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7567 Address callback_address = 7567 Address callback_address =
7568 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7568 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7569 VMState<EXTERNAL> state(isolate); 7569 VMState<EXTERNAL> state(isolate);
7570 ExternalCallbackScope call_scope(isolate, callback_address); 7570 ExternalCallbackScope call_scope(isolate, callback_address);
7571 callback(info); 7571 callback(info);
7572 } 7572 }
7573 7573
7574 7574
7575 } } // namespace v8::internal 7575 } } // 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