| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 uint16_t pht_entry_num; | 387 uint16_t pht_entry_num; |
| 388 uint16_t sht_entry_size; | 388 uint16_t sht_entry_size; |
| 389 uint16_t sht_entry_num; | 389 uint16_t sht_entry_num; |
| 390 uint16_t sht_strtab_index; | 390 uint16_t sht_strtab_index; |
| 391 }; | 391 }; |
| 392 | 392 |
| 393 | 393 |
| 394 void WriteHeader(Writer* w) { | 394 void WriteHeader(Writer* w) { |
| 395 ASSERT(w->position() == 0); | 395 ASSERT(w->position() == 0); |
| 396 Writer::Slot<ELFHeader> header = w->CreateSlotHere<ELFHeader>(); | 396 Writer::Slot<ELFHeader> header = w->CreateSlotHere<ELFHeader>(); |
| 397 #if defined(V8_TARGET_ARCH_IA32) | 397 #if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_ARM) |
| 398 const uint8_t ident[16] = | 398 const uint8_t ident[16] = |
| 399 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 399 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 400 #elif defined(V8_TARGET_ARCH_X64) | 400 #elif defined(V8_TARGET_ARCH_X64) |
| 401 const uint8_t ident[16] = | 401 const uint8_t ident[16] = |
| 402 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0 , 0, 0, 0, 0, 0, 0}; | 402 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0 , 0, 0, 0, 0, 0, 0}; |
| 403 #else | 403 #else |
| 404 #error Unsupported target architecture. | 404 #error Unsupported target architecture. |
| 405 #endif | 405 #endif |
| 406 memcpy(header->ident, ident, 16); | 406 memcpy(header->ident, ident, 16); |
| 407 header->type = 1; | 407 header->type = 1; |
| 408 #if defined(V8_TARGET_ARCH_IA32) | 408 #if defined(V8_TARGET_ARCH_IA32) |
| 409 header->machine = 3; | 409 header->machine = 3; |
| 410 #elif defined(V8_TARGET_ARCH_X64) | 410 #elif defined(V8_TARGET_ARCH_X64) |
| 411 // Processor identification value for x64 is 62 as defined in | 411 // Processor identification value for x64 is 62 as defined in |
| 412 // System V ABI, AMD64 Supplement | 412 // System V ABI, AMD64 Supplement |
| 413 // http://www.x86-64.org/documentation/abi.pdf | 413 // http://www.x86-64.org/documentation/abi.pdf |
| 414 header->machine = 62; | 414 header->machine = 62; |
| 415 #elif defined(V8_TARGET_ARCH_ARM) |
| 416 // Set to EM_ARM, defined as 40, in "ARM ELF File Format" at |
| 417 // infocenter.arm.com/help/topic/com.arm.doc.dui0101a/DUI0101A_Elf.pdf |
| 418 header->machine = 40; |
| 415 #else | 419 #else |
| 416 #error Unsupported target architecture. | 420 #error Unsupported target architecture. |
| 417 #endif | 421 #endif |
| 418 header->version = 1; | 422 header->version = 1; |
| 419 header->entry = 0; | 423 header->entry = 0; |
| 420 header->pht_offset = 0; | 424 header->pht_offset = 0; |
| 421 header->sht_offset = sizeof(ELFHeader); // Section table follows header. | 425 header->sht_offset = sizeof(ELFHeader); // Section table follows header. |
| 422 header->flags = 0; | 426 header->flags = 0; |
| 423 header->header_size = sizeof(ELFHeader); | 427 header->header_size = sizeof(ELFHeader); |
| 424 header->pht_entry_size = 0; | 428 header->pht_entry_size = 0; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 size(size), | 500 size(size), |
| 497 info((binding << 4) | type), | 501 info((binding << 4) | type), |
| 498 other(0), | 502 other(0), |
| 499 section(section) { | 503 section(section) { |
| 500 } | 504 } |
| 501 | 505 |
| 502 Binding binding() const { | 506 Binding binding() const { |
| 503 return static_cast<Binding>(info >> 4); | 507 return static_cast<Binding>(info >> 4); |
| 504 } | 508 } |
| 505 | 509 |
| 506 #if defined(V8_TARGET_ARCH_IA32) | 510 #if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_ARM) |
| 507 struct SerializedLayout { | 511 struct SerializedLayout { |
| 508 SerializedLayout(uint32_t name, | 512 SerializedLayout(uint32_t name, |
| 509 uintptr_t value, | 513 uintptr_t value, |
| 510 uintptr_t size, | 514 uintptr_t size, |
| 511 Binding binding, | 515 Binding binding, |
| 512 Type type, | 516 Type type, |
| 513 uint16_t section) | 517 uint16_t section) |
| 514 : name(name), | 518 : name(name), |
| 515 value(value), | 519 value(value), |
| 516 size(size), | 520 size(size), |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 DW_LNE_END_SEQUENCE = 1, | 811 DW_LNE_END_SEQUENCE = 1, |
| 808 DW_LNE_SET_ADDRESS = 2, | 812 DW_LNE_SET_ADDRESS = 2, |
| 809 DW_LNE_DEFINE_FILE = 3 | 813 DW_LNE_DEFINE_FILE = 3 |
| 810 }; | 814 }; |
| 811 | 815 |
| 812 bool WriteBody(Writer* w) { | 816 bool WriteBody(Writer* w) { |
| 813 // Write prologue. | 817 // Write prologue. |
| 814 Writer::Slot<uint32_t> total_length = w->CreateSlotHere<uint32_t>(); | 818 Writer::Slot<uint32_t> total_length = w->CreateSlotHere<uint32_t>(); |
| 815 uintptr_t start = w->position(); | 819 uintptr_t start = w->position(); |
| 816 | 820 |
| 821 // Used for special opcodes |
| 822 const int8_t line_base = 1; |
| 823 const uint8_t line_range = 7; |
| 824 const int8_t max_line_incr = (line_base + line_range - 1); |
| 825 const uint8_t opcode_base = DW_LNS_NEGATE_STMT + 1; |
| 826 |
| 817 w->Write<uint16_t>(2); // Field version. | 827 w->Write<uint16_t>(2); // Field version. |
| 818 Writer::Slot<uint32_t> prologue_length = w->CreateSlotHere<uint32_t>(); | 828 Writer::Slot<uint32_t> prologue_length = w->CreateSlotHere<uint32_t>(); |
| 819 uintptr_t prologue_start = w->position(); | 829 uintptr_t prologue_start = w->position(); |
| 820 w->Write<uint8_t>(1); // Field minimum_instruction_length. | 830 w->Write<uint8_t>(1); // Field minimum_instruction_length. |
| 821 w->Write<uint8_t>(1); // Field default_is_stmt. | 831 w->Write<uint8_t>(1); // Field default_is_stmt. |
| 822 w->Write<int8_t>(0); // Field line_base. | 832 w->Write<int8_t>(line_base); // Field line_base. |
| 823 w->Write<uint8_t>(2); // Field line_range. | 833 w->Write<uint8_t>(line_range); // Field line_range. |
| 824 w->Write<uint8_t>(DW_LNS_NEGATE_STMT + 1); // Field opcode_base. | 834 w->Write<uint8_t>(opcode_base); // Field opcode_base. |
| 825 w->Write<uint8_t>(0); // DW_LNS_COPY operands count. | 835 w->Write<uint8_t>(0); // DW_LNS_COPY operands count. |
| 826 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_PC operands count. | 836 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_PC operands count. |
| 827 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_LINE operands count. | 837 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_LINE operands count. |
| 828 w->Write<uint8_t>(1); // DW_LNS_SET_FILE operands count. | 838 w->Write<uint8_t>(1); // DW_LNS_SET_FILE operands count. |
| 829 w->Write<uint8_t>(1); // DW_LNS_SET_COLUMN operands count. | 839 w->Write<uint8_t>(1); // DW_LNS_SET_COLUMN operands count. |
| 830 w->Write<uint8_t>(0); // DW_LNS_NEGATE_STMT operands count. | 840 w->Write<uint8_t>(0); // DW_LNS_NEGATE_STMT operands count. |
| 831 w->Write<uint8_t>(0); // Empty include_directories sequence. | 841 w->Write<uint8_t>(0); // Empty include_directories sequence. |
| 832 w->WriteString(*desc_->filename()); // File name. | 842 w->WriteString(*desc_->filename()); // File name. |
| 833 w->WriteULEB128(0); // Current directory. | 843 w->WriteULEB128(0); // Current directory. |
| 834 w->WriteULEB128(0); // Unknown modification time. | 844 w->WriteULEB128(0); // Unknown modification time. |
| 835 w->WriteULEB128(0); // Unknown file size. | 845 w->WriteULEB128(0); // Unknown file size. |
| 836 w->Write<uint8_t>(0); | 846 w->Write<uint8_t>(0); |
| 837 prologue_length.set(static_cast<uint32_t>(w->position() - prologue_start)); | 847 prologue_length.set(static_cast<uint32_t>(w->position() - prologue_start)); |
| 838 | 848 |
| 839 WriteExtendedOpcode(w, DW_LNE_SET_ADDRESS, sizeof(intptr_t)); | 849 WriteExtendedOpcode(w, DW_LNE_SET_ADDRESS, sizeof(intptr_t)); |
| 840 w->Write<intptr_t>(desc_->code_start()); | 850 w->Write<intptr_t>(desc_->code_start()); |
| 851 w->Write<uint8_t>(DW_LNS_COPY); |
| 841 | 852 |
| 842 intptr_t pc = 0; | 853 intptr_t pc = 0; |
| 843 intptr_t line = 1; | 854 intptr_t line = 1; |
| 844 bool is_statement = true; | 855 bool is_statement = true; |
| 845 | 856 |
| 846 List<GDBJITLineInfo::PCInfo>* pc_info = desc_->lineinfo()->pc_info(); | 857 List<GDBJITLineInfo::PCInfo>* pc_info = desc_->lineinfo()->pc_info(); |
| 847 pc_info->Sort(&ComparePCInfo); | 858 pc_info->Sort(&ComparePCInfo); |
| 848 for (int i = 0; i < pc_info->length(); i++) { | 859 |
| 860 int pc_info_length = pc_info->length(); |
| 861 for (int i = 0; i < pc_info_length; i++) { |
| 849 GDBJITLineInfo::PCInfo* info = &pc_info->at(i); | 862 GDBJITLineInfo::PCInfo* info = &pc_info->at(i); |
| 850 uintptr_t pc_diff = info->pc_ - pc; | |
| 851 ASSERT(info->pc_ >= pc); | 863 ASSERT(info->pc_ >= pc); |
| 852 if (pc_diff != 0) { | 864 |
| 853 w->Write<uint8_t>(DW_LNS_ADVANCE_PC); | 865 // Reduce bloating in the debug line table by removing duplicate line |
| 854 w->WriteSLEB128(pc_diff); | 866 // entries (per DWARF2 standard). |
| 855 pc += pc_diff; | 867 intptr_t new_line = desc_->GetScriptLineNumber(info->pos_); |
| 868 if (new_line == line) { |
| 869 continue; |
| 856 } | 870 } |
| 857 intptr_t line_diff = desc_->GetScriptLineNumber(info->pos_) - line; | 871 |
| 858 if (line_diff != 0) { | 872 // Mark statement boundaries. For a better debugging experience, mark |
| 859 w->Write<uint8_t>(DW_LNS_ADVANCE_LINE); | 873 // the last pc address in the function as a statement (e.g. "}"), so that |
| 860 w->WriteSLEB128(line_diff); | 874 // a user can see the result of the last line executed in the function, |
| 861 line += line_diff; | 875 // should control reach the end. |
| 862 } | 876 if ((i+1) == pc_info_length) { |
| 863 if (is_statement != info->is_statement_) { | 877 if (!is_statement) { |
| 878 w->Write<uint8_t>(DW_LNS_NEGATE_STMT); |
| 879 } |
| 880 } else if (is_statement != info->is_statement_) { |
| 864 w->Write<uint8_t>(DW_LNS_NEGATE_STMT); | 881 w->Write<uint8_t>(DW_LNS_NEGATE_STMT); |
| 865 is_statement = !is_statement; | 882 is_statement = !is_statement; |
| 866 } | 883 } |
| 867 if (pc_diff != 0 || i == 0) { | 884 |
| 885 // Generate special opcodes, if possible. This results in more compact |
| 886 // debug line tables. See the DWARF 2.0 standard to learn more about |
| 887 // special opcodes. |
| 888 uintptr_t pc_diff = info->pc_ - pc; |
| 889 intptr_t line_diff = new_line - line; |
| 890 |
| 891 // Compute special opcode (see DWARF 2.0 standard) |
| 892 intptr_t special_opcode = (line_diff - line_base) + |
| 893 (line_range * pc_diff) + opcode_base; |
| 894 |
| 895 // If special_opcode is less than or equal to 255, it can be used as a |
| 896 // special opcode. If line_diff is larger than the max line increment |
| 897 // allowed for a special opcode, or if line_diff is less than the minimum |
| 898 // line that can be added to the line register (i.e. line_base), then |
| 899 // special_opcode can't be used. |
| 900 if ((special_opcode >= opcode_base) && (special_opcode <= 255) && |
| 901 (line_diff <= max_line_incr) && (line_diff >= line_base)) { |
| 902 w->Write<uint8_t>(special_opcode); |
| 903 } else { |
| 904 w->Write<uint8_t>(DW_LNS_ADVANCE_PC); |
| 905 w->WriteSLEB128(pc_diff); |
| 906 w->Write<uint8_t>(DW_LNS_ADVANCE_LINE); |
| 907 w->WriteSLEB128(line_diff); |
| 868 w->Write<uint8_t>(DW_LNS_COPY); | 908 w->Write<uint8_t>(DW_LNS_COPY); |
| 869 } | 909 } |
| 910 |
| 911 // Increment the pc and line operands. |
| 912 pc += pc_diff; |
| 913 line += line_diff; |
| 870 } | 914 } |
| 915 // Advance the pc to the end of the routine, since the end sequence opcode |
| 916 // requires this. |
| 917 w->Write<uint8_t>(DW_LNS_ADVANCE_PC); |
| 918 w->WriteSLEB128(desc_->code_size() - pc); |
| 871 WriteExtendedOpcode(w, DW_LNE_END_SEQUENCE, 0); | 919 WriteExtendedOpcode(w, DW_LNE_END_SEQUENCE, 0); |
| 872 total_length.set(static_cast<uint32_t>(w->position() - start)); | 920 total_length.set(static_cast<uint32_t>(w->position() - start)); |
| 873 return true; | 921 return true; |
| 874 } | 922 } |
| 875 | 923 |
| 876 private: | 924 private: |
| 877 void WriteExtendedOpcode(Writer* w, | 925 void WriteExtendedOpcode(Writer* w, |
| 878 DWARF2ExtendedOpcode op, | 926 DWARF2ExtendedOpcode op, |
| 879 size_t operands_size) { | 927 size_t operands_size) { |
| 880 w->Write<uint8_t>(0); | 928 w->Write<uint8_t>(0); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 return entry; | 1009 return entry; |
| 962 } | 1010 } |
| 963 | 1011 |
| 964 | 1012 |
| 965 static void DestroyCodeEntry(JITCodeEntry* entry) { | 1013 static void DestroyCodeEntry(JITCodeEntry* entry) { |
| 966 free(entry); | 1014 free(entry); |
| 967 } | 1015 } |
| 968 | 1016 |
| 969 | 1017 |
| 970 static void RegisterCodeEntry(JITCodeEntry* entry) { | 1018 static void RegisterCodeEntry(JITCodeEntry* entry) { |
| 1019 #if defined(DEBUG) && !defined(WIN32) |
| 1020 static int file_num = 0; |
| 1021 if (FLAG_gdbjit_dump) { |
| 1022 static const int kMaxFileNameSize = 64; |
| 1023 static const char* kElfFilePrefix = "/tmp/elfdump"; |
| 1024 static const char* kObjFileExt = ".o"; |
| 1025 char file_name[64]; |
| 1026 |
| 1027 OS::SNPrintF(Vector<char>(file_name, kMaxFileNameSize), "%s%d%s", |
| 1028 kElfFilePrefix, file_num++, kObjFileExt); |
| 1029 WriteBytes(file_name, entry->symfile_addr_, entry->symfile_size_); |
| 1030 } |
| 1031 #endif |
| 1032 |
| 971 entry->next_ = __jit_debug_descriptor.first_entry_; | 1033 entry->next_ = __jit_debug_descriptor.first_entry_; |
| 972 if (entry->next_ != NULL) entry->next_->prev_ = entry; | 1034 if (entry->next_ != NULL) entry->next_->prev_ = entry; |
| 973 __jit_debug_descriptor.first_entry_ = | 1035 __jit_debug_descriptor.first_entry_ = |
| 974 __jit_debug_descriptor.relevant_entry_ = entry; | 1036 __jit_debug_descriptor.relevant_entry_ = entry; |
| 975 | 1037 |
| 976 __jit_debug_descriptor.action_flag_ = JIT_REGISTER_FN; | 1038 __jit_debug_descriptor.action_flag_ = JIT_REGISTER_FN; |
| 977 __jit_debug_register_code(); | 1039 __jit_debug_register_code(); |
| 978 } | 1040 } |
| 979 | 1041 |
| 980 | 1042 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 | 1080 |
| 1019 return CreateCodeEntry(w.buffer(), w.position()); | 1081 return CreateCodeEntry(w.buffer(), w.position()); |
| 1020 } | 1082 } |
| 1021 | 1083 |
| 1022 | 1084 |
| 1023 static bool SameCodeObjects(void* key1, void* key2) { | 1085 static bool SameCodeObjects(void* key1, void* key2) { |
| 1024 return key1 == key2; | 1086 return key1 == key2; |
| 1025 } | 1087 } |
| 1026 | 1088 |
| 1027 | 1089 |
| 1028 static HashMap entries(&SameCodeObjects); | 1090 static HashMap* GetEntries() { |
| 1091 static HashMap* entries = NULL; |
| 1092 if (entries == NULL) { |
| 1093 entries = new HashMap(&SameCodeObjects); |
| 1094 } |
| 1095 return entries; |
| 1096 } |
| 1029 | 1097 |
| 1030 | 1098 |
| 1031 static uint32_t HashForCodeObject(Code* code) { | 1099 static uint32_t HashForCodeObject(Code* code) { |
| 1032 static const uintptr_t kGoldenRatio = 2654435761u; | 1100 static const uintptr_t kGoldenRatio = 2654435761u; |
| 1033 uintptr_t hash = reinterpret_cast<uintptr_t>(code->address()); | 1101 uintptr_t hash = reinterpret_cast<uintptr_t>(code->address()); |
| 1034 return static_cast<uint32_t>((hash >> kCodeAlignmentBits) * kGoldenRatio); | 1102 return static_cast<uint32_t>((hash >> kCodeAlignmentBits) * kGoldenRatio); |
| 1035 } | 1103 } |
| 1036 | 1104 |
| 1037 | 1105 |
| 1038 static const intptr_t kLineInfoTag = 0x1; | 1106 static const intptr_t kLineInfoTag = 0x1; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 } | 1139 } |
| 1072 } | 1140 } |
| 1073 | 1141 |
| 1074 | 1142 |
| 1075 void GDBJITInterface::AddCode(const char* name, | 1143 void GDBJITInterface::AddCode(const char* name, |
| 1076 Code* code, | 1144 Code* code, |
| 1077 Script* script) { | 1145 Script* script) { |
| 1078 if (!FLAG_gdbjit) return; | 1146 if (!FLAG_gdbjit) return; |
| 1079 AssertNoAllocation no_gc; | 1147 AssertNoAllocation no_gc; |
| 1080 | 1148 |
| 1081 HashMap::Entry* e = entries.Lookup(code, HashForCodeObject(code), true); | 1149 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
| 1082 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; | 1150 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; |
| 1083 | 1151 |
| 1084 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); | 1152 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); |
| 1085 CodeDescription code_desc(name, | 1153 CodeDescription code_desc(name, |
| 1086 code, | 1154 code, |
| 1087 script != NULL ? Handle<Script>(script) | 1155 script != NULL ? Handle<Script>(script) |
| 1088 : Handle<Script>(), | 1156 : Handle<Script>(), |
| 1089 lineinfo); | 1157 lineinfo); |
| 1090 | 1158 |
| 1091 if (!FLAG_gdbjit_full && !code_desc.is_line_info_available()) { | 1159 if (!FLAG_gdbjit_full && !code_desc.is_line_info_available()) { |
| 1092 delete lineinfo; | 1160 delete lineinfo; |
| 1093 entries.Remove(code, HashForCodeObject(code)); | 1161 GetEntries()->Remove(code, HashForCodeObject(code)); |
| 1094 return; | 1162 return; |
| 1095 } | 1163 } |
| 1096 | 1164 |
| 1097 JITCodeEntry* entry = CreateELFObject(&code_desc); | 1165 JITCodeEntry* entry = CreateELFObject(&code_desc); |
| 1098 ASSERT(!IsLineInfoTagged(entry)); | 1166 ASSERT(!IsLineInfoTagged(entry)); |
| 1099 | 1167 |
| 1100 delete lineinfo; | 1168 delete lineinfo; |
| 1101 e->value = entry; | 1169 e->value = entry; |
| 1102 | 1170 |
| 1103 RegisterCodeEntry(entry); | 1171 RegisterCodeEntry(entry); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { | 1203 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { |
| 1136 if (!FLAG_gdbjit) return; | 1204 if (!FLAG_gdbjit) return; |
| 1137 | 1205 |
| 1138 AddCode(tag, "", code); | 1206 AddCode(tag, "", code); |
| 1139 } | 1207 } |
| 1140 | 1208 |
| 1141 | 1209 |
| 1142 void GDBJITInterface::RemoveCode(Code* code) { | 1210 void GDBJITInterface::RemoveCode(Code* code) { |
| 1143 if (!FLAG_gdbjit) return; | 1211 if (!FLAG_gdbjit) return; |
| 1144 | 1212 |
| 1145 HashMap::Entry* e = entries.Lookup(code, HashForCodeObject(code), false); | 1213 HashMap::Entry* e = GetEntries()->Lookup(code, |
| 1214 HashForCodeObject(code), |
| 1215 false); |
| 1146 if (e == NULL) return; | 1216 if (e == NULL) return; |
| 1147 | 1217 |
| 1148 if (IsLineInfoTagged(e->value)) { | 1218 if (IsLineInfoTagged(e->value)) { |
| 1149 delete UntagLineInfo(e->value); | 1219 delete UntagLineInfo(e->value); |
| 1150 } else { | 1220 } else { |
| 1151 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); | 1221 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); |
| 1152 UnregisterCodeEntry(entry); | 1222 UnregisterCodeEntry(entry); |
| 1153 DestroyCodeEntry(entry); | 1223 DestroyCodeEntry(entry); |
| 1154 } | 1224 } |
| 1155 e->value = NULL; | 1225 e->value = NULL; |
| 1156 entries.Remove(code, HashForCodeObject(code)); | 1226 GetEntries()->Remove(code, HashForCodeObject(code)); |
| 1157 } | 1227 } |
| 1158 | 1228 |
| 1159 | 1229 |
| 1160 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, | 1230 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, |
| 1161 GDBJITLineInfo* line_info) { | 1231 GDBJITLineInfo* line_info) { |
| 1162 ASSERT(!IsLineInfoTagged(line_info)); | 1232 ASSERT(!IsLineInfoTagged(line_info)); |
| 1163 HashMap::Entry* e = entries.Lookup(code, HashForCodeObject(code), true); | 1233 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
| 1164 ASSERT(e->value == NULL); | 1234 ASSERT(e->value == NULL); |
| 1165 e->value = TagLineInfo(line_info); | 1235 e->value = TagLineInfo(line_info); |
| 1166 } | 1236 } |
| 1167 | 1237 |
| 1168 | 1238 |
| 1169 } } // namespace v8::internal | 1239 } } // namespace v8::internal |
| 1170 #endif | 1240 #endif |
| OLD | NEW |