OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3588 | 3588 |
3589 | 3589 |
3590 void Debug::SetHostDispatchHandler(HostDispatchHandler handler, | 3590 void Debug::SetHostDispatchHandler(HostDispatchHandler handler, |
3591 int period) { | 3591 int period) { |
3592 EnsureInitialized("v8::Debug::SetHostDispatchHandler"); | 3592 EnsureInitialized("v8::Debug::SetHostDispatchHandler"); |
3593 ENTER_V8; | 3593 ENTER_V8; |
3594 i::Debugger::SetHostDispatchHandler(handler, period); | 3594 i::Debugger::SetHostDispatchHandler(handler, period); |
3595 } | 3595 } |
3596 | 3596 |
3597 | 3597 |
3598 Handle<Value> Debug::Call(v8::Handle<v8::Function> fun, | 3598 Local<Value> Debug::Call(v8::Handle<v8::Function> fun, |
3599 v8::Handle<v8::Value> data) { | 3599 v8::Handle<v8::Value> data) { |
3600 if (!i::V8::IsRunning()) return Handle<Value>(); | 3600 if (!i::V8::IsRunning()) return Local<Value>(); |
3601 ON_BAILOUT("v8::Debug::Call()", return Handle<Value>()); | 3601 ON_BAILOUT("v8::Debug::Call()", return Local<Value>()); |
3602 ENTER_V8; | 3602 ENTER_V8; |
3603 i::Handle<i::Object> result; | 3603 i::Handle<i::Object> result; |
3604 EXCEPTION_PREAMBLE(); | 3604 EXCEPTION_PREAMBLE(); |
3605 if (data.IsEmpty()) { | 3605 if (data.IsEmpty()) { |
3606 result = i::Debugger::Call(Utils::OpenHandle(*fun), | 3606 result = i::Debugger::Call(Utils::OpenHandle(*fun), |
3607 i::Factory::undefined_value(), | 3607 i::Factory::undefined_value(), |
3608 &has_pending_exception); | 3608 &has_pending_exception); |
3609 } else { | 3609 } else { |
3610 result = i::Debugger::Call(Utils::OpenHandle(*fun), | 3610 result = i::Debugger::Call(Utils::OpenHandle(*fun), |
3611 Utils::OpenHandle(*data), | 3611 Utils::OpenHandle(*data), |
3612 &has_pending_exception); | 3612 &has_pending_exception); |
3613 } | 3613 } |
3614 EXCEPTION_BAILOUT_CHECK(Local<Value>()); | 3614 EXCEPTION_BAILOUT_CHECK(Local<Value>()); |
3615 return Utils::ToLocal(result); | 3615 return Utils::ToLocal(result); |
3616 } | 3616 } |
3617 | 3617 |
3618 | 3618 |
| 3619 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) { |
| 3620 if (!i::V8::IsRunning()) return Local<Value>(); |
| 3621 ON_BAILOUT("v8::Debug::GetMirror()", return Local<Value>()); |
| 3622 ENTER_V8; |
| 3623 v8::HandleScope scope; |
| 3624 i::Debug::Load(); |
| 3625 i::Handle<i::JSObject> debug(i::Debug::debug_context()->global()); |
| 3626 i::Handle<i::String> name = i::Factory::LookupAsciiSymbol("MakeMirror"); |
| 3627 i::Handle<i::Object> fun_obj = i::GetProperty(debug, name); |
| 3628 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj); |
| 3629 v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun); |
| 3630 const int kArgc = 1; |
| 3631 v8::Handle<v8::Value> argv[kArgc] = { obj }; |
| 3632 EXCEPTION_PREAMBLE(); |
| 3633 v8::Handle<v8::Value> result = v8_fun->Call(Utils::ToLocal(debug), |
| 3634 kArgc, |
| 3635 argv); |
| 3636 EXCEPTION_BAILOUT_CHECK(Local<Value>()); |
| 3637 return scope.Close(result); |
| 3638 } |
| 3639 |
| 3640 |
3619 bool Debug::EnableAgent(const char* name, int port) { | 3641 bool Debug::EnableAgent(const char* name, int port) { |
3620 return i::Debugger::StartAgent(name, port); | 3642 return i::Debugger::StartAgent(name, port); |
3621 } | 3643 } |
3622 #endif // ENABLE_DEBUGGER_SUPPORT | 3644 #endif // ENABLE_DEBUGGER_SUPPORT |
3623 | 3645 |
3624 namespace internal { | 3646 namespace internal { |
3625 | 3647 |
3626 | 3648 |
3627 HandleScopeImplementer* HandleScopeImplementer::instance() { | 3649 HandleScopeImplementer* HandleScopeImplementer::instance() { |
3628 return &thread_local; | 3650 return &thread_local; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3695 reinterpret_cast<HandleScopeImplementer*>(storage); | 3717 reinterpret_cast<HandleScopeImplementer*>(storage); |
3696 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 3718 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
3697 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 3719 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
3698 &thread_local->handle_scope_data_; | 3720 &thread_local->handle_scope_data_; |
3699 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 3721 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
3700 | 3722 |
3701 return storage + ArchiveSpacePerThread(); | 3723 return storage + ArchiveSpacePerThread(); |
3702 } | 3724 } |
3703 | 3725 |
3704 } } // namespace v8::internal | 3726 } } // namespace v8::internal |
OLD | NEW |