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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #ifdef ENABLE_HEAP_PROTECTION | 47 #ifdef ENABLE_HEAP_PROTECTION |
48 #define ENTER_V8 i::VMState __state__(i::OTHER) | 48 #define ENTER_V8 i::VMState __state__(i::OTHER) |
49 #define LEAVE_V8 i::VMState __state__(i::EXTERNAL) | 49 #define LEAVE_V8 i::VMState __state__(i::EXTERNAL) |
50 #else | 50 #else |
51 #define ENTER_V8 ((void) 0) | 51 #define ENTER_V8 ((void) 0) |
52 #define LEAVE_V8 ((void) 0) | 52 #define LEAVE_V8 ((void) 0) |
53 #endif | 53 #endif |
54 | 54 |
55 namespace v8 { | 55 namespace v8 { |
56 | 56 |
| 57 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 58 |
| 59 void Debug::ProcessDebuggerCommands() { |
| 60 HandleScope scope; |
| 61 |
| 62 v8::internal::EnterDebugger debugger; |
| 63 |
| 64 bool caught_exception; |
| 65 v8::internal::Handle<v8::internal::Object> exec_state = v8::internal::Debugger
::MakeExecutionState(&caught_exception); |
| 66 |
| 67 // Replace v8::NewFunction with something. |
| 68 i::Handle<i::Object> undef = i::Factory::undefined_value(); |
| 69 i::Handle<i::JSObject> event_data = i::Handle<i::JSObject>::cast(i::Debugger::
MakeNewFunctionEvent(reinterpret_cast<i::Handle<i::Object>&>(undef), &caught_exc
eption)); |
| 70 v8::internal::Debugger::NotifyMessageHandler(v8::NewFunction, |
| 71 v8::internal::Handle<v8::internal::JSObject>::c
ast(exec_state), |
| 72 event_data, true); |
| 73 } |
| 74 |
| 75 #endif |
| 76 |
| 77 |
| 78 |
57 | 79 |
58 #define ON_BAILOUT(location, code) \ | 80 #define ON_BAILOUT(location, code) \ |
59 if (IsDeadCheck(location)) { \ | 81 if (IsDeadCheck(location)) { \ |
60 code; \ | 82 code; \ |
61 UNREACHABLE(); \ | 83 UNREACHABLE(); \ |
62 } | 84 } |
63 | 85 |
64 | 86 |
65 #define EXCEPTION_PREAMBLE() \ | 87 #define EXCEPTION_PREAMBLE() \ |
66 thread_local.IncrementCallDepth(); \ | 88 thread_local.IncrementCallDepth(); \ |
(...skipping 3595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3662 i::Debugger::SetMessageHandler(MessageHandlerWrapper); | 3684 i::Debugger::SetMessageHandler(MessageHandlerWrapper); |
3663 } else { | 3685 } else { |
3664 i::Debugger::SetMessageHandler(NULL); | 3686 i::Debugger::SetMessageHandler(NULL); |
3665 } | 3687 } |
3666 } | 3688 } |
3667 | 3689 |
3668 | 3690 |
3669 void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) { | 3691 void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) { |
3670 EnsureInitialized("v8::Debug::SetMessageHandler"); | 3692 EnsureInitialized("v8::Debug::SetMessageHandler"); |
3671 ENTER_V8; | 3693 ENTER_V8; |
3672 HandleScope scope; | 3694 // rybin HandleScope scope; |
3673 i::Debugger::SetMessageHandler(handler); | 3695 i::Debugger::SetMessageHandler(handler); |
3674 } | 3696 } |
3675 | 3697 |
3676 | 3698 |
3677 void Debug::SendCommand(const uint16_t* command, int length, | 3699 void Debug::SendCommand(const uint16_t* command, int length, |
3678 ClientData* client_data) { | 3700 ClientData* client_data) { |
3679 if (!i::V8::IsRunning()) return; | 3701 if (!i::V8::IsRunning()) return; |
3680 i::Debugger::ProcessCommand(i::Vector<const uint16_t>(command, length), | 3702 i::Debugger::ProcessCommand(i::Vector<const uint16_t>(command, length), |
3681 client_data); | 3703 client_data); |
3682 } | 3704 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3822 | 3844 |
3823 | 3845 |
3824 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 3846 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
3825 HandleScopeImplementer* thread_local = | 3847 HandleScopeImplementer* thread_local = |
3826 reinterpret_cast<HandleScopeImplementer*>(storage); | 3848 reinterpret_cast<HandleScopeImplementer*>(storage); |
3827 thread_local->IterateThis(v); | 3849 thread_local->IterateThis(v); |
3828 return storage + ArchiveSpacePerThread(); | 3850 return storage + ArchiveSpacePerThread(); |
3829 } | 3851 } |
3830 | 3852 |
3831 } } // namespace v8::internal | 3853 } } // namespace v8::internal |
OLD | NEW |