Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 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 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 } | 425 } |
| 426 | 426 |
| 427 | 427 |
| 428 void StackGuard::TerminateExecution() { | 428 void StackGuard::TerminateExecution() { |
| 429 ExecutionAccess access(isolate_); | 429 ExecutionAccess access(isolate_); |
| 430 thread_local_.interrupt_flags_ |= TERMINATE; | 430 thread_local_.interrupt_flags_ |= TERMINATE; |
| 431 set_interrupt_limits(access); | 431 set_interrupt_limits(access); |
| 432 } | 432 } |
| 433 | 433 |
| 434 | 434 |
| 435 void StackGuard::RequestCodeReadyEvent() { | |
| 436 ASSERT(FLAG_parallel_recompilation); | |
| 437 if (ExecutionAccess::TryLock(isolate_)) { | |
| 438 thread_local_.interrupt_flags_ |= CODE_READY; | |
| 439 if (thread_local_.postpone_interrupts_nesting_ == 0) { | |
| 440 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; | |
| 441 isolate_->heap()->SetStackLimits(); | |
| 442 } | |
| 443 ExecutionAccess::Unlock(isolate_); | |
| 444 } | |
| 445 } | |
| 446 | |
| 447 | |
| 448 bool StackGuard::IsCodeReadyEvent() { | |
| 449 ExecutionAccess access(isolate_); | |
| 450 return (thread_local_.interrupt_flags_ & CODE_READY) != 0; | |
| 451 } | |
| 452 | |
| 453 | |
| 454 bool StackGuard::IsGCRequest() { | 435 bool StackGuard::IsGCRequest() { |
| 455 ExecutionAccess access(isolate_); | 436 ExecutionAccess access(isolate_); |
| 456 return (thread_local_.interrupt_flags_ & GC_REQUEST) != 0; | 437 return (thread_local_.interrupt_flags_ & GC_REQUEST) != 0; |
| 457 } | 438 } |
| 458 | 439 |
| 459 | 440 |
| 460 void StackGuard::RequestGC() { | 441 void StackGuard::RequestGC() { |
| 461 ExecutionAccess access(isolate_); | 442 ExecutionAccess access(isolate_); |
| 462 thread_local_.interrupt_flags_ |= GC_REQUEST; | 443 thread_local_.interrupt_flags_ |= GC_REQUEST; |
| 463 if (thread_local_.postpone_interrupts_nesting_ == 0) { | 444 if (thread_local_.postpone_interrupts_nesting_ == 0) { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 882 // a debug command break. | 863 // a debug command break. |
| 883 isolate->debugger()->OnDebugBreak(isolate->factory()->undefined_value(), | 864 isolate->debugger()->OnDebugBreak(isolate->factory()->undefined_value(), |
| 884 debug_command_only); | 865 debug_command_only); |
| 885 } | 866 } |
| 886 | 867 |
| 887 | 868 |
| 888 #endif | 869 #endif |
| 889 | 870 |
| 890 MaybeObject* Execution::HandleStackGuardInterrupt(Isolate* isolate) { | 871 MaybeObject* Execution::HandleStackGuardInterrupt(Isolate* isolate) { |
| 891 StackGuard* stack_guard = isolate->stack_guard(); | 872 StackGuard* stack_guard = isolate->stack_guard(); |
| 873 isolate->counters()->stack_interrupts()->Increment(); | |
| 892 if (stack_guard->ShouldPostponeInterrupts()) { | 874 if (stack_guard->ShouldPostponeInterrupts()) { |
| 893 return isolate->heap()->undefined_value(); | 875 return isolate->heap()->undefined_value(); |
| 894 } | 876 } |
| 895 | 877 |
| 896 if (stack_guard->IsGCRequest()) { | 878 if (stack_guard->IsGCRequest()) { |
| 897 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 879 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 898 "StackGuard GC request"); | 880 "StackGuard GC request"); |
| 899 stack_guard->Continue(GC_REQUEST); | 881 stack_guard->Continue(GC_REQUEST); |
| 882 return isolate->heap()->undefined_value(); | |
|
Jakob Kummerow
2013/03/12 15:19:30
Probably better to do this change of behavior in a
Sven Panne
2013/03/12 15:44:51
+1 for a separate CL, I considered something simil
Yang
2013/03/12 18:03:38
Done.
| |
| 900 } | 883 } |
| 901 | 884 |
| 902 if (stack_guard->IsCodeReadyEvent()) { | |
| 903 ASSERT(FLAG_parallel_recompilation); | |
| 904 if (FLAG_trace_parallel_recompilation) { | |
| 905 PrintF(" ** CODE_READY event received.\n"); | |
| 906 } | |
| 907 stack_guard->Continue(CODE_READY); | |
| 908 } | |
| 909 if (!stack_guard->IsTerminateExecution() && | |
| 910 !FLAG_manual_parallel_recompilation) { | |
| 911 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | |
| 912 } | |
| 913 | |
| 914 isolate->counters()->stack_interrupts()->Increment(); | |
| 915 isolate->counters()->runtime_profiler_ticks()->Increment(); | |
| 916 isolate->runtime_profiler()->OptimizeNow(); | |
| 917 #ifdef ENABLE_DEBUGGER_SUPPORT | 885 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 918 if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { | 886 if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { |
| 919 DebugBreakHelper(); | 887 DebugBreakHelper(); |
| 888 return isolate->heap()->undefined_value(); | |
| 920 } | 889 } |
| 921 #endif | 890 #endif |
| 922 if (stack_guard->IsPreempted()) RuntimePreempt(); | 891 if (stack_guard->IsPreempted()) { |
| 892 RuntimePreempt(); | |
| 893 return isolate->heap()->undefined_value(); | |
| 894 } | |
| 923 if (stack_guard->IsTerminateExecution()) { | 895 if (stack_guard->IsTerminateExecution()) { |
| 924 stack_guard->Continue(TERMINATE); | 896 stack_guard->Continue(TERMINATE); |
| 925 return isolate->TerminateExecution(); | 897 return isolate->TerminateExecution(); |
| 926 } | 898 } |
| 927 if (stack_guard->IsInterrupted()) { | 899 if (stack_guard->IsInterrupted()) { |
| 928 stack_guard->Continue(INTERRUPT); | 900 stack_guard->Continue(INTERRUPT); |
| 929 return isolate->StackOverflow(); | 901 return isolate->StackOverflow(); |
| 930 } | 902 } |
| 903 | |
| 904 isolate->counters()->runtime_profiler_ticks()->Increment(); | |
| 905 isolate->runtime_profiler()->OptimizeNow(); | |
| 931 return isolate->heap()->undefined_value(); | 906 return isolate->heap()->undefined_value(); |
| 932 } | 907 } |
| 933 | 908 |
| 934 | 909 |
| 935 } } // namespace v8::internal | 910 } } // namespace v8::internal |
| OLD | NEW |