| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 892   if (stack_guard->ShouldPostponeInterrupts()) { | 873   if (stack_guard->ShouldPostponeInterrupts()) { | 
| 893     return isolate->heap()->undefined_value(); | 874     return isolate->heap()->undefined_value(); | 
| 894   } | 875   } | 
| 895 | 876 | 
| 896   if (stack_guard->IsGCRequest()) { | 877   if (stack_guard->IsGCRequest()) { | 
| 897     isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 878     isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 
| 898                                        "StackGuard GC request"); | 879                                        "StackGuard GC request"); | 
| 899     stack_guard->Continue(GC_REQUEST); | 880     stack_guard->Continue(GC_REQUEST); | 
| 900   } | 881   } | 
| 901 | 882 | 
| 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 | 883 | 
| 914   isolate->counters()->stack_interrupts()->Increment(); | 884   isolate->counters()->stack_interrupts()->Increment(); | 
| 915   isolate->counters()->runtime_profiler_ticks()->Increment(); | 885   isolate->counters()->runtime_profiler_ticks()->Increment(); | 
| 916   isolate->runtime_profiler()->OptimizeNow(); | 886   isolate->runtime_profiler()->OptimizeNow(); | 
| 917 #ifdef ENABLE_DEBUGGER_SUPPORT | 887 #ifdef ENABLE_DEBUGGER_SUPPORT | 
| 918   if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { | 888   if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { | 
| 919     DebugBreakHelper(); | 889     DebugBreakHelper(); | 
| 920   } | 890   } | 
| 921 #endif | 891 #endif | 
| 922   if (stack_guard->IsPreempted()) RuntimePreempt(); | 892   if (stack_guard->IsPreempted()) RuntimePreempt(); | 
| 923   if (stack_guard->IsTerminateExecution()) { | 893   if (stack_guard->IsTerminateExecution()) { | 
| 924     stack_guard->Continue(TERMINATE); | 894     stack_guard->Continue(TERMINATE); | 
| 925     return isolate->TerminateExecution(); | 895     return isolate->TerminateExecution(); | 
| 926   } | 896   } | 
| 927   if (stack_guard->IsInterrupted()) { | 897   if (stack_guard->IsInterrupted()) { | 
| 928     stack_guard->Continue(INTERRUPT); | 898     stack_guard->Continue(INTERRUPT); | 
| 929     return isolate->StackOverflow(); | 899     return isolate->StackOverflow(); | 
| 930   } | 900   } | 
| 931   return isolate->heap()->undefined_value(); | 901   return isolate->heap()->undefined_value(); | 
| 932 } | 902 } | 
| 933 | 903 | 
| 934 | 904 | 
| 935 } }  // namespace v8::internal | 905 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|