| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 } | 423 } |
| 424 | 424 |
| 425 | 425 |
| 426 void StackGuard::TerminateExecution() { | 426 void StackGuard::TerminateExecution() { |
| 427 ExecutionAccess access(isolate_); | 427 ExecutionAccess access(isolate_); |
| 428 thread_local_.interrupt_flags_ |= TERMINATE; | 428 thread_local_.interrupt_flags_ |= TERMINATE; |
| 429 set_interrupt_limits(access); | 429 set_interrupt_limits(access); |
| 430 } | 430 } |
| 431 | 431 |
| 432 | 432 |
| 433 bool StackGuard::IsRuntimeProfilerTick() { | |
| 434 ExecutionAccess access(isolate_); | |
| 435 return (thread_local_.interrupt_flags_ & RUNTIME_PROFILER_TICK) != 0; | |
| 436 } | |
| 437 | |
| 438 | |
| 439 void StackGuard::RequestRuntimeProfilerTick() { | |
| 440 // Ignore calls if we're not optimizing or if we can't get the lock. | |
| 441 if (FLAG_opt && ExecutionAccess::TryLock(isolate_)) { | |
| 442 thread_local_.interrupt_flags_ |= RUNTIME_PROFILER_TICK; | |
| 443 if (thread_local_.postpone_interrupts_nesting_ == 0) { | |
| 444 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; | |
| 445 isolate_->heap()->SetStackLimits(); | |
| 446 } | |
| 447 ExecutionAccess::Unlock(isolate_); | |
| 448 } | |
| 449 } | |
| 450 | |
| 451 | |
| 452 void StackGuard::RequestCodeReadyEvent() { | 433 void StackGuard::RequestCodeReadyEvent() { |
| 453 ASSERT(FLAG_parallel_recompilation); | 434 ASSERT(FLAG_parallel_recompilation); |
| 454 if (ExecutionAccess::TryLock(isolate_)) { | 435 if (ExecutionAccess::TryLock(isolate_)) { |
| 455 thread_local_.interrupt_flags_ |= CODE_READY; | 436 thread_local_.interrupt_flags_ |= CODE_READY; |
| 456 if (thread_local_.postpone_interrupts_nesting_ == 0) { | 437 if (thread_local_.postpone_interrupts_nesting_ == 0) { |
| 457 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; | 438 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; |
| 458 isolate_->heap()->SetStackLimits(); | 439 isolate_->heap()->SetStackLimits(); |
| 459 } | 440 } |
| 460 ExecutionAccess::Unlock(isolate_); | 441 ExecutionAccess::Unlock(isolate_); |
| 461 } | 442 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 PrintF(" ** CODE_READY event received.\n"); | 920 PrintF(" ** CODE_READY event received.\n"); |
| 940 } | 921 } |
| 941 stack_guard->Continue(CODE_READY); | 922 stack_guard->Continue(CODE_READY); |
| 942 } | 923 } |
| 943 if (!stack_guard->IsTerminateExecution() && | 924 if (!stack_guard->IsTerminateExecution() && |
| 944 !FLAG_manual_parallel_recompilation) { | 925 !FLAG_manual_parallel_recompilation) { |
| 945 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 926 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
| 946 } | 927 } |
| 947 | 928 |
| 948 isolate->counters()->stack_interrupts()->Increment(); | 929 isolate->counters()->stack_interrupts()->Increment(); |
| 949 // If FLAG_count_based_interrupts, every interrupt is a profiler interrupt. | 930 isolate->counters()->runtime_profiler_ticks()->Increment(); |
| 950 if (FLAG_count_based_interrupts || | 931 stack_guard->Continue(RUNTIME_PROFILER_TICK); |
| 951 stack_guard->IsRuntimeProfilerTick()) { | 932 isolate->runtime_profiler()->OptimizeNow(); |
| 952 isolate->counters()->runtime_profiler_ticks()->Increment(); | |
| 953 stack_guard->Continue(RUNTIME_PROFILER_TICK); | |
| 954 isolate->runtime_profiler()->OptimizeNow(); | |
| 955 } | |
| 956 #ifdef ENABLE_DEBUGGER_SUPPORT | 933 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 957 if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { | 934 if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { |
| 958 DebugBreakHelper(); | 935 DebugBreakHelper(); |
| 959 } | 936 } |
| 960 #endif | 937 #endif |
| 961 if (stack_guard->IsPreempted()) RuntimePreempt(); | 938 if (stack_guard->IsPreempted()) RuntimePreempt(); |
| 962 if (stack_guard->IsTerminateExecution()) { | 939 if (stack_guard->IsTerminateExecution()) { |
| 963 stack_guard->Continue(TERMINATE); | 940 stack_guard->Continue(TERMINATE); |
| 964 return isolate->TerminateExecution(); | 941 return isolate->TerminateExecution(); |
| 965 } | 942 } |
| 966 if (stack_guard->IsInterrupted()) { | 943 if (stack_guard->IsInterrupted()) { |
| 967 stack_guard->Continue(INTERRUPT); | 944 stack_guard->Continue(INTERRUPT); |
| 968 return isolate->StackOverflow(); | 945 return isolate->StackOverflow(); |
| 969 } | 946 } |
| 970 return isolate->heap()->undefined_value(); | 947 return isolate->heap()->undefined_value(); |
| 971 } | 948 } |
| 972 | 949 |
| 973 | 950 |
| 974 } } // namespace v8::internal | 951 } } // namespace v8::internal |
| OLD | NEW |