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 15 matching lines...) Expand all Loading... |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 | 29 |
30 #include "v8.h" | 30 #include "v8.h" |
31 | 31 |
32 #include "api.h" | 32 #include "api.h" |
33 #include "bootstrapper.h" | 33 #include "bootstrapper.h" |
34 #include "codegen.h" | 34 #include "codegen.h" |
35 #include "debug.h" | 35 #include "debug.h" |
| 36 #include "deoptimizer.h" |
36 #include "isolate-inl.h" | 37 #include "isolate-inl.h" |
37 #include "runtime-profiler.h" | 38 #include "runtime-profiler.h" |
38 #include "simulator.h" | 39 #include "simulator.h" |
39 #include "v8threads.h" | 40 #include "v8threads.h" |
40 #include "vm-state-inl.h" | 41 #include "vm-state-inl.h" |
41 | 42 |
42 namespace v8 { | 43 namespace v8 { |
43 namespace internal { | 44 namespace internal { |
44 | 45 |
45 | 46 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 void StackGuard::RequestGC() { | 442 void StackGuard::RequestGC() { |
442 ExecutionAccess access(isolate_); | 443 ExecutionAccess access(isolate_); |
443 thread_local_.interrupt_flags_ |= GC_REQUEST; | 444 thread_local_.interrupt_flags_ |= GC_REQUEST; |
444 if (thread_local_.postpone_interrupts_nesting_ == 0) { | 445 if (thread_local_.postpone_interrupts_nesting_ == 0) { |
445 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; | 446 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; |
446 isolate_->heap()->SetStackLimits(); | 447 isolate_->heap()->SetStackLimits(); |
447 } | 448 } |
448 } | 449 } |
449 | 450 |
450 | 451 |
| 452 bool StackGuard::IsFullDeopt() { |
| 453 ExecutionAccess access(isolate_); |
| 454 return (thread_local_.interrupt_flags_ & FULL_DEOPT) != 0; |
| 455 } |
| 456 |
| 457 |
| 458 void StackGuard::FullDeopt() { |
| 459 ExecutionAccess access(isolate_); |
| 460 thread_local_.interrupt_flags_ |= FULL_DEOPT; |
| 461 set_interrupt_limits(access); |
| 462 } |
| 463 |
| 464 |
451 #ifdef ENABLE_DEBUGGER_SUPPORT | 465 #ifdef ENABLE_DEBUGGER_SUPPORT |
452 bool StackGuard::IsDebugBreak() { | 466 bool StackGuard::IsDebugBreak() { |
453 ExecutionAccess access(isolate_); | 467 ExecutionAccess access(isolate_); |
454 return thread_local_.interrupt_flags_ & DEBUGBREAK; | 468 return thread_local_.interrupt_flags_ & DEBUGBREAK; |
455 } | 469 } |
456 | 470 |
457 | 471 |
458 void StackGuard::DebugBreak() { | 472 void StackGuard::DebugBreak() { |
459 ExecutionAccess access(isolate_); | 473 ExecutionAccess access(isolate_); |
460 thread_local_.interrupt_flags_ |= DEBUGBREAK; | 474 thread_local_.interrupt_flags_ |= DEBUGBREAK; |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 if (stack_guard->ShouldPostponeInterrupts()) { | 887 if (stack_guard->ShouldPostponeInterrupts()) { |
874 return isolate->heap()->undefined_value(); | 888 return isolate->heap()->undefined_value(); |
875 } | 889 } |
876 | 890 |
877 if (stack_guard->IsGCRequest()) { | 891 if (stack_guard->IsGCRequest()) { |
878 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 892 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
879 "StackGuard GC request"); | 893 "StackGuard GC request"); |
880 stack_guard->Continue(GC_REQUEST); | 894 stack_guard->Continue(GC_REQUEST); |
881 } | 895 } |
882 | 896 |
883 | |
884 isolate->counters()->stack_interrupts()->Increment(); | 897 isolate->counters()->stack_interrupts()->Increment(); |
885 isolate->counters()->runtime_profiler_ticks()->Increment(); | 898 isolate->counters()->runtime_profiler_ticks()->Increment(); |
886 isolate->runtime_profiler()->OptimizeNow(); | 899 isolate->runtime_profiler()->OptimizeNow(); |
887 #ifdef ENABLE_DEBUGGER_SUPPORT | 900 #ifdef ENABLE_DEBUGGER_SUPPORT |
888 if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { | 901 if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { |
889 DebugBreakHelper(); | 902 DebugBreakHelper(); |
890 } | 903 } |
891 #endif | 904 #endif |
892 if (stack_guard->IsPreempted()) RuntimePreempt(); | 905 if (stack_guard->IsPreempted()) RuntimePreempt(); |
893 if (stack_guard->IsTerminateExecution()) { | 906 if (stack_guard->IsTerminateExecution()) { |
894 stack_guard->Continue(TERMINATE); | 907 stack_guard->Continue(TERMINATE); |
895 return isolate->TerminateExecution(); | 908 return isolate->TerminateExecution(); |
896 } | 909 } |
897 if (stack_guard->IsInterrupted()) { | 910 if (stack_guard->IsInterrupted()) { |
898 stack_guard->Continue(INTERRUPT); | 911 stack_guard->Continue(INTERRUPT); |
899 return isolate->StackOverflow(); | 912 return isolate->StackOverflow(); |
900 } | 913 } |
| 914 if (stack_guard->IsFullDeopt()) { |
| 915 stack_guard->Continue(FULL_DEOPT); |
| 916 Deoptimizer::DeoptimizeAll(isolate); |
| 917 } |
901 return isolate->heap()->undefined_value(); | 918 return isolate->heap()->undefined_value(); |
902 } | 919 } |
903 | 920 |
904 | 921 |
905 } } // namespace v8::internal | 922 } } // namespace v8::internal |
OLD | NEW |