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

Side by Side Diff: src/gdb-jit.cc

Issue 1252913007: Enable gdb-jit for PPC64 on Linux (both big-endian and little-endian). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « build/standalone.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/v8.h" 5 #include "src/v8.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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 uintptr_t addr, 386 uintptr_t addr,
387 uintptr_t offset, 387 uintptr_t offset,
388 uintptr_t size, 388 uintptr_t size,
389 uintptr_t flags) 389 uintptr_t flags)
390 : ELFSection(name, type, align), 390 : ELFSection(name, type, align),
391 addr_(addr), 391 addr_(addr),
392 offset_(offset), 392 offset_(offset),
393 size_(size), 393 size_(size),
394 flags_(flags) { } 394 flags_(flags) { }
395 395
396
Jakob Kummerow 2015/08/03 16:03:36 nit: why this change?
396 protected: 397 protected:
397 virtual void PopulateHeader(Writer::Slot<Header> header) { 398 virtual void PopulateHeader(Writer::Slot<Header> header) {
398 ELFSection::PopulateHeader(header); 399 ELFSection::PopulateHeader(header);
399 header->address = addr_; 400 header->address = addr_;
400 header->offset = offset_; 401 header->offset = offset_;
401 header->size = size_; 402 header->size = size_;
402 header->flags = flags_; 403 header->flags = flags_;
403 } 404 }
404 405
405 private: 406 private:
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 }; 643 };
643 644
644 645
645 void WriteHeader(Writer* w) { 646 void WriteHeader(Writer* w) {
646 DCHECK(w->position() == 0); 647 DCHECK(w->position() == 0);
647 Writer::Slot<ELFHeader> header = w->CreateSlotHere<ELFHeader>(); 648 Writer::Slot<ELFHeader> header = w->CreateSlotHere<ELFHeader>();
648 #if (V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X87 || \ 649 #if (V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X87 || \
649 (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT)) 650 (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT))
650 const uint8_t ident[16] = 651 const uint8_t ident[16] =
651 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 652 { 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 653 #elif(V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT) || \
654 (V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN)
653 const uint8_t ident[16] = 655 const uint8_t ident[16] =
654 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 656 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
657 #elif V8_TARGET_ARCH_PPC64 && V8_TARGET_BIG_ENDIAN && V8_OS_LINUX
658 const uint8_t ident[16] = {0x7f, 'E', 'L', 'F', 2, 2, 1, 0,
659 0, 0, 0, 0, 0, 0, 0, 0};
655 #else 660 #else
656 #error Unsupported target architecture. 661 #error Unsupported target architecture.
657 #endif 662 #endif
658 memcpy(header->ident, ident, 16); 663 memcpy(header->ident, ident, 16);
659 header->type = 1; 664 header->type = 1;
660 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 665 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
661 header->machine = 3; 666 header->machine = 3;
662 #elif V8_TARGET_ARCH_X64 667 #elif V8_TARGET_ARCH_X64
663 // Processor identification value for x64 is 62 as defined in 668 // Processor identification value for x64 is 62 as defined in
664 // System V ABI, AMD64 Supplement 669 // System V ABI, AMD64 Supplement
665 // http://www.x86-64.org/documentation/abi.pdf 670 // http://www.x86-64.org/documentation/abi.pdf
666 header->machine = 62; 671 header->machine = 62;
667 #elif V8_TARGET_ARCH_ARM 672 #elif V8_TARGET_ARCH_ARM
668 // Set to EM_ARM, defined as 40, in "ARM ELF File Format" at 673 // Set to EM_ARM, defined as 40, in "ARM ELF File Format" at
669 // infocenter.arm.com/help/topic/com.arm.doc.dui0101a/DUI0101A_Elf.pdf 674 // infocenter.arm.com/help/topic/com.arm.doc.dui0101a/DUI0101A_Elf.pdf
670 header->machine = 40; 675 header->machine = 40;
676 #elif V8_TARGET_ARCH_PPC64 && V8_OS_LINUX
677 // Set to EM_PPC64, defined as 21, in Power ABI,
678 // Join the next 4 lines, omitting the spaces and double-slashes.
Jakob Kummerow 2015/08/03 16:03:36 Links are exempt from the 80-col policy; however t
679 // https://www-03.ibm.com/technologyconnect/tgcm/TGCMFileServlet.wss/
680 // ABI64BitOpenPOWERv1.1_16July2015_pub.pdf?
681 // id=B81AEC1A37F5DAF185257C3E004E8845&linkid=1n0000&c_t=
682 // c9xw7v5dzsj7gt1ifgf4cjbcnskqptmr
683 header->machine = 21;
671 #else 684 #else
672 #error Unsupported target architecture. 685 #error Unsupported target architecture.
673 #endif 686 #endif
674 header->version = 1; 687 header->version = 1;
675 header->entry = 0; 688 header->entry = 0;
676 header->pht_offset = 0; 689 header->pht_offset = 0;
677 header->sht_offset = sizeof(ELFHeader); // Section table follows header. 690 header->sht_offset = sizeof(ELFHeader); // Section table follows header.
678 header->flags = 0; 691 header->flags = 0;
679 header->header_size = sizeof(ELFHeader); 692 header->header_size = sizeof(ELFHeader);
680 header->pht_entry_size = 0; 693 header->pht_entry_size = 0;
681 header->pht_entry_num = 0; 694 header->pht_entry_num = 0;
682 header->sht_entry_size = sizeof(ELFSection::Header); 695 header->sht_entry_size = sizeof(ELFSection::Header);
683 header->sht_entry_num = sections_.length(); 696 header->sht_entry_num = sections_.length();
684 header->sht_strtab_index = 1; 697 header->sht_strtab_index = 1;
685 } 698 }
686 699
700
Jakob Kummerow 2015/08/03 16:03:36 nit: why this change?
687 void WriteSectionTable(Writer* w) { 701 void WriteSectionTable(Writer* w) {
688 // Section headers table immediately follows file header. 702 // Section headers table immediately follows file header.
689 DCHECK(w->position() == sizeof(ELFHeader)); 703 DCHECK(w->position() == sizeof(ELFHeader));
690 704
691 Writer::Slot<ELFSection::Header> headers = 705 Writer::Slot<ELFSection::Header> headers =
692 w->CreateSlotsHere<ELFSection::Header>(sections_.length()); 706 w->CreateSlotsHere<ELFSection::Header>(sections_.length());
693 707
694 // String table for section table is the first section. 708 // String table for section table is the first section.
695 ELFStringTable* strtab = static_cast<ELFStringTable*>(SectionAt(1)); 709 ELFStringTable* strtab = static_cast<ELFStringTable*>(SectionAt(1));
696 strtab->AttachWriter(w); 710 strtab->AttachWriter(w);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 section(section) { 790 section(section) {
777 } 791 }
778 792
779 uint32_t name; 793 uint32_t name;
780 uintptr_t value; 794 uintptr_t value;
781 uintptr_t size; 795 uintptr_t size;
782 uint8_t info; 796 uint8_t info;
783 uint8_t other; 797 uint8_t other;
784 uint16_t section; 798 uint16_t section;
785 }; 799 };
786 #elif V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT 800 #elif(V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT) || \
801 (V8_TARGET_ARCH_PPC64 && V8_OS_LINUX)
787 struct SerializedLayout { 802 struct SerializedLayout {
788 SerializedLayout(uint32_t name, 803 SerializedLayout(uint32_t name,
789 uintptr_t value, 804 uintptr_t value,
790 uintptr_t size, 805 uintptr_t size,
791 Binding binding, 806 Binding binding,
792 Type type, 807 Type type,
793 uint16_t section) 808 uint16_t section)
794 : name(name), 809 : name(name),
795 info((binding << 4) | type), 810 info((binding << 4) | type),
796 other(0), 811 other(0),
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 // DWARF2 standard 1069 // DWARF2 standard
1055 enum DWARF2LocationOp { 1070 enum DWARF2LocationOp {
1056 DW_OP_reg0 = 0x50, 1071 DW_OP_reg0 = 0x50,
1057 DW_OP_reg1 = 0x51, 1072 DW_OP_reg1 = 0x51,
1058 DW_OP_reg2 = 0x52, 1073 DW_OP_reg2 = 0x52,
1059 DW_OP_reg3 = 0x53, 1074 DW_OP_reg3 = 0x53,
1060 DW_OP_reg4 = 0x54, 1075 DW_OP_reg4 = 0x54,
1061 DW_OP_reg5 = 0x55, 1076 DW_OP_reg5 = 0x55,
1062 DW_OP_reg6 = 0x56, 1077 DW_OP_reg6 = 0x56,
1063 DW_OP_reg7 = 0x57, 1078 DW_OP_reg7 = 0x57,
1079 DW_OP_reg8 = 0x58,
1080 DW_OP_reg9 = 0x59,
1081 DW_OP_reg10 = 0x5a,
1082 DW_OP_reg11 = 0x5b,
1083 DW_OP_reg12 = 0x5c,
1084 DW_OP_reg13 = 0x5d,
1085 DW_OP_reg14 = 0x5e,
1086 DW_OP_reg15 = 0x5f,
1087 DW_OP_reg16 = 0x60,
1088 DW_OP_reg17 = 0x61,
1089 DW_OP_reg18 = 0x62,
1090 DW_OP_reg19 = 0x63,
1091 DW_OP_reg20 = 0x64,
1092 DW_OP_reg21 = 0x65,
1093 DW_OP_reg22 = 0x66,
1094 DW_OP_reg23 = 0x67,
1095 DW_OP_reg24 = 0x68,
1096 DW_OP_reg25 = 0x69,
1097 DW_OP_reg26 = 0x6a,
1098 DW_OP_reg27 = 0x6b,
1099 DW_OP_reg28 = 0x6c,
1100 DW_OP_reg29 = 0x6d,
1101 DW_OP_reg30 = 0x6e,
1102 DW_OP_reg31 = 0x6f,
1064 DW_OP_fbreg = 0x91 // 1 param: SLEB128 offset 1103 DW_OP_fbreg = 0x91 // 1 param: SLEB128 offset
1065 }; 1104 };
1066 1105
1067 enum DWARF2Encoding { 1106 enum DWARF2Encoding {
1068 DW_ATE_ADDRESS = 0x1, 1107 DW_ATE_ADDRESS = 0x1,
1069 DW_ATE_SIGNED = 0x5 1108 DW_ATE_SIGNED = 0x5
1070 }; 1109 };
1071 1110
1072 bool WriteBodyInternal(Writer* w) { 1111 bool WriteBodyInternal(Writer* w) {
1073 uintptr_t cu_start = w->position(); 1112 uintptr_t cu_start = w->position();
(...skipping 25 matching lines...) Expand all
1099 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 1138 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
1100 w->Write<uint8_t>(DW_OP_reg5); // The frame pointer's here on ia32 1139 w->Write<uint8_t>(DW_OP_reg5); // The frame pointer's here on ia32
1101 #elif V8_TARGET_ARCH_X64 1140 #elif V8_TARGET_ARCH_X64
1102 w->Write<uint8_t>(DW_OP_reg6); // and here on x64. 1141 w->Write<uint8_t>(DW_OP_reg6); // and here on x64.
1103 #elif V8_TARGET_ARCH_ARM 1142 #elif V8_TARGET_ARCH_ARM
1104 UNIMPLEMENTED(); 1143 UNIMPLEMENTED();
1105 #elif V8_TARGET_ARCH_MIPS 1144 #elif V8_TARGET_ARCH_MIPS
1106 UNIMPLEMENTED(); 1145 UNIMPLEMENTED();
1107 #elif V8_TARGET_ARCH_MIPS64 1146 #elif V8_TARGET_ARCH_MIPS64
1108 UNIMPLEMENTED(); 1147 UNIMPLEMENTED();
1148 #elif V8_TARGET_ARCH_PPC64 && V8_OS_LINUX
1149 w->Write<uint8_t>(DW_OP_reg31); // The frame pointer is here on PPC64
Jakob Kummerow 2015/08/03 16:03:36 nit: trailing full stop please.
1109 #else 1150 #else
1110 #error Unsupported target architecture. 1151 #error Unsupported target architecture.
1111 #endif 1152 #endif
1112 fb_block_size.set(static_cast<uint32_t>(w->position() - fb_block_start)); 1153 fb_block_size.set(static_cast<uint32_t>(w->position() - fb_block_start));
1113 1154
1114 int params = scope->ParameterCount(); 1155 int params = scope->ParameterCount();
1115 int slots = scope->StackLocalCount(); 1156 int slots = scope->StackLocalCount();
1116 int context_slots = scope->ContextLocalCount(); 1157 int context_slots = scope->ContextLocalCount();
1117 // The real slot ID is internal_slots + context_slot_id. 1158 // The real slot ID is internal_slots + context_slot_id.
1118 int internal_slots = Context::MIN_CONTEXT_SLOTS; 1159 int internal_slots = Context::MIN_CONTEXT_SLOTS;
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data); 2198 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data);
2158 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info); 2199 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info);
2159 break; 2200 break;
2160 } 2201 }
2161 } 2202 }
2162 } 2203 }
2163 #endif 2204 #endif
2164 } // namespace GDBJITInterface 2205 } // namespace GDBJITInterface
2165 } // namespace internal 2206 } // namespace internal
2166 } // namespace v8 2207 } // namespace v8
OLDNEW
« no previous file with comments | « build/standalone.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698