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

Side by Side Diff: src/runtime.cc

Issue 13783: * Made preemption work in Irregexp-native-ia32 (Closed)
Patch Set: Addressed review comments Created 12 years 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
« no previous file with comments | « src/regexp-macro-assembler-ia32.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »
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 3646 matching lines...) Expand 10 before | Expand all | Expand 10 after
3657 return Top::Throw(*reference_error); 3657 return Top::Throw(*reference_error);
3658 } 3658 }
3659 3659
3660 3660
3661 static Object* Runtime_StackOverflow(Arguments args) { 3661 static Object* Runtime_StackOverflow(Arguments args) {
3662 NoHandleAllocation na; 3662 NoHandleAllocation na;
3663 return Top::StackOverflow(); 3663 return Top::StackOverflow();
3664 } 3664 }
3665 3665
3666 3666
3667 static Object* RuntimePreempt(Arguments args) {
3668 // Clear the preempt request flag.
3669 StackGuard::Continue(PREEMPT);
3670
3671 ContextSwitcher::PreemptionReceived();
3672
3673 {
3674 v8::Unlocker unlocker;
3675 Thread::YieldCPU();
3676 }
3677
3678 return Heap::undefined_value();
3679 }
3680
3681
3682 static Object* DebugBreakHelper() {
3683 // Just continue if breaks are disabled.
3684 if (Debug::disable_break()) {
3685 return Heap::undefined_value();
3686 }
3687
3688 // Don't break in system functions. If the current function is
3689 // either in the builtins object of some context or is in the debug
3690 // context just return with the debug break stack guard active.
3691 JavaScriptFrameIterator it;
3692 JavaScriptFrame* frame = it.frame();
3693 Object* fun = frame->function();
3694 if (fun->IsJSFunction()) {
3695 GlobalObject* global = JSFunction::cast(fun)->context()->global();
3696 if (global->IsJSBuiltinsObject() || Debug::IsDebugGlobal(global)) {
3697 return Heap::undefined_value();
3698 }
3699 }
3700
3701 // Clear the debug request flag.
3702 StackGuard::Continue(DEBUGBREAK);
3703
3704 HandleScope scope;
3705 // Enter the debugger. Just continue if we fail to enter the debugger.
3706 EnterDebugger debugger;
3707 if (debugger.FailedToEnter()) {
3708 return Heap::undefined_value();
3709 }
3710
3711 // Notify the debug event listeners.
3712 Debugger::OnDebugBreak(Factory::undefined_value());
3713
3714 // Return to continue execution.
3715 return Heap::undefined_value();
3716 }
3717
3718
3719 static Object* Runtime_DebugBreak(Arguments args) { 3667 static Object* Runtime_DebugBreak(Arguments args) {
3720 ASSERT(args.length() == 0); 3668 ASSERT(args.length() == 0);
3721 return DebugBreakHelper(); 3669 return Execution::DebugBreakHelper();
3722 } 3670 }
3723 3671
3724 3672
3725 static Object* Runtime_StackGuard(Arguments args) { 3673 static Object* Runtime_StackGuard(Arguments args) {
3726 ASSERT(args.length() == 1); 3674 ASSERT(args.length() == 1);
3727 3675
3728 // First check if this is a real stack overflow. 3676 // First check if this is a real stack overflow.
3729 if (StackGuard::IsStackOverflow()) return Runtime_StackOverflow(args); 3677 if (StackGuard::IsStackOverflow()) return Runtime_StackOverflow(args);
3730 3678
3731 // If not real stack overflow the stack guard was used to interrupt 3679 return Execution::HandleStackGuardInterrupt();
3732 // execution for another purpose.
3733 if (StackGuard::IsDebugBreak()) DebugBreakHelper();
3734 if (StackGuard::IsPreempted()) RuntimePreempt(args);
3735 if (StackGuard::IsInterrupted()) {
3736 // interrupt
3737 StackGuard::Continue(INTERRUPT);
3738 return Top::StackOverflow();
3739 }
3740 return Heap::undefined_value();
3741 } 3680 }
3742 3681
3743 3682
3744 // NOTE: These PrintXXX functions are defined for all builds (not just 3683 // NOTE: These PrintXXX functions are defined for all builds (not just
3745 // DEBUG builds) because we may want to be able to trace function 3684 // DEBUG builds) because we may want to be able to trace function
3746 // calls in all modes. 3685 // calls in all modes.
3747 static void PrintString(String* str) { 3686 static void PrintString(String* str) {
3748 // not uncommon to have empty strings 3687 // not uncommon to have empty strings
3749 if (str->length() > 0) { 3688 if (str->length() > 0) {
3750 SmartPointer<char> s = 3689 SmartPointer<char> s =
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after
5920 } else { 5859 } else {
5921 // Handle last resort GC and make sure to allow future allocations 5860 // Handle last resort GC and make sure to allow future allocations
5922 // to grow the heap without causing GCs (if possible). 5861 // to grow the heap without causing GCs (if possible).
5923 Counters::gc_last_resort_from_js.Increment(); 5862 Counters::gc_last_resort_from_js.Increment();
5924 Heap::CollectAllGarbage(); 5863 Heap::CollectAllGarbage();
5925 } 5864 }
5926 } 5865 }
5927 5866
5928 5867
5929 } } // namespace v8::internal 5868 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/regexp-macro-assembler-ia32.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698