| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 Handle<Code> frame_code(frame->LookupCode()); | 1893 Handle<Code> frame_code(frame->LookupCode()); |
| 1894 if (frame_code->has_debug_break_slots()) continue; | 1894 if (frame_code->has_debug_break_slots()) continue; |
| 1895 | 1895 |
| 1896 Handle<Code> new_code(function->shared()->code()); | 1896 Handle<Code> new_code(function->shared()->code()); |
| 1897 if (new_code->kind() != Code::FUNCTION || | 1897 if (new_code->kind() != Code::FUNCTION || |
| 1898 !new_code->has_debug_break_slots()) { | 1898 !new_code->has_debug_break_slots()) { |
| 1899 continue; | 1899 continue; |
| 1900 } | 1900 } |
| 1901 | 1901 |
| 1902 // Iterate over the RelocInfo in the original code to compute the sum of the | 1902 // Iterate over the RelocInfo in the original code to compute the sum of the |
| 1903 // constant pools sizes. (See Assembler::CheckConstPool()) | 1903 // constant pools and veneer pools sizes. (See Assembler::CheckConstPool() |
| 1904 // Note that this is only useful for architectures using constant pools. | 1904 // and Assembler::CheckVeneerPool()) |
| 1905 int constpool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL); | 1905 // Note that this is only useful for architectures using constant pools or |
| 1906 int frame_const_pool_size = 0; | 1906 // veneer pools. |
| 1907 for (RelocIterator it(*frame_code, constpool_mask); !it.done(); it.next()) { | 1907 int pool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL) | |
| 1908 RelocInfo::ModeMask(RelocInfo::VENEER_POOL); |
| 1909 int frame_pool_size = 0; |
| 1910 for (RelocIterator it(*frame_code, pool_mask); !it.done(); it.next()) { |
| 1908 RelocInfo* info = it.rinfo(); | 1911 RelocInfo* info = it.rinfo(); |
| 1909 if (info->pc() >= frame->pc()) break; | 1912 if (info->pc() >= frame->pc()) break; |
| 1910 frame_const_pool_size += static_cast<int>(info->data()); | 1913 frame_pool_size += static_cast<int>(info->data()); |
| 1911 } | 1914 } |
| 1912 intptr_t frame_offset = | 1915 intptr_t frame_offset = |
| 1913 frame->pc() - frame_code->instruction_start() - frame_const_pool_size; | 1916 frame->pc() - frame_code->instruction_start() - frame_pool_size; |
| 1914 | 1917 |
| 1915 // Iterate over the RelocInfo for new code to find the number of bytes | 1918 // Iterate over the RelocInfo for new code to find the number of bytes |
| 1916 // generated for debug slots and constant pools. | 1919 // generated for debug slots and constant pools. |
| 1917 int debug_break_slot_bytes = 0; | 1920 int debug_break_slot_bytes = 0; |
| 1918 int new_code_const_pool_size = 0; | 1921 int new_code_pool_size = 0; |
| 1919 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 1922 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
| 1920 RelocInfo::ModeMask(RelocInfo::CONST_POOL); | 1923 RelocInfo::ModeMask(RelocInfo::CONST_POOL) | |
| 1924 RelocInfo::ModeMask(RelocInfo::VENEER_POOL); |
| 1921 for (RelocIterator it(*new_code, mask); !it.done(); it.next()) { | 1925 for (RelocIterator it(*new_code, mask); !it.done(); it.next()) { |
| 1922 // Check if the pc in the new code with debug break | 1926 // Check if the pc in the new code with debug break |
| 1923 // slots is before this slot. | 1927 // slots is before this slot. |
| 1924 RelocInfo* info = it.rinfo(); | 1928 RelocInfo* info = it.rinfo(); |
| 1925 intptr_t new_offset = info->pc() - new_code->instruction_start() - | 1929 intptr_t new_offset = info->pc() - new_code->instruction_start() - |
| 1926 new_code_const_pool_size - debug_break_slot_bytes; | 1930 new_code_pool_size - debug_break_slot_bytes; |
| 1927 if (new_offset >= frame_offset) { | 1931 if (new_offset >= frame_offset) { |
| 1928 break; | 1932 break; |
| 1929 } | 1933 } |
| 1930 | 1934 |
| 1931 if (RelocInfo::IsDebugBreakSlot(info->rmode())) { | 1935 if (RelocInfo::IsDebugBreakSlot(info->rmode())) { |
| 1932 debug_break_slot_bytes += Assembler::kDebugBreakSlotLength; | 1936 debug_break_slot_bytes += Assembler::kDebugBreakSlotLength; |
| 1933 } else { | 1937 } else { |
| 1934 ASSERT(RelocInfo::IsConstPool(info->rmode())); | 1938 ASSERT(RelocInfo::IsConstPool(info->rmode())); |
| 1935 // The size of the constant pool is encoded in the data. | 1939 // The size of the pools is encoded in the data. |
| 1936 new_code_const_pool_size += static_cast<int>(info->data()); | 1940 new_code_pool_size += static_cast<int>(info->data()); |
| 1937 } | 1941 } |
| 1938 } | 1942 } |
| 1939 | 1943 |
| 1940 // Compute the equivalent pc in the new code. | 1944 // Compute the equivalent pc in the new code. |
| 1941 byte* new_pc = new_code->instruction_start() + frame_offset + | 1945 byte* new_pc = new_code->instruction_start() + frame_offset + |
| 1942 debug_break_slot_bytes + new_code_const_pool_size; | 1946 debug_break_slot_bytes + new_code_pool_size; |
| 1943 | 1947 |
| 1944 if (FLAG_trace_deopt) { | 1948 if (FLAG_trace_deopt) { |
| 1945 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " | 1949 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " |
| 1946 "with %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " | 1950 "with %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " |
| 1947 "for debugging, " | 1951 "for debugging, " |
| 1948 "changing pc from %08" V8PRIxPTR " to %08" V8PRIxPTR "\n", | 1952 "changing pc from %08" V8PRIxPTR " to %08" V8PRIxPTR "\n", |
| 1949 reinterpret_cast<intptr_t>( | 1953 reinterpret_cast<intptr_t>( |
| 1950 frame_code->instruction_start()), | 1954 frame_code->instruction_start()), |
| 1951 reinterpret_cast<intptr_t>( | 1955 reinterpret_cast<intptr_t>( |
| 1952 frame_code->instruction_start()) + | 1956 frame_code->instruction_start()) + |
| (...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3804 { | 3808 { |
| 3805 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3809 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
| 3806 isolate_->debugger()->CallMessageDispatchHandler(); | 3810 isolate_->debugger()->CallMessageDispatchHandler(); |
| 3807 } | 3811 } |
| 3808 } | 3812 } |
| 3809 } | 3813 } |
| 3810 | 3814 |
| 3811 #endif // ENABLE_DEBUGGER_SUPPORT | 3815 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3812 | 3816 |
| 3813 } } // namespace v8::internal | 3817 } } // namespace v8::internal |
| OLD | NEW |