Lines Matching refs:v8
1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
28 #include "v8.h"
48 #include "../include/v8-debug.h"
50 namespace v8 {
74 static void PrintLn(v8::Local<v8::Value> value) {
75 v8::Local<v8::String> s = value->ToString();
78 V8::FatalProcessOutOfMemory("PrintLn");
104 static v8::Handle<v8::Context> GetDebugEventContext(Isolate* isolate) {
108 if (context.is_null()) return v8::Local<v8::Context>();
110 return v8::Utils::ToLocal(global_context);
696 void ScriptCache::HandleWeakScript(v8::Persistent<v8::Value> obj, void* data) {
729 void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data) {
847 v8::Handle<ObjectTemplate>(),
2142 if (!Debugger::EventActive(v8::Exception)) return;
2174 ProcessDebugEvent(v8::Exception, Handle<JSObject>::cast(event_data), false);
2188 if (!Debugger::EventActive(v8::Break)) return;
2207 ProcessDebugEvent(v8::Break,
2220 if (!EventActive(v8::BeforeCompile)) return;
2235 ProcessDebugEvent(v8::BeforeCompile,
2295 if (!Debugger::EventActive(v8::AfterCompile)) return;
2306 ProcessDebugEvent(v8::AfterCompile,
2318 if (!Debugger::EventActive(v8::ScriptCollected)) return;
2334 ProcessDebugEvent(v8::ScriptCollected,
2340 void Debugger::ProcessDebugEvent(v8::DebugEvent event,
2365 // a JavaScript function. Don't call event listener for v8::Break
2367 if ((event != v8::Break || !auto_continue) && !event_listener_.is_null()) {
2371 if (event == v8::Break) {
2375 CallEventCallback(v8::BreakForCommand,
2386 void Debugger::CallEventCallback(v8::DebugEvent event,
2389 v8::Debug::ClientData* client_data) {
2398 void Debugger::CallCEventCallback(v8::DebugEvent event,
2401 v8::Debug::ClientData* client_data) {
2403 v8::Debug::EventCallback2 callback =
2404 FUNCTION_CAST<v8::Debug::EventCallback2>(callback_obj->proxy());
2415 void Debugger::CallJSEventCallback(v8::DebugEvent event,
2459 void Debugger::NotifyMessageHandler(v8::DebugEvent event,
2471 case v8::Break:
2472 case v8::BreakForCommand:
2475 case v8::Exception:
2478 case v8::BeforeCompile:
2480 case v8::AfterCompile:
2483 case v8::ScriptCollected:
2486 case v8::NewFunction:
2513 if ((auto_continue && !HasCommands()) || event == v8::ScriptCollected) {
2517 v8::TryCatch try_catch;
2520 v8::Local<v8::Object> cmd_processor;
2522 v8::Local<v8::Object> api_exec_state =
2523 v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state));
2524 v8::Local<v8::String> fun_name =
2525 v8::String::New("debugCommandProcessor");
2526 v8::Local<v8::Function> fun =
2527 v8::Function::Cast(*api_exec_state->Get(fun_name));
2529 v8::Handle<v8::Boolean> running =
2530 auto_continue ? v8::True() : v8::False();
2532 v8::Handle<Value> argv[kArgc] = { running };
2533 cmd_processor = v8::Object::Cast(*fun->Call(api_exec_state, kArgc, argv));
2567 v8::Local<v8::String> fun_name;
2568 v8::Local<v8::Function> fun;
2569 v8::Local<v8::Value> request;
2570 v8::TryCatch try_catch;
2571 fun_name = v8::String::New("processDebugRequest");
2572 fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
2574 request = v8::String::New(command.text().start(),
2577 v8::Handle<Value> argv[kArgc] = { request };
2578 v8::Local<v8::Value> response_val = fun->Call(cmd_processor, kArgc, argv);
2581 v8::Local<v8::String> response;
2585 response = v8::String::Cast(*response_val);
2587 response = v8::String::New("");
2597 fun_name = v8::String::New("isRunning");
2598 fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
2600 v8::Handle<Value> argv[kArgc] = { response };
2601 v8::Local<v8::Value> running_val = fun->Call(cmd_processor, kArgc, argv);
2666 void Debugger::SetMessageHandler(v8::Debug::MessageHandler2 handler) {
2691 // Schedule this for later, because we may be in non-V8 thread.
2697 void Debugger::SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler,
2706 v8::Debug::DebugMessageDispatchHandler handler, bool provide_locker) {
2735 v8::Debug::ClientData* client_data) {
2771 void Debugger::EnqueueDebugCommand(v8::Debug::ClientData* client_data) {
2823 static void StubMessageHandler2(const v8::Debug::Message& message) {
2832 // Suspend V8 if it is already running or set V8 to suspend whenever
2834 // Provide stub message handler; V8 auto-continues each suspend
2836 // Once become suspended, V8 will stay so indefinitely long, until remote
2839 v8::Debug::DebugBreak();
2874 v8::Debug::DebugMessageDispatchHandler handler;
2900 v8::Debug::ClientData* client_data) {
2913 v8::Debug::ClientData* client_data)
2943 v8::Handle<v8::Object> MessageImpl::GetExecutionState() const {
2944 return v8::Utils::ToLocal(exec_state_);
2948 v8::Handle<v8::Object> MessageImpl::GetEventData() const {
2949 return v8::Utils::ToLocal(event_data_);
2953 v8::Handle<v8::String> MessageImpl::GetJSON() const {
2954 v8::HandleScope scope;
2960 return v8::Handle<v8::String>();
2967 return v8::Handle<v8::String>();
2969 return scope.Close(v8::Utils::ToLocal(Handle<String>::cast(json)));
2971 return v8::Utils::ToLocal(response_json_);
2976 v8::Handle<v8::Context> MessageImpl::GetEventContext() const {
2978 v8::Handle<v8::Context> context = GetDebugEventContext(isolate);
2980 ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected);
2985 v8::Debug::ClientData* MessageImpl::GetClientData() const {
2994 v8::Debug::ClientData* client_data)
3007 v8::Handle<v8::Object> EventDetailsImpl::GetExecutionState() const {
3008 return v8::Utils::ToLocal(exec_state_);
3012 v8::Handle<v8::Object> EventDetailsImpl::GetEventData() const {
3013 return v8::Utils::ToLocal(event_data_);
3017 v8::Handle<v8::Context> EventDetailsImpl::GetEventContext() const {
3022 v8::Handle<v8::Value> EventDetailsImpl::GetCallbackData() const {
3023 return v8::Utils::ToLocal(callback_data_);
3027 v8::Debug::ClientData* EventDetailsImpl::GetClientData() const {
3038 v8::Debug::ClientData* data)
3056 v8::Debug::ClientData* data) {
3146 : Thread(isolate, "v8:MsgDispHelpr"),
3186 } } // namespace v8::internal