Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/execution.cc

Issue 77035: Add ENABLE_DEBUGGER_SUPPORT macro.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/execution.h ('k') | src/factory.h » ('j') | src/serialize.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 299
300 300
301 void StackGuard::Preempt() { 301 void StackGuard::Preempt() {
302 ExecutionAccess access; 302 ExecutionAccess access;
303 thread_local_.interrupt_flags_ |= PREEMPT; 303 thread_local_.interrupt_flags_ |= PREEMPT;
304 set_limits(kInterruptLimit, access); 304 set_limits(kInterruptLimit, access);
305 } 305 }
306 306
307 307
308 #ifdef ENABLE_DEBUGGER_SUPPORT
308 bool StackGuard::IsDebugBreak() { 309 bool StackGuard::IsDebugBreak() {
309 ExecutionAccess access; 310 ExecutionAccess access;
310 return thread_local_.interrupt_flags_ & DEBUGBREAK; 311 return thread_local_.interrupt_flags_ & DEBUGBREAK;
311 } 312 }
312 313
313 314
314 void StackGuard::DebugBreak() { 315 void StackGuard::DebugBreak() {
315 ExecutionAccess access; 316 ExecutionAccess access;
316 thread_local_.interrupt_flags_ |= DEBUGBREAK; 317 thread_local_.interrupt_flags_ |= DEBUGBREAK;
317 set_limits(kInterruptLimit, access); 318 set_limits(kInterruptLimit, access);
318 } 319 }
319 320
320 321
321 bool StackGuard::IsDebugCommand() { 322 bool StackGuard::IsDebugCommand() {
322 ExecutionAccess access; 323 ExecutionAccess access;
323 return thread_local_.interrupt_flags_ & DEBUGCOMMAND; 324 return thread_local_.interrupt_flags_ & DEBUGCOMMAND;
324 } 325 }
325 326
326 327
327 void StackGuard::DebugCommand() { 328 void StackGuard::DebugCommand() {
328 if (FLAG_debugger_auto_break) { 329 if (FLAG_debugger_auto_break) {
329 ExecutionAccess access; 330 ExecutionAccess access;
330 thread_local_.interrupt_flags_ |= DEBUGCOMMAND; 331 thread_local_.interrupt_flags_ |= DEBUGCOMMAND;
331 set_limits(kInterruptLimit, access); 332 set_limits(kInterruptLimit, access);
332 } 333 }
333 } 334 }
334 335 #endif
335 336
336 void StackGuard::Continue(InterruptFlag after_what) { 337 void StackGuard::Continue(InterruptFlag after_what) {
337 ExecutionAccess access; 338 ExecutionAccess access;
338 thread_local_.interrupt_flags_ &= ~static_cast<int>(after_what); 339 thread_local_.interrupt_flags_ &= ~static_cast<int>(after_what);
339 if (thread_local_.interrupt_flags_ == 0) { 340 if (thread_local_.interrupt_flags_ == 0) {
340 reset_limits(access); 341 reset_limits(access);
341 } 342 }
342 } 343 }
343 344
344 345
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 return Handle<String>::cast(result); 533 return Handle<String>::cast(result);
533 } 534 }
534 535
535 536
536 static Object* RuntimePreempt() { 537 static Object* RuntimePreempt() {
537 // Clear the preempt request flag. 538 // Clear the preempt request flag.
538 StackGuard::Continue(PREEMPT); 539 StackGuard::Continue(PREEMPT);
539 540
540 ContextSwitcher::PreemptionReceived(); 541 ContextSwitcher::PreemptionReceived();
541 542
543 #ifdef ENABLE_DEBUGGER_SUPPORT
542 if (Debug::InDebugger()) { 544 if (Debug::InDebugger()) {
543 // If currently in the debugger don't do any actual preemption but record 545 // If currently in the debugger don't do any actual preemption but record
544 // that preemption occoured while in the debugger. 546 // that preemption occoured while in the debugger.
545 Debug::PreemptionWhileInDebugger(); 547 Debug::PreemptionWhileInDebugger();
546 } else { 548 } else {
547 // Perform preemption. 549 // Perform preemption.
548 v8::Unlocker unlocker; 550 v8::Unlocker unlocker;
549 Thread::YieldCPU(); 551 Thread::YieldCPU();
550 } 552 }
553 #else
554 // Perform preemption.
555 v8::Unlocker unlocker;
556 Thread::YieldCPU();
557 #endif
551 558
552 return Heap::undefined_value(); 559 return Heap::undefined_value();
553 } 560 }
554 561
555 562
563 #ifdef ENABLE_DEBUGGER_SUPPORT
556 Object* Execution::DebugBreakHelper() { 564 Object* Execution::DebugBreakHelper() {
557 // Just continue if breaks are disabled. 565 // Just continue if breaks are disabled.
558 if (Debug::disable_break()) { 566 if (Debug::disable_break()) {
559 return Heap::undefined_value(); 567 return Heap::undefined_value();
560 } 568 }
561 569
562 // Don't break in system functions. If the current function is 570 // Don't break in system functions. If the current function is
563 // either in the builtins object of some context or is in the debug 571 // either in the builtins object of some context or is in the debug
564 // context just return with the debug break stack guard active. 572 // context just return with the debug break stack guard active.
565 JavaScriptFrameIterator it; 573 JavaScriptFrameIterator it;
(...skipping 25 matching lines...) Expand all
591 if (debugger.FailedToEnter()) { 599 if (debugger.FailedToEnter()) {
592 return Heap::undefined_value(); 600 return Heap::undefined_value();
593 } 601 }
594 602
595 // Notify the debug event listeners. 603 // Notify the debug event listeners.
596 Debugger::OnDebugBreak(Factory::undefined_value(), debug_command_only); 604 Debugger::OnDebugBreak(Factory::undefined_value(), debug_command_only);
597 605
598 // Return to continue execution. 606 // Return to continue execution.
599 return Heap::undefined_value(); 607 return Heap::undefined_value();
600 } 608 }
601 609 #endif
602 610
603 Object* Execution::HandleStackGuardInterrupt() { 611 Object* Execution::HandleStackGuardInterrupt() {
612 #ifdef ENABLE_DEBUGGER_SUPPORT
604 if (StackGuard::IsDebugBreak() || StackGuard::IsDebugCommand()) { 613 if (StackGuard::IsDebugBreak() || StackGuard::IsDebugCommand()) {
605 DebugBreakHelper(); 614 DebugBreakHelper();
606 } 615 }
616 #endif
607 if (StackGuard::IsPreempted()) RuntimePreempt(); 617 if (StackGuard::IsPreempted()) RuntimePreempt();
608 if (StackGuard::IsInterrupted()) { 618 if (StackGuard::IsInterrupted()) {
609 // interrupt 619 // interrupt
610 StackGuard::Continue(INTERRUPT); 620 StackGuard::Continue(INTERRUPT);
611 return Top::StackOverflow(); 621 return Top::StackOverflow();
612 } 622 }
613 return Heap::undefined_value(); 623 return Heap::undefined_value();
614 } 624 }
615 625
616 // --- G C E x t e n s i o n --- 626 // --- G C E x t e n s i o n ---
(...skipping 11 matching lines...) Expand all
628 // All allocation spaces other than NEW_SPACE have the same effect. 638 // All allocation spaces other than NEW_SPACE have the same effect.
629 Heap::CollectGarbage(0, OLD_DATA_SPACE); 639 Heap::CollectGarbage(0, OLD_DATA_SPACE);
630 return v8::Undefined(); 640 return v8::Undefined();
631 } 641 }
632 642
633 643
634 static GCExtension kGCExtension; 644 static GCExtension kGCExtension;
635 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); 645 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension);
636 646
637 } } // namespace v8::internal 647 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.h ('k') | src/factory.h » ('j') | src/serialize.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698