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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 thread_local_.interrupt_flags_ |= RUNTIME_PROFILER_TICK; | 439 thread_local_.interrupt_flags_ |= RUNTIME_PROFILER_TICK; |
440 if (thread_local_.postpone_interrupts_nesting_ == 0) { | 440 if (thread_local_.postpone_interrupts_nesting_ == 0) { |
441 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; | 441 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; |
442 isolate_->heap()->SetStackLimits(); | 442 isolate_->heap()->SetStackLimits(); |
443 } | 443 } |
444 ExecutionAccess::Unlock(isolate_); | 444 ExecutionAccess::Unlock(isolate_); |
445 } | 445 } |
446 } | 446 } |
447 | 447 |
448 | 448 |
| 449 void StackGuard::RequestCodeReadyEvent() { |
| 450 ASSERT(FLAG_parallel_recompilation); |
| 451 if (ExecutionAccess::TryLock(isolate_)) { |
| 452 thread_local_.interrupt_flags_ |= CODE_READY; |
| 453 if (thread_local_.postpone_interrupts_nesting_ == 0) { |
| 454 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; |
| 455 isolate_->heap()->SetStackLimits(); |
| 456 } |
| 457 ExecutionAccess::Unlock(isolate_); |
| 458 } |
| 459 } |
| 460 |
| 461 |
| 462 bool StackGuard::IsCodeReadyEvent() { |
| 463 ExecutionAccess access(isolate_); |
| 464 return (thread_local_.interrupt_flags_ & CODE_READY) != 0; |
| 465 } |
| 466 |
| 467 |
449 bool StackGuard::IsGCRequest() { | 468 bool StackGuard::IsGCRequest() { |
450 ExecutionAccess access(isolate_); | 469 ExecutionAccess access(isolate_); |
451 return (thread_local_.interrupt_flags_ & GC_REQUEST) != 0; | 470 return (thread_local_.interrupt_flags_ & GC_REQUEST) != 0; |
452 } | 471 } |
453 | 472 |
454 | 473 |
455 void StackGuard::RequestGC() { | 474 void StackGuard::RequestGC() { |
456 ExecutionAccess access(isolate_); | 475 ExecutionAccess access(isolate_); |
457 thread_local_.interrupt_flags_ |= GC_REQUEST; | 476 thread_local_.interrupt_flags_ |= GC_REQUEST; |
458 if (thread_local_.postpone_interrupts_nesting_ == 0) { | 477 if (thread_local_.postpone_interrupts_nesting_ == 0) { |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 if (stack_guard->ShouldPostponeInterrupts()) { | 923 if (stack_guard->ShouldPostponeInterrupts()) { |
905 return isolate->heap()->undefined_value(); | 924 return isolate->heap()->undefined_value(); |
906 } | 925 } |
907 | 926 |
908 if (stack_guard->IsGCRequest()) { | 927 if (stack_guard->IsGCRequest()) { |
909 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 928 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
910 "StackGuard GC request"); | 929 "StackGuard GC request"); |
911 stack_guard->Continue(GC_REQUEST); | 930 stack_guard->Continue(GC_REQUEST); |
912 } | 931 } |
913 | 932 |
| 933 if (stack_guard->IsCodeReadyEvent()) { |
| 934 ASSERT(FLAG_parallel_recompilation); |
| 935 if (FLAG_trace_parallel_recompilation) { |
| 936 PrintF(" ** CODE_READY event received.\n"); |
| 937 } |
| 938 stack_guard->Continue(CODE_READY); |
| 939 } |
| 940 if (!stack_guard->IsTerminateExecution()) { |
| 941 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
| 942 } |
| 943 |
914 isolate->counters()->stack_interrupts()->Increment(); | 944 isolate->counters()->stack_interrupts()->Increment(); |
915 // If FLAG_count_based_interrupts, every interrupt is a profiler interrupt. | 945 // If FLAG_count_based_interrupts, every interrupt is a profiler interrupt. |
916 if (FLAG_count_based_interrupts || | 946 if (FLAG_count_based_interrupts || |
917 stack_guard->IsRuntimeProfilerTick()) { | 947 stack_guard->IsRuntimeProfilerTick()) { |
918 isolate->counters()->runtime_profiler_ticks()->Increment(); | 948 isolate->counters()->runtime_profiler_ticks()->Increment(); |
919 stack_guard->Continue(RUNTIME_PROFILER_TICK); | 949 stack_guard->Continue(RUNTIME_PROFILER_TICK); |
920 isolate->runtime_profiler()->OptimizeNow(); | 950 isolate->runtime_profiler()->OptimizeNow(); |
921 } | 951 } |
922 #ifdef ENABLE_DEBUGGER_SUPPORT | 952 #ifdef ENABLE_DEBUGGER_SUPPORT |
923 if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { | 953 if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { |
924 DebugBreakHelper(); | 954 DebugBreakHelper(); |
925 } | 955 } |
926 #endif | 956 #endif |
927 if (stack_guard->IsPreempted()) RuntimePreempt(); | 957 if (stack_guard->IsPreempted()) RuntimePreempt(); |
928 if (stack_guard->IsTerminateExecution()) { | 958 if (stack_guard->IsTerminateExecution()) { |
929 stack_guard->Continue(TERMINATE); | 959 stack_guard->Continue(TERMINATE); |
930 return isolate->TerminateExecution(); | 960 return isolate->TerminateExecution(); |
931 } | 961 } |
932 if (stack_guard->IsInterrupted()) { | 962 if (stack_guard->IsInterrupted()) { |
933 stack_guard->Continue(INTERRUPT); | 963 stack_guard->Continue(INTERRUPT); |
934 return isolate->StackOverflow(); | 964 return isolate->StackOverflow(); |
935 } | 965 } |
936 return isolate->heap()->undefined_value(); | 966 return isolate->heap()->undefined_value(); |
937 } | 967 } |
938 | 968 |
939 | 969 |
940 } } // namespace v8::internal | 970 } } // namespace v8::internal |
OLD | NEW |