| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 } | 581 } |
| 582 | 582 |
| 583 | 583 |
| 584 #ifdef ENABLE_DEBUGGER_SUPPORT | 584 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 585 Object* Execution::DebugBreakHelper() { | 585 Object* Execution::DebugBreakHelper() { |
| 586 // Just continue if breaks are disabled. | 586 // Just continue if breaks are disabled. |
| 587 if (Debug::disable_break()) { | 587 if (Debug::disable_break()) { |
| 588 return Heap::undefined_value(); | 588 return Heap::undefined_value(); |
| 589 } | 589 } |
| 590 | 590 |
| 591 // Don't break in system functions. If the current function is | 591 // Collect the break state before clearing the flags. |
| 592 // either in the builtins object of some context or is in the debug | |
| 593 // context just return with the debug break stack guard active. | |
| 594 JavaScriptFrameIterator it; | |
| 595 JavaScriptFrame* frame = it.frame(); | |
| 596 Object* fun = frame->function(); | |
| 597 if (fun->IsJSFunction()) { | |
| 598 GlobalObject* global = JSFunction::cast(fun)->context()->global(); | |
| 599 if (global->IsJSBuiltinsObject() || Debug::IsDebugGlobal(global)) { | |
| 600 return Heap::undefined_value(); | |
| 601 } | |
| 602 } | |
| 603 | |
| 604 // Check for debug command break only. | |
| 605 bool debug_command_only = | 592 bool debug_command_only = |
| 606 StackGuard::IsDebugCommand() && !StackGuard::IsDebugBreak(); | 593 StackGuard::IsDebugCommand() && !StackGuard::IsDebugBreak(); |
| 594 bool is_debug_break = StackGuard::IsDebugBreak(); |
| 607 | 595 |
| 608 // Clear the debug request flags. | 596 // Clear the debug request flags. |
| 609 StackGuard::Continue(DEBUGBREAK); | 597 StackGuard::Continue(DEBUGBREAK); |
| 610 StackGuard::Continue(DEBUGCOMMAND); | 598 StackGuard::Continue(DEBUGCOMMAND); |
| 611 | 599 |
| 612 // If debug command only and already in debugger ignore it. | |
| 613 if (debug_command_only && Debug::InDebugger()) { | |
| 614 return Heap::undefined_value(); | |
| 615 } | |
| 616 | |
| 617 HandleScope scope; | 600 HandleScope scope; |
| 618 // Enter the debugger. Just continue if we fail to enter the debugger. | 601 // Enter the debugger. Just continue if we fail to enter the debugger. |
| 619 EnterDebugger debugger; | 602 EnterDebugger debugger; |
| 620 if (debugger.FailedToEnter()) { | 603 if (debugger.FailedToEnter()) { |
| 621 return Heap::undefined_value(); | 604 return Heap::undefined_value(); |
| 622 } | 605 } |
| 623 | 606 |
| 624 // Notify the debug event listeners. | 607 // Notify the debug event listeners. Indicate auto continue if the break was |
| 608 // a debug command break. |
| 625 Debugger::OnDebugBreak(Factory::undefined_value(), debug_command_only); | 609 Debugger::OnDebugBreak(Factory::undefined_value(), debug_command_only); |
| 626 | 610 |
| 627 // Return to continue execution. | 611 // Return to continue execution. |
| 628 return Heap::undefined_value(); | 612 return Heap::undefined_value(); |
| 629 } | 613 } |
| 630 #endif | 614 #endif |
| 631 | 615 |
| 632 Object* Execution::HandleStackGuardInterrupt() { | 616 Object* Execution::HandleStackGuardInterrupt() { |
| 633 #ifdef ENABLE_DEBUGGER_SUPPORT | 617 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 634 if (StackGuard::IsDebugBreak() || StackGuard::IsDebugCommand()) { | 618 if (StackGuard::IsDebugBreak() || StackGuard::IsDebugCommand()) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 659 // All allocation spaces other than NEW_SPACE have the same effect. | 643 // All allocation spaces other than NEW_SPACE have the same effect. |
| 660 Heap::CollectAllGarbage(); | 644 Heap::CollectAllGarbage(); |
| 661 return v8::Undefined(); | 645 return v8::Undefined(); |
| 662 } | 646 } |
| 663 | 647 |
| 664 | 648 |
| 665 static GCExtension kGCExtension; | 649 static GCExtension kGCExtension; |
| 666 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); | 650 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); |
| 667 | 651 |
| 668 } } // namespace v8::internal | 652 } } // namespace v8::internal |
| OLD | NEW |