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

Side by Side Diff: src/debug.cc

Issue 11574027: Use direct jump and call instruction for X64 when the deoptimization entries are in the code range (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years 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
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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 1880
1881 Handle<Code> new_code(function->shared()->code()); 1881 Handle<Code> new_code(function->shared()->code());
1882 if (new_code->kind() != Code::FUNCTION || 1882 if (new_code->kind() != Code::FUNCTION ||
1883 !new_code->has_debug_break_slots()) { 1883 !new_code->has_debug_break_slots()) {
1884 continue; 1884 continue;
1885 } 1885 }
1886 1886
1887 // Iterate over the RelocInfo in the original code to compute the sum of the 1887 // Iterate over the RelocInfo in the original code to compute the sum of the
1888 // constant pools sizes. (See Assembler::CheckConstPool()) 1888 // constant pools sizes. (See Assembler::CheckConstPool())
1889 // Note that this is only useful for architectures using constant pools. 1889 // Note that this is only useful for architectures using constant pools.
1890 int frame_const_pool_size = 0;
1891 #if !defined(V8_TARGET_ARCH_X64)
1890 int constpool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL); 1892 int constpool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL);
1891 int frame_const_pool_size = 0;
1892 for (RelocIterator it(*frame_code, constpool_mask); !it.done(); it.next()) { 1893 for (RelocIterator it(*frame_code, constpool_mask); !it.done(); it.next()) {
1893 RelocInfo* info = it.rinfo(); 1894 RelocInfo* info = it.rinfo();
1894 if (info->pc() >= frame->pc()) break; 1895 if (info->pc() >= frame->pc()) break;
1895 frame_const_pool_size += static_cast<int>(info->data()); 1896 frame_const_pool_size += static_cast<int>(info->data());
1896 } 1897 }
1898 #endif
1897 intptr_t frame_offset = 1899 intptr_t frame_offset =
1898 frame->pc() - frame_code->instruction_start() - frame_const_pool_size; 1900 frame->pc() - frame_code->instruction_start() - frame_const_pool_size;
1899 1901
1900 // Iterate over the RelocInfo for new code to find the number of bytes 1902 // Iterate over the RelocInfo for new code to find the number of bytes
1901 // generated for debug slots and constant pools. 1903 // generated for debug slots and constant pools.
1902 int debug_break_slot_bytes = 0; 1904 int debug_break_slot_bytes = 0;
1903 int new_code_const_pool_size = 0; 1905 int new_code_const_pool_size = 0;
1906 #if !defined(V8_TARGET_ARCH_X64)
1904 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | 1907 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) |
1905 RelocInfo::ModeMask(RelocInfo::CONST_POOL); 1908 RelocInfo::ModeMask(RelocInfo::CONST_POOL);
1909 #else
1910 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT);
1911 #endif
1906 for (RelocIterator it(*new_code, mask); !it.done(); it.next()) { 1912 for (RelocIterator it(*new_code, mask); !it.done(); it.next()) {
1907 // Check if the pc in the new code with debug break 1913 // Check if the pc in the new code with debug break
1908 // slots is before this slot. 1914 // slots is before this slot.
1909 RelocInfo* info = it.rinfo(); 1915 RelocInfo* info = it.rinfo();
1910 intptr_t new_offset = info->pc() - new_code->instruction_start() - 1916 intptr_t new_offset = info->pc() - new_code->instruction_start() -
1911 new_code_const_pool_size - debug_break_slot_bytes; 1917 new_code_const_pool_size - debug_break_slot_bytes;
1912 if (new_offset >= frame_offset) { 1918 if (new_offset >= frame_offset) {
1913 break; 1919 break;
1914 } 1920 }
1915 1921
1916 if (RelocInfo::IsDebugBreakSlot(info->rmode())) { 1922 if (RelocInfo::IsDebugBreakSlot(info->rmode())) {
1917 debug_break_slot_bytes += Assembler::kDebugBreakSlotLength; 1923 debug_break_slot_bytes += Assembler::kDebugBreakSlotLength;
1924 #if !defined(V8_TARGET_ARCH_X64)
1918 } else { 1925 } else {
1919 ASSERT(RelocInfo::IsConstPool(info->rmode())); 1926 ASSERT(RelocInfo::IsConstPool(info->rmode()));
1920 // The size of the constant pool is encoded in the data. 1927 // The size of the constant pool is encoded in the data.
1921 new_code_const_pool_size += static_cast<int>(info->data()); 1928 new_code_const_pool_size += static_cast<int>(info->data());
1929 #endif
1922 } 1930 }
1923 } 1931 }
1924 1932
1925 // Compute the equivalent pc in the new code. 1933 // Compute the equivalent pc in the new code.
1926 byte* new_pc = new_code->instruction_start() + frame_offset + 1934 byte* new_pc = new_code->instruction_start() + frame_offset +
1927 debug_break_slot_bytes + new_code_const_pool_size; 1935 debug_break_slot_bytes + new_code_const_pool_size;
1928 1936
1929 if (FLAG_trace_deopt) { 1937 if (FLAG_trace_deopt) {
1930 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " 1938 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) "
1931 "with %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) " 1939 "with %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) "
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after
3773 { 3781 {
3774 Locker locker; 3782 Locker locker;
3775 Isolate::Current()->debugger()->CallMessageDispatchHandler(); 3783 Isolate::Current()->debugger()->CallMessageDispatchHandler();
3776 } 3784 }
3777 } 3785 }
3778 } 3786 }
3779 3787
3780 #endif // ENABLE_DEBUGGER_SUPPORT 3788 #endif // ENABLE_DEBUGGER_SUPPORT
3781 3789
3782 } } // namespace v8::internal 3790 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698