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

Side by Side Diff: src/debug.cc

Issue 188253005: A64: Record the size of veneer pools for code offset mapping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added pool size test and register size only with debugger support Created 6 years, 9 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/cctest/test-assembler-a64.cc » ('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 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 Handle<Code> frame_code(frame->LookupCode()); 1892 Handle<Code> frame_code(frame->LookupCode());
1893 if (frame_code->has_debug_break_slots()) continue; 1893 if (frame_code->has_debug_break_slots()) continue;
1894 1894
1895 Handle<Code> new_code(function->shared()->code()); 1895 Handle<Code> new_code(function->shared()->code());
1896 if (new_code->kind() != Code::FUNCTION || 1896 if (new_code->kind() != Code::FUNCTION ||
1897 !new_code->has_debug_break_slots()) { 1897 !new_code->has_debug_break_slots()) {
1898 continue; 1898 continue;
1899 } 1899 }
1900 1900
1901 // Iterate over the RelocInfo in the original code to compute the sum of the 1901 // Iterate over the RelocInfo in the original code to compute the sum of the
1902 // constant pools sizes. (See Assembler::CheckConstPool()) 1902 // constant pools and veneer pools sizes. (See Assembler::CheckConstPool()
1903 // Note that this is only useful for architectures using constant pools. 1903 // and Assembler::CheckVeneerPool())
1904 int constpool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL); 1904 // Note that this is only useful for architectures using constant pools or
1905 int frame_const_pool_size = 0; 1905 // veneer pools.
1906 for (RelocIterator it(*frame_code, constpool_mask); !it.done(); it.next()) { 1906 int pool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL) |
1907 RelocInfo::ModeMask(RelocInfo::VENEER_POOL);
1908 int frame_pool_size = 0;
1909 for (RelocIterator it(*frame_code, pool_mask); !it.done(); it.next()) {
1907 RelocInfo* info = it.rinfo(); 1910 RelocInfo* info = it.rinfo();
1908 if (info->pc() >= frame->pc()) break; 1911 if (info->pc() >= frame->pc()) break;
1909 frame_const_pool_size += static_cast<int>(info->data()); 1912 frame_pool_size += static_cast<int>(info->data());
1910 } 1913 }
1911 intptr_t frame_offset = 1914 intptr_t frame_offset =
1912 frame->pc() - frame_code->instruction_start() - frame_const_pool_size; 1915 frame->pc() - frame_code->instruction_start() - frame_pool_size;
1913 1916
1914 // Iterate over the RelocInfo for new code to find the number of bytes 1917 // Iterate over the RelocInfo for new code to find the number of bytes
1915 // generated for debug slots and constant pools. 1918 // generated for debug slots and constant pools.
1916 int debug_break_slot_bytes = 0; 1919 int debug_break_slot_bytes = 0;
1917 int new_code_const_pool_size = 0; 1920 int new_code_pool_size = 0;
1918 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | 1921 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) |
1919 RelocInfo::ModeMask(RelocInfo::CONST_POOL); 1922 RelocInfo::ModeMask(RelocInfo::CONST_POOL) |
1923 RelocInfo::ModeMask(RelocInfo::VENEER_POOL);
1920 for (RelocIterator it(*new_code, mask); !it.done(); it.next()) { 1924 for (RelocIterator it(*new_code, mask); !it.done(); it.next()) {
1921 // Check if the pc in the new code with debug break 1925 // Check if the pc in the new code with debug break
1922 // slots is before this slot. 1926 // slots is before this slot.
1923 RelocInfo* info = it.rinfo(); 1927 RelocInfo* info = it.rinfo();
1924 intptr_t new_offset = info->pc() - new_code->instruction_start() - 1928 intptr_t new_offset = info->pc() - new_code->instruction_start() -
1925 new_code_const_pool_size - debug_break_slot_bytes; 1929 new_code_pool_size - debug_break_slot_bytes;
1926 if (new_offset >= frame_offset) { 1930 if (new_offset >= frame_offset) {
1927 break; 1931 break;
1928 } 1932 }
1929 1933
1930 if (RelocInfo::IsDebugBreakSlot(info->rmode())) { 1934 if (RelocInfo::IsDebugBreakSlot(info->rmode())) {
1931 debug_break_slot_bytes += Assembler::kDebugBreakSlotLength; 1935 debug_break_slot_bytes += Assembler::kDebugBreakSlotLength;
1932 } else { 1936 } else {
1933 ASSERT(RelocInfo::IsConstPool(info->rmode())); 1937 ASSERT(RelocInfo::IsConstPool(info->rmode()));
1934 // The size of the constant pool is encoded in the data. 1938 // The size of the pools is encoded in the data.
1935 new_code_const_pool_size += static_cast<int>(info->data()); 1939 new_code_pool_size += static_cast<int>(info->data());
1936 } 1940 }
1937 } 1941 }
1938 1942
1939 // Compute the equivalent pc in the new code. 1943 // Compute the equivalent pc in the new code.
1940 byte* new_pc = new_code->instruction_start() + frame_offset + 1944 byte* new_pc = new_code->instruction_start() + frame_offset +
1941 debug_break_slot_bytes + new_code_const_pool_size; 1945 debug_break_slot_bytes + new_code_pool_size;
1942 1946
1943 if (FLAG_trace_deopt) { 1947 if (FLAG_trace_deopt) {
1944 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " 1948 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) "
1945 "with %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " 1949 "with %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) "
1946 "for debugging, " 1950 "for debugging, "
1947 "changing pc from %08" V8PRIxPTR " to %08" V8PRIxPTR "\n", 1951 "changing pc from %08" V8PRIxPTR " to %08" V8PRIxPTR "\n",
1948 reinterpret_cast<intptr_t>( 1952 reinterpret_cast<intptr_t>(
1949 frame_code->instruction_start()), 1953 frame_code->instruction_start()),
1950 reinterpret_cast<intptr_t>( 1954 reinterpret_cast<intptr_t>(
1951 frame_code->instruction_start()) + 1955 frame_code->instruction_start()) +
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after
3803 { 3807 {
3804 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); 3808 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_));
3805 isolate_->debugger()->CallMessageDispatchHandler(); 3809 isolate_->debugger()->CallMessageDispatchHandler();
3806 } 3810 }
3807 } 3811 }
3808 } 3812 }
3809 3813
3810 #endif // ENABLE_DEBUGGER_SUPPORT 3814 #endif // ENABLE_DEBUGGER_SUPPORT
3811 3815
3812 } } // namespace v8::internal 3816 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | test/cctest/test-assembler-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698