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 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 } | 1869 } |
1870 | 1870 |
1871 // Iterate over the RelocInfo in the original code to compute the sum of the | 1871 // Iterate over the RelocInfo in the original code to compute the sum of the |
1872 // constant pools sizes. (See Assembler::CheckConstPool()) | 1872 // constant pools sizes. (See Assembler::CheckConstPool()) |
1873 // Note that this is only useful for architectures using constant pools. | 1873 // Note that this is only useful for architectures using constant pools. |
1874 int constpool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL); | 1874 int constpool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL); |
1875 int frame_const_pool_size = 0; | 1875 int frame_const_pool_size = 0; |
1876 for (RelocIterator it(*frame_code, constpool_mask); !it.done(); it.next()) { | 1876 for (RelocIterator it(*frame_code, constpool_mask); !it.done(); it.next()) { |
1877 RelocInfo* info = it.rinfo(); | 1877 RelocInfo* info = it.rinfo(); |
1878 if (info->pc() >= frame->pc()) break; | 1878 if (info->pc() >= frame->pc()) break; |
1879 frame_const_pool_size += info->data(); | 1879 frame_const_pool_size += static_cast<int>(info->data()); |
1880 } | 1880 } |
1881 intptr_t frame_offset = | 1881 intptr_t frame_offset = |
1882 frame->pc() - frame_code->instruction_start() - frame_const_pool_size; | 1882 frame->pc() - frame_code->instruction_start() - frame_const_pool_size; |
1883 | 1883 |
1884 // Iterate over the RelocInfo for new code to find the number of bytes | 1884 // Iterate over the RelocInfo for new code to find the number of bytes |
1885 // generated for debug slots and constant pools. | 1885 // generated for debug slots and constant pools. |
1886 int debug_break_slot_bytes = 0; | 1886 int debug_break_slot_bytes = 0; |
1887 int new_code_const_pool_size = 0; | 1887 int new_code_const_pool_size = 0; |
1888 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 1888 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
1889 RelocInfo::ModeMask(RelocInfo::CONST_POOL); | 1889 RelocInfo::ModeMask(RelocInfo::CONST_POOL); |
1890 for (RelocIterator it(*new_code, mask); !it.done(); it.next()) { | 1890 for (RelocIterator it(*new_code, mask); !it.done(); it.next()) { |
1891 // Check if the pc in the new code with debug break | 1891 // Check if the pc in the new code with debug break |
1892 // slots is before this slot. | 1892 // slots is before this slot. |
1893 RelocInfo* info = it.rinfo(); | 1893 RelocInfo* info = it.rinfo(); |
1894 intptr_t new_offset = info->pc() - new_code->instruction_start() - | 1894 intptr_t new_offset = info->pc() - new_code->instruction_start() - |
1895 new_code_const_pool_size - debug_break_slot_bytes; | 1895 new_code_const_pool_size - debug_break_slot_bytes; |
1896 if (new_offset >= frame_offset) { | 1896 if (new_offset >= frame_offset) { |
1897 break; | 1897 break; |
1898 } | 1898 } |
1899 | 1899 |
1900 if (RelocInfo::IsDebugBreakSlot(info->rmode())) { | 1900 if (RelocInfo::IsDebugBreakSlot(info->rmode())) { |
1901 debug_break_slot_bytes += Assembler::kDebugBreakSlotLength; | 1901 debug_break_slot_bytes += Assembler::kDebugBreakSlotLength; |
1902 } else { | 1902 } else { |
1903 ASSERT(RelocInfo::IsConstPool(info->rmode())); | 1903 ASSERT(RelocInfo::IsConstPool(info->rmode())); |
1904 // The size of the constant pool is encoded in the data. | 1904 // The size of the constant pool is encoded in the data. |
1905 new_code_const_pool_size += info->data(); | 1905 new_code_const_pool_size += static_cast<int>(info->data()); |
1906 } | 1906 } |
1907 } | 1907 } |
1908 | 1908 |
1909 // Compute the equivalent pc in the new code. | 1909 // Compute the equivalent pc in the new code. |
1910 byte* new_pc = new_code->instruction_start() + frame_offset + | 1910 byte* new_pc = new_code->instruction_start() + frame_offset + |
1911 debug_break_slot_bytes + new_code_const_pool_size; | 1911 debug_break_slot_bytes + new_code_const_pool_size; |
1912 | 1912 |
1913 if (FLAG_trace_deopt) { | 1913 if (FLAG_trace_deopt) { |
1914 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " | 1914 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " |
1915 "with %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " | 1915 "with %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " |
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3638 { | 3638 { |
3639 Locker locker; | 3639 Locker locker; |
3640 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3640 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
3641 } | 3641 } |
3642 } | 3642 } |
3643 } | 3643 } |
3644 | 3644 |
3645 #endif // ENABLE_DEBUGGER_SUPPORT | 3645 #endif // ENABLE_DEBUGGER_SUPPORT |
3646 | 3646 |
3647 } } // namespace v8::internal | 3647 } } // namespace v8::internal |
OLD | NEW |