| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 return true; | 1805 return true; |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 | 1808 |
| 1809 void Deoptimizer::PatchStackCheckCode(Code* unoptimized_code, | 1809 void Deoptimizer::PatchStackCheckCode(Code* unoptimized_code, |
| 1810 Code* check_code, | 1810 Code* check_code, |
| 1811 Code* replacement_code) { | 1811 Code* replacement_code) { |
| 1812 // Iterate over the stack check table and patch every stack check | 1812 // Iterate over the stack check table and patch every stack check |
| 1813 // call to an unconditional call to the replacement code. | 1813 // call to an unconditional call to the replacement code. |
| 1814 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 1814 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
| 1815 ASSERT(!unoptimized_code->stack_check_patched_for_osr()); |
| 1815 Address stack_check_cursor = unoptimized_code->instruction_start() + | 1816 Address stack_check_cursor = unoptimized_code->instruction_start() + |
| 1816 unoptimized_code->stack_check_table_offset(); | 1817 unoptimized_code->stack_check_table_offset(); |
| 1817 uint32_t table_length = Memory::uint32_at(stack_check_cursor); | 1818 uint32_t table_length = Memory::uint32_at(stack_check_cursor); |
| 1818 stack_check_cursor += kIntSize; | 1819 stack_check_cursor += kIntSize; |
| 1819 for (uint32_t i = 0; i < table_length; ++i) { | 1820 for (uint32_t i = 0; i < table_length; ++i) { |
| 1820 uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); | 1821 uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); |
| 1821 Address pc_after = unoptimized_code->instruction_start() + pc_offset; | 1822 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
| 1822 PatchStackCheckCodeAt(unoptimized_code, | 1823 PatchStackCheckCodeAt(unoptimized_code, |
| 1823 pc_after, | 1824 pc_after, |
| 1824 check_code, | 1825 check_code, |
| 1825 replacement_code); | 1826 replacement_code); |
| 1826 stack_check_cursor += 2 * kIntSize; | 1827 stack_check_cursor += 2 * kIntSize; |
| 1827 } | 1828 } |
| 1829 unoptimized_code->set_stack_check_patched_for_osr(true); |
| 1828 } | 1830 } |
| 1829 | 1831 |
| 1830 | 1832 |
| 1831 void Deoptimizer::RevertStackCheckCode(Code* unoptimized_code, | 1833 void Deoptimizer::RevertStackCheckCode(Code* unoptimized_code, |
| 1832 Code* check_code, | 1834 Code* check_code, |
| 1833 Code* replacement_code) { | 1835 Code* replacement_code) { |
| 1834 // Iterate over the stack check table and revert the patched | 1836 // Iterate over the stack check table and revert the patched |
| 1835 // stack check calls. | 1837 // stack check calls. |
| 1836 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 1838 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
| 1839 ASSERT(unoptimized_code->stack_check_patched_for_osr()); |
| 1837 Address stack_check_cursor = unoptimized_code->instruction_start() + | 1840 Address stack_check_cursor = unoptimized_code->instruction_start() + |
| 1838 unoptimized_code->stack_check_table_offset(); | 1841 unoptimized_code->stack_check_table_offset(); |
| 1839 uint32_t table_length = Memory::uint32_at(stack_check_cursor); | 1842 uint32_t table_length = Memory::uint32_at(stack_check_cursor); |
| 1840 stack_check_cursor += kIntSize; | 1843 stack_check_cursor += kIntSize; |
| 1841 for (uint32_t i = 0; i < table_length; ++i) { | 1844 for (uint32_t i = 0; i < table_length; ++i) { |
| 1842 uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); | 1845 uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); |
| 1843 Address pc_after = unoptimized_code->instruction_start() + pc_offset; | 1846 Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
| 1844 RevertStackCheckCodeAt(unoptimized_code, | 1847 RevertStackCheckCodeAt(unoptimized_code, |
| 1845 pc_after, | 1848 pc_after, |
| 1846 check_code, | 1849 check_code, |
| 1847 replacement_code); | 1850 replacement_code); |
| 1848 stack_check_cursor += 2 * kIntSize; | 1851 stack_check_cursor += 2 * kIntSize; |
| 1849 } | 1852 } |
| 1853 unoptimized_code->set_stack_check_patched_for_osr(false); |
| 1850 } | 1854 } |
| 1851 | 1855 |
| 1852 | 1856 |
| 1853 unsigned Deoptimizer::ComputeInputFrameSize() const { | 1857 unsigned Deoptimizer::ComputeInputFrameSize() const { |
| 1854 unsigned fixed_size = ComputeFixedSize(function_); | 1858 unsigned fixed_size = ComputeFixedSize(function_); |
| 1855 // The fp-to-sp delta already takes the context and the function | 1859 // The fp-to-sp delta already takes the context and the function |
| 1856 // into account so we have to avoid double counting them (-2). | 1860 // into account so we have to avoid double counting them (-2). |
| 1857 unsigned result = fixed_size + fp_to_sp_delta_ - (2 * kPointerSize); | 1861 unsigned result = fixed_size + fp_to_sp_delta_ - (2 * kPointerSize); |
| 1858 #ifdef DEBUG | 1862 #ifdef DEBUG |
| 1859 if (bailout_type_ == OSR) { | 1863 if (bailout_type_ == OSR) { |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2499 | 2503 |
| 2500 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 2504 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 2501 v->VisitPointer(BitCast<Object**>(&function_)); | 2505 v->VisitPointer(BitCast<Object**>(&function_)); |
| 2502 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 2506 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 2503 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 2507 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 2504 } | 2508 } |
| 2505 | 2509 |
| 2506 #endif // ENABLE_DEBUGGER_SUPPORT | 2510 #endif // ENABLE_DEBUGGER_SUPPORT |
| 2507 | 2511 |
| 2508 } } // namespace v8::internal | 2512 } } // namespace v8::internal |
| OLD | NEW |