Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: src/debug.cc

Issue 10449047: ARM: Fix literal pool handling for breakpoints in debugger.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/assembler.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 1861
1862 Handle<Code> frame_code(frame->LookupCode()); 1862 Handle<Code> frame_code(frame->LookupCode());
1863 if (frame_code->has_debug_break_slots()) continue; 1863 if (frame_code->has_debug_break_slots()) continue;
1864 1864
1865 Handle<Code> new_code(function->shared()->code()); 1865 Handle<Code> new_code(function->shared()->code());
1866 if (new_code->kind() != Code::FUNCTION || 1866 if (new_code->kind() != Code::FUNCTION ||
1867 !new_code->has_debug_break_slots()) { 1867 !new_code->has_debug_break_slots()) {
1868 continue; 1868 continue;
1869 } 1869 }
1870 1870
1871 intptr_t delta = frame->pc() - frame_code->instruction_start(); 1871 // Iterate over the RelocInfo in the original code to compute the sum of the
1872 int debug_break_slot_count = 0; 1872 // constant pools sizes. (See Assembler::CheckConstPool())
1873 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT); 1873 // Note that this is only useful for architectures using constant pools.
1874 int constpool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL);
1875 int frame_const_pool_size = 0;
1876 for (RelocIterator it(*frame_code, constpool_mask); !it.done(); it.next()) {
1877 RelocInfo* info = it.rinfo();
1878 if (info->pc() >= frame->pc()) break;
1879 frame_const_pool_size += info->data();
1880 }
1881 intptr_t frame_offset =
1882 frame->pc() - frame_code->instruction_start() - frame_const_pool_size;
1883
1884 // Iterate over the RelocInfo for new code to find the number of bytes
1885 // generated for debug slots and constant pools.
1886 int debug_break_slot_bytes = 0;
1887 int new_code_const_pool_size = 0;
1888 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) |
1889 RelocInfo::ModeMask(RelocInfo::CONST_POOL);
1874 for (RelocIterator it(*new_code, mask); !it.done(); it.next()) { 1890 for (RelocIterator it(*new_code, mask); !it.done(); it.next()) {
1875 // Check if the pc in the new code with debug break 1891 // Check if the pc in the new code with debug break
1876 // slots is before this slot. 1892 // slots is before this slot.
1877 RelocInfo* info = it.rinfo(); 1893 RelocInfo* info = it.rinfo();
1878 int debug_break_slot_bytes = 1894 intptr_t new_offset = info->pc() - new_code->instruction_start() -
1879 debug_break_slot_count * Assembler::kDebugBreakSlotLength; 1895 new_code_const_pool_size - debug_break_slot_bytes;
1880 intptr_t new_delta = 1896 if (new_offset >= frame_offset) {
1881 info->pc() -
1882 new_code->instruction_start() -
1883 debug_break_slot_bytes;
1884 if (new_delta > delta) {
1885 break; 1897 break;
1886 } 1898 }
1887 1899
1888 // Passed a debug break slot in the full code with debug 1900 if (RelocInfo::IsDebugBreakSlot(info->rmode())) {
1889 // break slots. 1901 debug_break_slot_bytes += Assembler::kDebugBreakSlotLength;
1890 debug_break_slot_count++; 1902 } else {
1903 ASSERT(RelocInfo::IsConstPool(info->rmode()));
1904 // The size of the constant pool is encoded in the data.
1905 new_code_const_pool_size += info->data();
1906 }
1891 } 1907 }
1892 int debug_break_slot_bytes = 1908
1893 debug_break_slot_count * Assembler::kDebugBreakSlotLength; 1909 // Compute the equivalent pc in the new code.
1910 byte* new_pc = new_code->instruction_start() + frame_offset +
1911 debug_break_slot_bytes + new_code_const_pool_size;
1912
1894 if (FLAG_trace_deopt) { 1913 if (FLAG_trace_deopt) {
1895 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " 1914 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) "
1896 "with %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " 1915 "with %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) "
1897 "for debugging, " 1916 "for debugging, "
1898 "changing pc from %08" V8PRIxPTR " to %08" V8PRIxPTR "\n", 1917 "changing pc from %08" V8PRIxPTR " to %08" V8PRIxPTR "\n",
1899 reinterpret_cast<intptr_t>( 1918 reinterpret_cast<intptr_t>(
1900 frame_code->instruction_start()), 1919 frame_code->instruction_start()),
1901 reinterpret_cast<intptr_t>( 1920 reinterpret_cast<intptr_t>(
1902 frame_code->instruction_start()) + 1921 frame_code->instruction_start()) +
1903 frame_code->instruction_size(), 1922 frame_code->instruction_size(),
1904 frame_code->instruction_size(), 1923 frame_code->instruction_size(),
1905 reinterpret_cast<intptr_t>(new_code->instruction_start()), 1924 reinterpret_cast<intptr_t>(new_code->instruction_start()),
1906 reinterpret_cast<intptr_t>(new_code->instruction_start()) + 1925 reinterpret_cast<intptr_t>(new_code->instruction_start()) +
1907 new_code->instruction_size(), 1926 new_code->instruction_size(),
1908 new_code->instruction_size(), 1927 new_code->instruction_size(),
1909 reinterpret_cast<intptr_t>(frame->pc()), 1928 reinterpret_cast<intptr_t>(frame->pc()),
1910 reinterpret_cast<intptr_t>(new_code->instruction_start()) + 1929 reinterpret_cast<intptr_t>(new_pc));
1911 delta + debug_break_slot_bytes);
1912 } 1930 }
1913 1931
1914 // Patch the return address to return into the code with 1932 // Patch the return address to return into the code with
1915 // debug break slots. 1933 // debug break slots.
1916 frame->set_pc( 1934 frame->set_pc(new_pc);
1917 new_code->instruction_start() + delta + debug_break_slot_bytes);
1918 } 1935 }
1919 } 1936 }
1920 1937
1921 1938
1922 class ActiveFunctionsCollector : public ThreadVisitor { 1939 class ActiveFunctionsCollector : public ThreadVisitor {
1923 public: 1940 public:
1924 explicit ActiveFunctionsCollector(List<Handle<JSFunction> >* active_functions, 1941 explicit ActiveFunctionsCollector(List<Handle<JSFunction> >* active_functions,
1925 Object* active_code_marker) 1942 Object* active_code_marker)
1926 : active_functions_(active_functions), 1943 : active_functions_(active_functions),
1927 active_code_marker_(active_code_marker) { } 1944 active_code_marker_(active_code_marker) { }
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
3621 { 3638 {
3622 Locker locker; 3639 Locker locker;
3623 Isolate::Current()->debugger()->CallMessageDispatchHandler(); 3640 Isolate::Current()->debugger()->CallMessageDispatchHandler();
3624 } 3641 }
3625 } 3642 }
3626 } 3643 }
3627 3644
3628 #endif // ENABLE_DEBUGGER_SUPPORT 3645 #endif // ENABLE_DEBUGGER_SUPPORT
3629 3646
3630 } } // namespace v8::internal 3647 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698