| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 } | 311 } |
| 312 | 312 |
| 313 | 313 |
| 314 void StackGuard::DebugBreak() { | 314 void StackGuard::DebugBreak() { |
| 315 ExecutionAccess access; | 315 ExecutionAccess access; |
| 316 thread_local_.interrupt_flags_ |= DEBUGBREAK; | 316 thread_local_.interrupt_flags_ |= DEBUGBREAK; |
| 317 set_limits(kInterruptLimit, access); | 317 set_limits(kInterruptLimit, access); |
| 318 } | 318 } |
| 319 | 319 |
| 320 | 320 |
| 321 bool StackGuard::IsDebugCommand() { |
| 322 ExecutionAccess access; |
| 323 return thread_local_.interrupt_flags_ & DEBUGCOMMAND; |
| 324 } |
| 325 |
| 326 |
| 327 void StackGuard::DebugCommand() { |
| 328 if (FLAG_debugger_auto_break) { |
| 329 ExecutionAccess access; |
| 330 thread_local_.interrupt_flags_ |= DEBUGCOMMAND; |
| 331 set_limits(kInterruptLimit, access); |
| 332 } |
| 333 } |
| 334 |
| 335 |
| 321 void StackGuard::Continue(InterruptFlag after_what) { | 336 void StackGuard::Continue(InterruptFlag after_what) { |
| 322 ExecutionAccess access; | 337 ExecutionAccess access; |
| 323 thread_local_.interrupt_flags_ &= ~static_cast<int>(after_what); | 338 thread_local_.interrupt_flags_ &= ~static_cast<int>(after_what); |
| 324 if (thread_local_.interrupt_flags_ == 0) { | 339 if (thread_local_.interrupt_flags_ == 0) { |
| 325 reset_limits(access); | 340 reset_limits(access); |
| 326 } | 341 } |
| 327 } | 342 } |
| 328 | 343 |
| 329 | 344 |
| 330 int StackGuard::ArchiveSpacePerThread() { | 345 int StackGuard::ArchiveSpacePerThread() { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 JavaScriptFrameIterator it; | 564 JavaScriptFrameIterator it; |
| 550 JavaScriptFrame* frame = it.frame(); | 565 JavaScriptFrame* frame = it.frame(); |
| 551 Object* fun = frame->function(); | 566 Object* fun = frame->function(); |
| 552 if (fun->IsJSFunction()) { | 567 if (fun->IsJSFunction()) { |
| 553 GlobalObject* global = JSFunction::cast(fun)->context()->global(); | 568 GlobalObject* global = JSFunction::cast(fun)->context()->global(); |
| 554 if (global->IsJSBuiltinsObject() || Debug::IsDebugGlobal(global)) { | 569 if (global->IsJSBuiltinsObject() || Debug::IsDebugGlobal(global)) { |
| 555 return Heap::undefined_value(); | 570 return Heap::undefined_value(); |
| 556 } | 571 } |
| 557 } | 572 } |
| 558 | 573 |
| 559 // Clear the debug request flag. | 574 // Check for debug command break only. |
| 575 bool debug_command_only = |
| 576 StackGuard::IsDebugCommand() && !StackGuard::IsDebugBreak(); |
| 577 |
| 578 // Clear the debug request flags. |
| 560 StackGuard::Continue(DEBUGBREAK); | 579 StackGuard::Continue(DEBUGBREAK); |
| 580 StackGuard::Continue(DEBUGCOMMAND); |
| 581 |
| 582 // If debug command only and already in debugger ignore it. |
| 583 if (debug_command_only && Debug::InDebugger()) { |
| 584 return Heap::undefined_value(); |
| 585 } |
| 561 | 586 |
| 562 HandleScope scope; | 587 HandleScope scope; |
| 563 // Enter the debugger. Just continue if we fail to enter the debugger. | 588 // Enter the debugger. Just continue if we fail to enter the debugger. |
| 564 EnterDebugger debugger; | 589 EnterDebugger debugger; |
| 565 if (debugger.FailedToEnter()) { | 590 if (debugger.FailedToEnter()) { |
| 566 return Heap::undefined_value(); | 591 return Heap::undefined_value(); |
| 567 } | 592 } |
| 568 | 593 |
| 569 // Notify the debug event listeners. | 594 // Notify the debug event listeners. |
| 570 Debugger::OnDebugBreak(Factory::undefined_value()); | 595 Debugger::OnDebugBreak(Factory::undefined_value(), debug_command_only); |
| 571 | 596 |
| 572 // Return to continue execution. | 597 // Return to continue execution. |
| 573 return Heap::undefined_value(); | 598 return Heap::undefined_value(); |
| 574 } | 599 } |
| 575 | 600 |
| 576 | 601 |
| 577 Object* Execution::HandleStackGuardInterrupt() { | 602 Object* Execution::HandleStackGuardInterrupt() { |
| 578 if (StackGuard::IsDebugBreak()) DebugBreakHelper(); | 603 if (StackGuard::IsDebugBreak() || StackGuard::IsDebugCommand()) { |
| 604 DebugBreakHelper(); |
| 605 } |
| 579 if (StackGuard::IsPreempted()) RuntimePreempt(); | 606 if (StackGuard::IsPreempted()) RuntimePreempt(); |
| 580 if (StackGuard::IsInterrupted()) { | 607 if (StackGuard::IsInterrupted()) { |
| 581 // interrupt | 608 // interrupt |
| 582 StackGuard::Continue(INTERRUPT); | 609 StackGuard::Continue(INTERRUPT); |
| 583 return Top::StackOverflow(); | 610 return Top::StackOverflow(); |
| 584 } | 611 } |
| 585 return Heap::undefined_value(); | 612 return Heap::undefined_value(); |
| 586 } | 613 } |
| 587 | 614 |
| 588 // --- G C E x t e n s i o n --- | 615 // --- G C E x t e n s i o n --- |
| (...skipping 11 matching lines...) Expand all Loading... |
| 600 // All allocation spaces other than NEW_SPACE have the same effect. | 627 // All allocation spaces other than NEW_SPACE have the same effect. |
| 601 Heap::CollectGarbage(0, OLD_DATA_SPACE); | 628 Heap::CollectGarbage(0, OLD_DATA_SPACE); |
| 602 return v8::Undefined(); | 629 return v8::Undefined(); |
| 603 } | 630 } |
| 604 | 631 |
| 605 | 632 |
| 606 static GCExtension kGCExtension; | 633 static GCExtension kGCExtension; |
| 607 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); | 634 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); |
| 608 | 635 |
| 609 } } // namespace v8::internal | 636 } } // namespace v8::internal |
| OLD | NEW |