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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 UNREACHABLE(); | 803 UNREACHABLE(); |
804 return false; | 804 return false; |
805 } | 805 } |
806 } | 806 } |
807 | 807 |
808 if (!duplicate) *input_offset -= kPointerSize; | 808 if (!duplicate) *input_offset -= kPointerSize; |
809 return true; | 809 return true; |
810 } | 810 } |
811 | 811 |
812 | 812 |
| 813 void Deoptimizer::PatchStackCheckCode(Code* unoptimized_code, |
| 814 Code* check_code, |
| 815 Code* replacement_code) { |
| 816 // Iterate over the stack check table and patch every stack check |
| 817 // call to an unconditional call to the replacement code. |
| 818 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
| 819 Address stack_check_cursor = unoptimized_code->instruction_start() + |
| 820 unoptimized_code->stack_check_table_start(); |
| 821 uint32_t table_length = Memory::uint32_at(stack_check_cursor); |
| 822 stack_check_cursor += kIntSize; |
| 823 for (uint32_t i = 0; i < table_length; ++i) { |
| 824 uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); |
| 825 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
| 826 PatchStackCheckAt(pc_after, check_code, replacement_code); |
| 827 stack_check_cursor += 2 * kIntSize; |
| 828 } |
| 829 } |
| 830 |
| 831 |
813 unsigned Deoptimizer::ComputeInputFrameSize() const { | 832 unsigned Deoptimizer::ComputeInputFrameSize() const { |
814 unsigned fixed_size = ComputeFixedSize(function_); | 833 unsigned fixed_size = ComputeFixedSize(function_); |
815 // The fp-to-sp delta already takes the context and the function | 834 // The fp-to-sp delta already takes the context and the function |
816 // into account so we have to avoid double counting them (-2). | 835 // into account so we have to avoid double counting them (-2). |
817 unsigned result = fixed_size + fp_to_sp_delta_ - (2 * kPointerSize); | 836 unsigned result = fixed_size + fp_to_sp_delta_ - (2 * kPointerSize); |
818 #ifdef DEBUG | 837 #ifdef DEBUG |
819 if (bailout_type_ == OSR) { | 838 if (bailout_type_ == OSR) { |
820 // TODO(kasperl): It would be nice if we could verify that the | 839 // TODO(kasperl): It would be nice if we could verify that the |
821 // size matches with the stack height we can compute based on the | 840 // size matches with the stack height we can compute based on the |
822 // environment at the OSR entry. The code for that his built into | 841 // environment at the OSR entry. The code for that his built into |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 Deoptimizer::HandleWeakDeoptimizedCode); | 1157 Deoptimizer::HandleWeakDeoptimizedCode); |
1139 } | 1158 } |
1140 | 1159 |
1141 | 1160 |
1142 DeoptimizingCodeListNode::~DeoptimizingCodeListNode() { | 1161 DeoptimizingCodeListNode::~DeoptimizingCodeListNode() { |
1143 GlobalHandles::Destroy(reinterpret_cast<Object**>(code_.location())); | 1162 GlobalHandles::Destroy(reinterpret_cast<Object**>(code_.location())); |
1144 } | 1163 } |
1145 | 1164 |
1146 | 1165 |
1147 } } // namespace v8::internal | 1166 } } // namespace v8::internal |
OLD | NEW |