OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 isolate->clear_pending_exception(); | 760 isolate->clear_pending_exception(); |
761 return false; | 761 return false; |
762 } | 762 } |
763 | 763 |
764 // Execute the shared function in the debugger context. | 764 // Execute the shared function in the debugger context. |
765 Handle<Context> context = isolate->global_context(); | 765 Handle<Context> context = isolate->global_context(); |
766 bool caught_exception; | 766 bool caught_exception; |
767 Handle<JSFunction> function = | 767 Handle<JSFunction> function = |
768 factory->NewFunctionFromSharedFunctionInfo(function_info, context); | 768 factory->NewFunctionFromSharedFunctionInfo(function_info, context); |
769 | 769 |
770 Execution::TryCall(function, Handle<Object>(context->global()), | 770 Handle<Object> exception = |
771 0, NULL, &caught_exception); | 771 Execution::TryCall(function, Handle<Object>(context->global()), |
772 0, NULL, &caught_exception); | |
772 | 773 |
773 // Check for caught exceptions. | 774 // Check for caught exceptions. |
774 if (caught_exception) { | 775 if (caught_exception) { |
776 ASSERT(!isolate->has_pending_exception()); | |
777 MessageLocation computed_location; | |
778 isolate->ComputeLocation(&computed_location); | |
775 Handle<Object> message = MessageHandler::MakeMessageObject( | 779 Handle<Object> message = MessageHandler::MakeMessageObject( |
776 "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(), | 780 "error_loading_debugger", &computed_location, |
777 Handle<String>(), Handle<JSArray>()); | 781 Vector<Handle<Object> >::empty(), Handle<String>(), Handle<JSArray>()); |
782 // If a stack overflow happened white creating the message object, silently | |
Michael Starzinger
2012/04/03 13:31:32
s/white/while/
danno
2012/04/03 13:41:28
Done.
| |
783 // fail. | |
784 if (isolate->has_pending_exception()) { | |
Michael Starzinger
2012/04/03 13:31:32
Can this actually happen? If not, I would prefer a
danno
2012/04/03 13:41:28
Done.
On 2012/04/03 13:31:32, Michael Starzinger w
| |
785 isolate->clear_pending_exception(); | |
786 return false; | |
787 } | |
788 isolate->set_pending_exception(*exception); | |
778 MessageHandler::ReportMessage(Isolate::Current(), NULL, message); | 789 MessageHandler::ReportMessage(Isolate::Current(), NULL, message); |
790 isolate->clear_pending_exception(); | |
779 return false; | 791 return false; |
780 } | 792 } |
781 | 793 |
782 // Mark this script as native and return successfully. | 794 // Mark this script as native and return successfully. |
783 Handle<Script> script(Script::cast(function->shared()->script())); | 795 Handle<Script> script(Script::cast(function->shared()->script())); |
784 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 796 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
785 return true; | 797 return true; |
786 } | 798 } |
787 | 799 |
788 | 800 |
(...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3225 | 3237 |
3226 | 3238 |
3227 EnterDebugger::~EnterDebugger() { | 3239 EnterDebugger::~EnterDebugger() { |
3228 ASSERT(Isolate::Current() == isolate_); | 3240 ASSERT(Isolate::Current() == isolate_); |
3229 Debug* debug = isolate_->debug(); | 3241 Debug* debug = isolate_->debug(); |
3230 | 3242 |
3231 // Restore to the previous break state. | 3243 // Restore to the previous break state. |
3232 debug->SetBreak(break_frame_id_, break_id_); | 3244 debug->SetBreak(break_frame_id_, break_id_); |
3233 | 3245 |
3234 // Check for leaving the debugger. | 3246 // Check for leaving the debugger. |
3235 if (prev_ == NULL) { | 3247 if (!load_failed_ && prev_ == NULL) { |
3236 // Clear mirror cache when leaving the debugger. Skip this if there is a | 3248 // Clear mirror cache when leaving the debugger. Skip this if there is a |
3237 // pending exception as clearing the mirror cache calls back into | 3249 // pending exception as clearing the mirror cache calls back into |
3238 // JavaScript. This can happen if the v8::Debug::Call is used in which | 3250 // JavaScript. This can happen if the v8::Debug::Call is used in which |
3239 // case the exception should end up in the calling code. | 3251 // case the exception should end up in the calling code. |
3240 if (!isolate_->has_pending_exception()) { | 3252 if (!isolate_->has_pending_exception()) { |
3241 // Try to avoid any pending debug break breaking in the clear mirror | 3253 // Try to avoid any pending debug break breaking in the clear mirror |
3242 // cache JavaScript code. | 3254 // cache JavaScript code. |
3243 if (isolate_->stack_guard()->IsDebugBreak()) { | 3255 if (isolate_->stack_guard()->IsDebugBreak()) { |
3244 debug->set_interrupts_pending(DEBUGBREAK); | 3256 debug->set_interrupts_pending(DEBUGBREAK); |
3245 isolate_->stack_guard()->Continue(DEBUGBREAK); | 3257 isolate_->stack_guard()->Continue(DEBUGBREAK); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3572 { | 3584 { |
3573 Locker locker; | 3585 Locker locker; |
3574 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3586 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
3575 } | 3587 } |
3576 } | 3588 } |
3577 } | 3589 } |
3578 | 3590 |
3579 #endif // ENABLE_DEBUGGER_SUPPORT | 3591 #endif // ENABLE_DEBUGGER_SUPPORT |
3580 | 3592 |
3581 } } // namespace v8::internal | 3593 } } // namespace v8::internal |
OLD | NEW |