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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 // Iterate over the stack check table and patch every stack check | 816 // Iterate over the stack check table and patch every stack check |
817 // call to an unconditional call to the replacement code. | 817 // call to an unconditional call to the replacement code. |
818 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 818 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
819 Address stack_check_cursor = unoptimized_code->instruction_start() + | 819 Address stack_check_cursor = unoptimized_code->instruction_start() + |
820 unoptimized_code->stack_check_table_start(); | 820 unoptimized_code->stack_check_table_start(); |
821 uint32_t table_length = Memory::uint32_at(stack_check_cursor); | 821 uint32_t table_length = Memory::uint32_at(stack_check_cursor); |
822 stack_check_cursor += kIntSize; | 822 stack_check_cursor += kIntSize; |
823 for (uint32_t i = 0; i < table_length; ++i) { | 823 for (uint32_t i = 0; i < table_length; ++i) { |
824 uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); | 824 uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); |
825 Address pc_after = unoptimized_code->instruction_start() + pc_offset; | 825 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
826 PatchStackCheckAt(pc_after, check_code, replacement_code); | 826 PatchStackCheckCodeAt(pc_after, check_code, replacement_code); |
827 stack_check_cursor += 2 * kIntSize; | 827 stack_check_cursor += 2 * kIntSize; |
828 } | 828 } |
829 } | 829 } |
| 830 |
| 831 |
| 832 void Deoptimizer::RevertStackCheckCode(Code* unoptimized_code, |
| 833 Code* check_code, |
| 834 Code* replacement_code) { |
| 835 // Iterate over the stack check table and revert the patched |
| 836 // stack check calls. |
| 837 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
| 838 Address stack_check_cursor = unoptimized_code->instruction_start() + |
| 839 unoptimized_code->stack_check_table_start(); |
| 840 uint32_t table_length = Memory::uint32_at(stack_check_cursor); |
| 841 stack_check_cursor += kIntSize; |
| 842 for (uint32_t i = 0; i < table_length; ++i) { |
| 843 uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); |
| 844 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
| 845 RevertStackCheckCodeAt(pc_after, check_code, replacement_code); |
| 846 stack_check_cursor += 2 * kIntSize; |
| 847 } |
| 848 } |
830 | 849 |
831 | 850 |
832 unsigned Deoptimizer::ComputeInputFrameSize() const { | 851 unsigned Deoptimizer::ComputeInputFrameSize() const { |
833 unsigned fixed_size = ComputeFixedSize(function_); | 852 unsigned fixed_size = ComputeFixedSize(function_); |
834 // The fp-to-sp delta already takes the context and the function | 853 // The fp-to-sp delta already takes the context and the function |
835 // into account so we have to avoid double counting them (-2). | 854 // into account so we have to avoid double counting them (-2). |
836 unsigned result = fixed_size + fp_to_sp_delta_ - (2 * kPointerSize); | 855 unsigned result = fixed_size + fp_to_sp_delta_ - (2 * kPointerSize); |
837 #ifdef DEBUG | 856 #ifdef DEBUG |
838 if (bailout_type_ == OSR) { | 857 if (bailout_type_ == OSR) { |
839 // TODO(kasperl): It would be nice if we could verify that the | 858 // TODO(kasperl): It would be nice if we could verify that the |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 Deoptimizer::HandleWeakDeoptimizedCode); | 1176 Deoptimizer::HandleWeakDeoptimizedCode); |
1158 } | 1177 } |
1159 | 1178 |
1160 | 1179 |
1161 DeoptimizingCodeListNode::~DeoptimizingCodeListNode() { | 1180 DeoptimizingCodeListNode::~DeoptimizingCodeListNode() { |
1162 GlobalHandles::Destroy(reinterpret_cast<Object**>(code_.location())); | 1181 GlobalHandles::Destroy(reinterpret_cast<Object**>(code_.location())); |
1163 } | 1182 } |
1164 | 1183 |
1165 | 1184 |
1166 } } // namespace v8::internal | 1185 } } // namespace v8::internal |
OLD | NEW |