OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 6926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6937 // Revert to the original stack checks in the original unoptimized code. | 6937 // Revert to the original stack checks in the original unoptimized code. |
6938 if (FLAG_trace_osr) { | 6938 if (FLAG_trace_osr) { |
6939 PrintF("[restoring original stack checks in "); | 6939 PrintF("[restoring original stack checks in "); |
6940 function->PrintName(); | 6940 function->PrintName(); |
6941 PrintF("]\n"); | 6941 PrintF("]\n"); |
6942 } | 6942 } |
6943 StackCheckStub check_stub; | 6943 StackCheckStub check_stub; |
6944 Handle<Code> check_code = check_stub.GetCode(); | 6944 Handle<Code> check_code = check_stub.GetCode(); |
6945 Handle<Code> replacement_code( | 6945 Handle<Code> replacement_code( |
6946 Builtins::builtin(Builtins::OnStackReplacement)); | 6946 Builtins::builtin(Builtins::OnStackReplacement)); |
6947 // Iterate the unoptimized code and revert all the patched stack checks. | 6947 Deoptimizer::RevertStackCheckCode(*unoptimized, |
6948 for (RelocIterator it(*unoptimized, RelocInfo::kCodeTargetMask); | 6948 *check_code, |
6949 !it.done(); | 6949 *replacement_code); |
6950 it.next()) { | |
6951 RelocInfo* rinfo = it.rinfo(); | |
6952 if (rinfo->target_address() == replacement_code->entry()) { | |
6953 Deoptimizer::RevertStackCheckCode(rinfo, *check_code); | |
6954 } | |
6955 } | |
6956 | 6950 |
6957 // Allow OSR only at nesting level zero again. | 6951 // Allow OSR only at nesting level zero again. |
6958 unoptimized->set_allow_osr_at_loop_nesting_level(0); | 6952 unoptimized->set_allow_osr_at_loop_nesting_level(0); |
6959 | 6953 |
6960 // If the optimization attempt succeeded, return the AST id tagged as a | 6954 // If the optimization attempt succeeded, return the AST id tagged as a |
6961 // smi. This tells the builtin that we need to translate the unoptimized | 6955 // smi. This tells the builtin that we need to translate the unoptimized |
6962 // frame to an optimized one. | 6956 // frame to an optimized one. |
6963 if (succeeded) { | 6957 if (succeeded) { |
6964 ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION); | 6958 ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION); |
6965 return Smi::FromInt(ast_id); | 6959 return Smi::FromInt(ast_id); |
(...skipping 3914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10880 } else { | 10874 } else { |
10881 // Handle last resort GC and make sure to allow future allocations | 10875 // Handle last resort GC and make sure to allow future allocations |
10882 // to grow the heap without causing GCs (if possible). | 10876 // to grow the heap without causing GCs (if possible). |
10883 Counters::gc_last_resort_from_js.Increment(); | 10877 Counters::gc_last_resort_from_js.Increment(); |
10884 Heap::CollectAllGarbage(false); | 10878 Heap::CollectAllGarbage(false); |
10885 } | 10879 } |
10886 } | 10880 } |
10887 | 10881 |
10888 | 10882 |
10889 } } // namespace v8::internal | 10883 } } // namespace v8::internal |
OLD | NEW |