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 3974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3985 error = *result; | 3985 error = *result; |
3986 } | 3986 } |
3987 i::Handle<i::Object> result(error); | 3987 i::Handle<i::Object> result(error); |
3988 return Utils::ToLocal(result); | 3988 return Utils::ToLocal(result); |
3989 } | 3989 } |
3990 | 3990 |
3991 | 3991 |
3992 // --- D e b u g S u p p o r t --- | 3992 // --- D e b u g S u p p o r t --- |
3993 | 3993 |
3994 #ifdef ENABLE_DEBUGGER_SUPPORT | 3994 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 3995 |
| 3996 static v8::Debug::EventCallback event_callback = NULL; |
| 3997 |
| 3998 static void EventCallbackWrapper(const v8::Debug::EventDetails& event_details) { |
| 3999 if (event_callback) { |
| 4000 event_callback(event_details.GetEvent(), |
| 4001 event_details.GetExecutionState(), |
| 4002 event_details.GetEventData(), |
| 4003 event_details.GetCallbackData()); |
| 4004 } |
| 4005 } |
| 4006 |
| 4007 |
3995 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) { | 4008 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) { |
3996 EnsureInitialized("v8::Debug::SetDebugEventListener()"); | 4009 EnsureInitialized("v8::Debug::SetDebugEventListener()"); |
3997 ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false); | 4010 ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false); |
3998 ENTER_V8; | 4011 ENTER_V8; |
| 4012 |
| 4013 event_callback = that; |
| 4014 |
| 4015 HandleScope scope; |
| 4016 i::Handle<i::Object> proxy = i::Factory::undefined_value(); |
| 4017 if (that != NULL) { |
| 4018 proxy = i::Factory::NewProxy(FUNCTION_ADDR(EventCallbackWrapper)); |
| 4019 } |
| 4020 i::Debugger::SetEventListener(proxy, Utils::OpenHandle(*data)); |
| 4021 return true; |
| 4022 } |
| 4023 |
| 4024 |
| 4025 bool Debug::SetDebugEventListener2(EventCallback2 that, Handle<Value> data) { |
| 4026 EnsureInitialized("v8::Debug::SetDebugEventListener2()"); |
| 4027 ON_BAILOUT("v8::Debug::SetDebugEventListener2()", return false); |
| 4028 ENTER_V8; |
3999 HandleScope scope; | 4029 HandleScope scope; |
4000 i::Handle<i::Object> proxy = i::Factory::undefined_value(); | 4030 i::Handle<i::Object> proxy = i::Factory::undefined_value(); |
4001 if (that != NULL) { | 4031 if (that != NULL) { |
4002 proxy = i::Factory::NewProxy(FUNCTION_ADDR(that)); | 4032 proxy = i::Factory::NewProxy(FUNCTION_ADDR(that)); |
4003 } | 4033 } |
4004 i::Debugger::SetEventListener(proxy, Utils::OpenHandle(*data)); | 4034 i::Debugger::SetEventListener(proxy, Utils::OpenHandle(*data)); |
4005 return true; | 4035 return true; |
4006 } | 4036 } |
4007 | 4037 |
4008 | 4038 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4364 | 4394 |
4365 | 4395 |
4366 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 4396 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
4367 HandleScopeImplementer* thread_local = | 4397 HandleScopeImplementer* thread_local = |
4368 reinterpret_cast<HandleScopeImplementer*>(storage); | 4398 reinterpret_cast<HandleScopeImplementer*>(storage); |
4369 thread_local->IterateThis(v); | 4399 thread_local->IterateThis(v); |
4370 return storage + ArchiveSpacePerThread(); | 4400 return storage + ArchiveSpacePerThread(); |
4371 } | 4401 } |
4372 | 4402 |
4373 } } // namespace v8::internal | 4403 } } // namespace v8::internal |
OLD | NEW |