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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 } | 810 } |
811 | 811 |
812 | 812 |
813 void Deoptimizer::PatchStackCheckCode(Code* unoptimized_code, | 813 void Deoptimizer::PatchStackCheckCode(Code* unoptimized_code, |
814 Code* check_code, | 814 Code* check_code, |
815 Code* replacement_code) { | 815 Code* replacement_code) { |
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_offset(); |
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 PatchStackCheckCodeAt(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 | 830 |
831 | 831 |
832 void Deoptimizer::RevertStackCheckCode(Code* unoptimized_code, | 832 void Deoptimizer::RevertStackCheckCode(Code* unoptimized_code, |
833 Code* check_code, | 833 Code* check_code, |
834 Code* replacement_code) { | 834 Code* replacement_code) { |
835 // Iterate over the stack check table and revert the patched | 835 // Iterate over the stack check table and revert the patched |
836 // stack check calls. | 836 // stack check calls. |
837 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 837 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
838 Address stack_check_cursor = unoptimized_code->instruction_start() + | 838 Address stack_check_cursor = unoptimized_code->instruction_start() + |
839 unoptimized_code->stack_check_table_start(); | 839 unoptimized_code->stack_check_table_offset(); |
840 uint32_t table_length = Memory::uint32_at(stack_check_cursor); | 840 uint32_t table_length = Memory::uint32_at(stack_check_cursor); |
841 stack_check_cursor += kIntSize; | 841 stack_check_cursor += kIntSize; |
842 for (uint32_t i = 0; i < table_length; ++i) { | 842 for (uint32_t i = 0; i < table_length; ++i) { |
843 uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); | 843 uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); |
844 Address pc_after = unoptimized_code->instruction_start() + pc_offset; | 844 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
845 RevertStackCheckCodeAt(pc_after, check_code, replacement_code); | 845 RevertStackCheckCodeAt(pc_after, check_code, replacement_code); |
846 stack_check_cursor += 2 * kIntSize; | 846 stack_check_cursor += 2 * kIntSize; |
847 } | 847 } |
848 } | 848 } |
849 | 849 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 Deoptimizer::HandleWeakDeoptimizedCode); | 1176 Deoptimizer::HandleWeakDeoptimizedCode); |
1177 } | 1177 } |
1178 | 1178 |
1179 | 1179 |
1180 DeoptimizingCodeListNode::~DeoptimizingCodeListNode() { | 1180 DeoptimizingCodeListNode::~DeoptimizingCodeListNode() { |
1181 GlobalHandles::Destroy(reinterpret_cast<Object**>(code_.location())); | 1181 GlobalHandles::Destroy(reinterpret_cast<Object**>(code_.location())); |
1182 } | 1182 } |
1183 | 1183 |
1184 | 1184 |
1185 } } // namespace v8::internal | 1185 } } // namespace v8::internal |
OLD | NEW |