| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/gdb-jit.h" | 5 #include "src/gdb-jit.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT)) | 649 (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT)) |
| 650 const uint8_t ident[16] = | 650 const uint8_t ident[16] = |
| 651 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 651 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 652 #elif(V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT) || \ | 652 #elif(V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT) || \ |
| 653 (V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN) | 653 (V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN) |
| 654 const uint8_t ident[16] = | 654 const uint8_t ident[16] = |
| 655 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 655 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 656 #elif V8_TARGET_ARCH_PPC64 && V8_TARGET_BIG_ENDIAN && V8_OS_LINUX | 656 #elif V8_TARGET_ARCH_PPC64 && V8_TARGET_BIG_ENDIAN && V8_OS_LINUX |
| 657 const uint8_t ident[16] = {0x7f, 'E', 'L', 'F', 2, 2, 1, 0, | 657 const uint8_t ident[16] = {0x7f, 'E', 'L', 'F', 2, 2, 1, 0, |
| 658 0, 0, 0, 0, 0, 0, 0, 0}; | 658 0, 0, 0, 0, 0, 0, 0, 0}; |
| 659 #elif V8_TARGET_ARCH_S390X |
| 660 const uint8_t ident[16] = {0x7f, 'E', 'L', 'F', 2, 2, 1, 3, |
| 661 0, 0, 0, 0, 0, 0, 0, 0}; |
| 662 #elif V8_TARGET_ARCH_S390 |
| 663 const uint8_t ident[16] = {0x7f, 'E', 'L', 'F', 1, 2, 1, 3, |
| 664 0, 0, 0, 0, 0, 0, 0, 0}; |
| 659 #else | 665 #else |
| 660 #error Unsupported target architecture. | 666 #error Unsupported target architecture. |
| 661 #endif | 667 #endif |
| 662 memcpy(header->ident, ident, 16); | 668 memcpy(header->ident, ident, 16); |
| 663 header->type = 1; | 669 header->type = 1; |
| 664 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 | 670 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
| 665 header->machine = 3; | 671 header->machine = 3; |
| 666 #elif V8_TARGET_ARCH_X64 | 672 #elif V8_TARGET_ARCH_X64 |
| 667 // Processor identification value for x64 is 62 as defined in | 673 // Processor identification value for x64 is 62 as defined in |
| 668 // System V ABI, AMD64 Supplement | 674 // System V ABI, AMD64 Supplement |
| 669 // http://www.x86-64.org/documentation/abi.pdf | 675 // http://www.x86-64.org/documentation/abi.pdf |
| 670 header->machine = 62; | 676 header->machine = 62; |
| 671 #elif V8_TARGET_ARCH_ARM | 677 #elif V8_TARGET_ARCH_ARM |
| 672 // Set to EM_ARM, defined as 40, in "ARM ELF File Format" at | 678 // Set to EM_ARM, defined as 40, in "ARM ELF File Format" at |
| 673 // infocenter.arm.com/help/topic/com.arm.doc.dui0101a/DUI0101A_Elf.pdf | 679 // infocenter.arm.com/help/topic/com.arm.doc.dui0101a/DUI0101A_Elf.pdf |
| 674 header->machine = 40; | 680 header->machine = 40; |
| 675 #elif V8_TARGET_ARCH_PPC64 && V8_OS_LINUX | 681 #elif V8_TARGET_ARCH_PPC64 && V8_OS_LINUX |
| 676 // Set to EM_PPC64, defined as 21, in Power ABI, | 682 // Set to EM_PPC64, defined as 21, in Power ABI, |
| 677 // Join the next 4 lines, omitting the spaces and double-slashes. | 683 // Join the next 4 lines, omitting the spaces and double-slashes. |
| 678 // https://www-03.ibm.com/technologyconnect/tgcm/TGCMFileServlet.wss/ | 684 // https://www-03.ibm.com/technologyconnect/tgcm/TGCMFileServlet.wss/ |
| 679 // ABI64BitOpenPOWERv1.1_16July2015_pub.pdf? | 685 // ABI64BitOpenPOWERv1.1_16July2015_pub.pdf? |
| 680 // id=B81AEC1A37F5DAF185257C3E004E8845&linkid=1n0000&c_t= | 686 // id=B81AEC1A37F5DAF185257C3E004E8845&linkid=1n0000&c_t= |
| 681 // c9xw7v5dzsj7gt1ifgf4cjbcnskqptmr | 687 // c9xw7v5dzsj7gt1ifgf4cjbcnskqptmr |
| 682 header->machine = 21; | 688 header->machine = 21; |
| 689 #elif V8_TARGET_ARCH_S390 |
| 690 // Processor identification value is 22 (EM_S390) as defined in the ABI: |
| 691 // http://refspecs.linuxbase.org/ELF/zSeries/lzsabi0_s390.html#AEN1691 |
| 692 // http://refspecs.linuxbase.org/ELF/zSeries/lzsabi0_zSeries.html#AEN1599 |
| 693 header->machine = 22; |
| 683 #else | 694 #else |
| 684 #error Unsupported target architecture. | 695 #error Unsupported target architecture. |
| 685 #endif | 696 #endif |
| 686 header->version = 1; | 697 header->version = 1; |
| 687 header->entry = 0; | 698 header->entry = 0; |
| 688 header->pht_offset = 0; | 699 header->pht_offset = 0; |
| 689 header->sht_offset = sizeof(ELFHeader); // Section table follows header. | 700 header->sht_offset = sizeof(ELFHeader); // Section table follows header. |
| 690 header->flags = 0; | 701 header->flags = 0; |
| 691 header->header_size = sizeof(ELFHeader); | 702 header->header_size = sizeof(ELFHeader); |
| 692 header->pht_entry_size = 0; | 703 header->pht_entry_size = 0; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 size(size), | 776 size(size), |
| 766 info((binding << 4) | type), | 777 info((binding << 4) | type), |
| 767 other(0), | 778 other(0), |
| 768 section(section) { | 779 section(section) { |
| 769 } | 780 } |
| 770 | 781 |
| 771 Binding binding() const { | 782 Binding binding() const { |
| 772 return static_cast<Binding>(info >> 4); | 783 return static_cast<Binding>(info >> 4); |
| 773 } | 784 } |
| 774 #if (V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X87 || \ | 785 #if (V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X87 || \ |
| 775 (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT)) | 786 (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT) || \ |
| 787 (V8_TARGET_ARCH_S390 && V8_TARGET_ARCH_32_BIT)) |
| 776 struct SerializedLayout { | 788 struct SerializedLayout { |
| 777 SerializedLayout(uint32_t name, | 789 SerializedLayout(uint32_t name, |
| 778 uintptr_t value, | 790 uintptr_t value, |
| 779 uintptr_t size, | 791 uintptr_t size, |
| 780 Binding binding, | 792 Binding binding, |
| 781 Type type, | 793 Type type, |
| 782 uint16_t section) | 794 uint16_t section) |
| 783 : name(name), | 795 : name(name), |
| 784 value(value), | 796 value(value), |
| 785 size(size), | 797 size(size), |
| 786 info((binding << 4) | type), | 798 info((binding << 4) | type), |
| 787 other(0), | 799 other(0), |
| 788 section(section) { | 800 section(section) { |
| 789 } | 801 } |
| 790 | 802 |
| 791 uint32_t name; | 803 uint32_t name; |
| 792 uintptr_t value; | 804 uintptr_t value; |
| 793 uintptr_t size; | 805 uintptr_t size; |
| 794 uint8_t info; | 806 uint8_t info; |
| 795 uint8_t other; | 807 uint8_t other; |
| 796 uint16_t section; | 808 uint16_t section; |
| 797 }; | 809 }; |
| 798 #elif(V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT) || \ | 810 #elif(V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT) || \ |
| 799 (V8_TARGET_ARCH_PPC64 && V8_OS_LINUX) | 811 (V8_TARGET_ARCH_PPC64 && V8_OS_LINUX) || V8_TARGET_ARCH_S390X |
| 800 struct SerializedLayout { | 812 struct SerializedLayout { |
| 801 SerializedLayout(uint32_t name, | 813 SerializedLayout(uint32_t name, |
| 802 uintptr_t value, | 814 uintptr_t value, |
| 803 uintptr_t size, | 815 uintptr_t size, |
| 804 Binding binding, | 816 Binding binding, |
| 805 Type type, | 817 Type type, |
| 806 uint16_t section) | 818 uint16_t section) |
| 807 : name(name), | 819 : name(name), |
| 808 info((binding << 4) | type), | 820 info((binding << 4) | type), |
| 809 other(0), | 821 other(0), |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 #elif V8_TARGET_ARCH_X64 | 1150 #elif V8_TARGET_ARCH_X64 |
| 1139 w->Write<uint8_t>(DW_OP_reg6); // and here on x64. | 1151 w->Write<uint8_t>(DW_OP_reg6); // and here on x64. |
| 1140 #elif V8_TARGET_ARCH_ARM | 1152 #elif V8_TARGET_ARCH_ARM |
| 1141 UNIMPLEMENTED(); | 1153 UNIMPLEMENTED(); |
| 1142 #elif V8_TARGET_ARCH_MIPS | 1154 #elif V8_TARGET_ARCH_MIPS |
| 1143 UNIMPLEMENTED(); | 1155 UNIMPLEMENTED(); |
| 1144 #elif V8_TARGET_ARCH_MIPS64 | 1156 #elif V8_TARGET_ARCH_MIPS64 |
| 1145 UNIMPLEMENTED(); | 1157 UNIMPLEMENTED(); |
| 1146 #elif V8_TARGET_ARCH_PPC64 && V8_OS_LINUX | 1158 #elif V8_TARGET_ARCH_PPC64 && V8_OS_LINUX |
| 1147 w->Write<uint8_t>(DW_OP_reg31); // The frame pointer is here on PPC64. | 1159 w->Write<uint8_t>(DW_OP_reg31); // The frame pointer is here on PPC64. |
| 1160 #elif V8_TARGET_ARCH_S390 |
| 1161 w->Write<uint8_t>(DW_OP_reg11); // The frame pointer's here on S390. |
| 1148 #else | 1162 #else |
| 1149 #error Unsupported target architecture. | 1163 #error Unsupported target architecture. |
| 1150 #endif | 1164 #endif |
| 1151 fb_block_size.set(static_cast<uint32_t>(w->position() - fb_block_start)); | 1165 fb_block_size.set(static_cast<uint32_t>(w->position() - fb_block_start)); |
| 1152 | 1166 |
| 1153 int params = scope->ParameterCount(); | 1167 int params = scope->ParameterCount(); |
| 1154 int slots = scope->StackLocalCount(); | 1168 int slots = scope->StackLocalCount(); |
| 1155 int context_slots = scope->ContextLocalCount(); | 1169 int context_slots = scope->ContextLocalCount(); |
| 1156 // The real slot ID is internal_slots + context_slot_id. | 1170 // The real slot ID is internal_slots + context_slot_id. |
| 1157 int internal_slots = Context::MIN_CONTEXT_SLOTS; | 1171 int internal_slots = Context::MIN_CONTEXT_SLOTS; |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data); | 2210 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data); |
| 2197 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info); | 2211 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info); |
| 2198 break; | 2212 break; |
| 2199 } | 2213 } |
| 2200 } | 2214 } |
| 2201 } | 2215 } |
| 2202 #endif | 2216 #endif |
| 2203 } // namespace GDBJITInterface | 2217 } // namespace GDBJITInterface |
| 2204 } // namespace internal | 2218 } // namespace internal |
| 2205 } // namespace v8 | 2219 } // namespace v8 |
| OLD | NEW |