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 8693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8704 succeeded = false; | 8704 succeeded = false; |
8705 } | 8705 } |
8706 } | 8706 } |
8707 | 8707 |
8708 // Revert to the original stack checks in the original unoptimized code. | 8708 // Revert to the original stack checks in the original unoptimized code. |
8709 if (FLAG_trace_osr) { | 8709 if (FLAG_trace_osr) { |
8710 PrintF("[restoring original stack checks in "); | 8710 PrintF("[restoring original stack checks in "); |
8711 function->PrintName(); | 8711 function->PrintName(); |
8712 PrintF("]\n"); | 8712 PrintF("]\n"); |
8713 } | 8713 } |
8714 StackCheckStub check_stub; | 8714 Handle<Code> check_code; |
8715 Handle<Code> check_code = check_stub.GetCode(); | 8715 if (FLAG_count_based_interrupts) { |
| 8716 InterruptStub interrupt_stub; |
| 8717 check_code = interrupt_stub.GetCode(); |
| 8718 } else { |
| 8719 StackCheckStub check_stub; |
| 8720 check_code = check_stub.GetCode(); |
| 8721 } |
8716 Handle<Code> replacement_code = isolate->builtins()->OnStackReplacement(); | 8722 Handle<Code> replacement_code = isolate->builtins()->OnStackReplacement(); |
8717 Deoptimizer::RevertStackCheckCode(*unoptimized, | 8723 Deoptimizer::RevertStackCheckCode(*unoptimized, |
8718 *check_code, | 8724 *check_code, |
8719 *replacement_code); | 8725 *replacement_code); |
8720 | 8726 |
8721 // Allow OSR only at nesting level zero again. | 8727 // Allow OSR only at nesting level zero again. |
8722 unoptimized->set_allow_osr_at_loop_nesting_level(0); | 8728 unoptimized->set_allow_osr_at_loop_nesting_level(0); |
8723 | 8729 |
8724 // If the optimization attempt succeeded, return the AST id tagged as a | 8730 // If the optimization attempt succeeded, return the AST id tagged as a |
8725 // smi. This tells the builtin that we need to translate the unoptimized | 8731 // smi. This tells the builtin that we need to translate the unoptimized |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9259 // First check if this is a real stack overflow. | 9265 // First check if this is a real stack overflow. |
9260 if (isolate->stack_guard()->IsStackOverflow()) { | 9266 if (isolate->stack_guard()->IsStackOverflow()) { |
9261 NoHandleAllocation na; | 9267 NoHandleAllocation na; |
9262 return isolate->StackOverflow(); | 9268 return isolate->StackOverflow(); |
9263 } | 9269 } |
9264 | 9270 |
9265 return Execution::HandleStackGuardInterrupt(); | 9271 return Execution::HandleStackGuardInterrupt(); |
9266 } | 9272 } |
9267 | 9273 |
9268 | 9274 |
| 9275 RUNTIME_FUNCTION(MaybeObject*, Runtime_Interrupt) { |
| 9276 ASSERT(args.length() == 0); |
| 9277 return Execution::HandleStackGuardInterrupt(); |
| 9278 } |
| 9279 |
| 9280 |
9269 static int StackSize() { | 9281 static int StackSize() { |
9270 int n = 0; | 9282 int n = 0; |
9271 for (JavaScriptFrameIterator it; !it.done(); it.Advance()) n++; | 9283 for (JavaScriptFrameIterator it; !it.done(); it.Advance()) n++; |
9272 return n; | 9284 return n; |
9273 } | 9285 } |
9274 | 9286 |
9275 | 9287 |
9276 static void PrintTransition(Object* result) { | 9288 static void PrintTransition(Object* result) { |
9277 // indentation | 9289 // indentation |
9278 { const int nmax = 80; | 9290 { const int nmax = 80; |
(...skipping 4378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13657 // Handle last resort GC and make sure to allow future allocations | 13669 // Handle last resort GC and make sure to allow future allocations |
13658 // to grow the heap without causing GCs (if possible). | 13670 // to grow the heap without causing GCs (if possible). |
13659 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13671 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13660 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13672 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13661 "Runtime::PerformGC"); | 13673 "Runtime::PerformGC"); |
13662 } | 13674 } |
13663 } | 13675 } |
13664 | 13676 |
13665 | 13677 |
13666 } } // namespace v8::internal | 13678 } } // namespace v8::internal |
OLD | NEW |