| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 uint16_t pht_entry_num; | 388 uint16_t pht_entry_num; |
| 389 uint16_t sht_entry_size; | 389 uint16_t sht_entry_size; |
| 390 uint16_t sht_entry_num; | 390 uint16_t sht_entry_num; |
| 391 uint16_t sht_strtab_index; | 391 uint16_t sht_strtab_index; |
| 392 }; | 392 }; |
| 393 | 393 |
| 394 | 394 |
| 395 void WriteHeader(Writer* w) { | 395 void WriteHeader(Writer* w) { |
| 396 ASSERT(w->position() == 0); | 396 ASSERT(w->position() == 0); |
| 397 Writer::Slot<ELFHeader> header = w->CreateSlotHere<ELFHeader>(); | 397 Writer::Slot<ELFHeader> header = w->CreateSlotHere<ELFHeader>(); |
| 398 #if defined(V8_TARGET_ARCH_IA32) | 398 #if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_ARM) |
| 399 const uint8_t ident[16] = | 399 const uint8_t ident[16] = |
| 400 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 400 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 401 #elif defined(V8_TARGET_ARCH_X64) | 401 #elif defined(V8_TARGET_ARCH_X64) |
| 402 const uint8_t ident[16] = | 402 const uint8_t ident[16] = |
| 403 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0 , 0, 0, 0, 0, 0, 0}; | 403 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0 , 0, 0, 0, 0, 0, 0}; |
| 404 #else | 404 #else |
| 405 #error Unsupported target architecture. | 405 #error Unsupported target architecture. |
| 406 #endif | 406 #endif |
| 407 memcpy(header->ident, ident, 16); | 407 memcpy(header->ident, ident, 16); |
| 408 header->type = 1; | 408 header->type = 1; |
| 409 #if defined(V8_TARGET_ARCH_IA32) | 409 #if defined(V8_TARGET_ARCH_IA32) |
| 410 header->machine = 3; | 410 header->machine = 3; |
| 411 #elif defined(V8_TARGET_ARCH_X64) | 411 #elif defined(V8_TARGET_ARCH_X64) |
| 412 // Processor identification value for x64 is 62 as defined in | 412 // Processor identification value for x64 is 62 as defined in |
| 413 // System V ABI, AMD64 Supplement | 413 // System V ABI, AMD64 Supplement |
| 414 // http://www.x86-64.org/documentation/abi.pdf | 414 // http://www.x86-64.org/documentation/abi.pdf |
| 415 header->machine = 62; | 415 header->machine = 62; |
| 416 #elif defined(V8_TARGET_ARCH_ARM) |
| 417 // Set to EM_ARM, defined as 40, in "ARM ELF File Format" at |
| 418 // infocenter.arm.com/help/topic/com.arm.doc.dui0101a/DUI0101A_Elf.pdf |
| 419 header->machine = 40; |
| 416 #else | 420 #else |
| 417 #error Unsupported target architecture. | 421 #error Unsupported target architecture. |
| 418 #endif | 422 #endif |
| 419 header->version = 1; | 423 header->version = 1; |
| 420 header->entry = 0; | 424 header->entry = 0; |
| 421 header->pht_offset = 0; | 425 header->pht_offset = 0; |
| 422 header->sht_offset = sizeof(ELFHeader); // Section table follows header. | 426 header->sht_offset = sizeof(ELFHeader); // Section table follows header. |
| 423 header->flags = 0; | 427 header->flags = 0; |
| 424 header->header_size = sizeof(ELFHeader); | 428 header->header_size = sizeof(ELFHeader); |
| 425 header->pht_entry_size = 0; | 429 header->pht_entry_size = 0; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 value(value), | 500 value(value), |
| 497 size(size), | 501 size(size), |
| 498 info((binding << 4) | type), | 502 info((binding << 4) | type), |
| 499 other(0), | 503 other(0), |
| 500 section(section) { | 504 section(section) { |
| 501 } | 505 } |
| 502 | 506 |
| 503 Binding binding() const { | 507 Binding binding() const { |
| 504 return static_cast<Binding>(info >> 4); | 508 return static_cast<Binding>(info >> 4); |
| 505 } | 509 } |
| 506 | 510 #if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_ARM) |
| 507 #if defined(V8_TARGET_ARCH_IA32) | |
| 508 struct SerializedLayout { | 511 struct SerializedLayout { |
| 509 SerializedLayout(uint32_t name, | 512 SerializedLayout(uint32_t name, |
| 510 uintptr_t value, | 513 uintptr_t value, |
| 511 uintptr_t size, | 514 uintptr_t size, |
| 512 Binding binding, | 515 Binding binding, |
| 513 Type type, | 516 Type type, |
| 514 uint16_t section) | 517 uint16_t section) |
| 515 : name(name), | 518 : name(name), |
| 516 value(value), | 519 value(value), |
| 517 size(size), | 520 size(size), |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 DW_LNE_END_SEQUENCE = 1, | 853 DW_LNE_END_SEQUENCE = 1, |
| 851 DW_LNE_SET_ADDRESS = 2, | 854 DW_LNE_SET_ADDRESS = 2, |
| 852 DW_LNE_DEFINE_FILE = 3 | 855 DW_LNE_DEFINE_FILE = 3 |
| 853 }; | 856 }; |
| 854 | 857 |
| 855 bool WriteBody(Writer* w) { | 858 bool WriteBody(Writer* w) { |
| 856 // Write prologue. | 859 // Write prologue. |
| 857 Writer::Slot<uint32_t> total_length = w->CreateSlotHere<uint32_t>(); | 860 Writer::Slot<uint32_t> total_length = w->CreateSlotHere<uint32_t>(); |
| 858 uintptr_t start = w->position(); | 861 uintptr_t start = w->position(); |
| 859 | 862 |
| 863 // Used for special opcodes |
| 864 const int8_t line_base = 1; |
| 865 const uint8_t line_range = 7; |
| 866 const int8_t max_line_incr = (line_base + line_range - 1); |
| 867 const uint8_t opcode_base = DW_LNS_NEGATE_STMT + 1; |
| 868 |
| 860 w->Write<uint16_t>(2); // Field version. | 869 w->Write<uint16_t>(2); // Field version. |
| 861 Writer::Slot<uint32_t> prologue_length = w->CreateSlotHere<uint32_t>(); | 870 Writer::Slot<uint32_t> prologue_length = w->CreateSlotHere<uint32_t>(); |
| 862 uintptr_t prologue_start = w->position(); | 871 uintptr_t prologue_start = w->position(); |
| 863 w->Write<uint8_t>(1); // Field minimum_instruction_length. | 872 w->Write<uint8_t>(1); // Field minimum_instruction_length. |
| 864 w->Write<uint8_t>(1); // Field default_is_stmt. | 873 w->Write<uint8_t>(1); // Field default_is_stmt. |
| 865 w->Write<int8_t>(0); // Field line_base. | 874 w->Write<int8_t>(line_base); // Field line_base. |
| 866 w->Write<uint8_t>(2); // Field line_range. | 875 w->Write<uint8_t>(line_range); // Field line_range. |
| 867 w->Write<uint8_t>(DW_LNS_NEGATE_STMT + 1); // Field opcode_base. | 876 w->Write<uint8_t>(opcode_base); // Field opcode_base. |
| 868 w->Write<uint8_t>(0); // DW_LNS_COPY operands count. | 877 w->Write<uint8_t>(0); // DW_LNS_COPY operands count. |
| 869 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_PC operands count. | 878 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_PC operands count. |
| 870 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_LINE operands count. | 879 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_LINE operands count. |
| 871 w->Write<uint8_t>(1); // DW_LNS_SET_FILE operands count. | 880 w->Write<uint8_t>(1); // DW_LNS_SET_FILE operands count. |
| 872 w->Write<uint8_t>(1); // DW_LNS_SET_COLUMN operands count. | 881 w->Write<uint8_t>(1); // DW_LNS_SET_COLUMN operands count. |
| 873 w->Write<uint8_t>(0); // DW_LNS_NEGATE_STMT operands count. | 882 w->Write<uint8_t>(0); // DW_LNS_NEGATE_STMT operands count. |
| 874 w->Write<uint8_t>(0); // Empty include_directories sequence. | 883 w->Write<uint8_t>(0); // Empty include_directories sequence. |
| 875 w->WriteString(*desc_->GetFilename()); // File name. | 884 w->WriteString(*desc_->GetFilename()); // File name. |
| 876 w->WriteULEB128(0); // Current directory. | 885 w->WriteULEB128(0); // Current directory. |
| 877 w->WriteULEB128(0); // Unknown modification time. | 886 w->WriteULEB128(0); // Unknown modification time. |
| 878 w->WriteULEB128(0); // Unknown file size. | 887 w->WriteULEB128(0); // Unknown file size. |
| 879 w->Write<uint8_t>(0); | 888 w->Write<uint8_t>(0); |
| 880 prologue_length.set(static_cast<uint32_t>(w->position() - prologue_start)); | 889 prologue_length.set(static_cast<uint32_t>(w->position() - prologue_start)); |
| 881 | 890 |
| 882 WriteExtendedOpcode(w, DW_LNE_SET_ADDRESS, sizeof(intptr_t)); | 891 WriteExtendedOpcode(w, DW_LNE_SET_ADDRESS, sizeof(intptr_t)); |
| 883 w->Write<intptr_t>(desc_->CodeStart()); | 892 w->Write<intptr_t>(desc_->CodeStart()); |
| 893 w->Write<uint8_t>(DW_LNS_COPY); |
| 884 | 894 |
| 885 intptr_t pc = 0; | 895 intptr_t pc = 0; |
| 886 intptr_t line = 1; | 896 intptr_t line = 1; |
| 887 bool is_statement = true; | 897 bool is_statement = true; |
| 888 | 898 |
| 889 List<GDBJITLineInfo::PCInfo>* pc_info = desc_->lineinfo()->pc_info(); | 899 List<GDBJITLineInfo::PCInfo>* pc_info = desc_->lineinfo()->pc_info(); |
| 890 pc_info->Sort(&ComparePCInfo); | 900 pc_info->Sort(&ComparePCInfo); |
| 891 for (int i = 0; i < pc_info->length(); i++) { | 901 |
| 902 int pc_info_length = pc_info->length(); |
| 903 for (int i = 0; i < pc_info_length; i++) { |
| 892 GDBJITLineInfo::PCInfo* info = &pc_info->at(i); | 904 GDBJITLineInfo::PCInfo* info = &pc_info->at(i); |
| 893 uintptr_t pc_diff = info->pc_ - pc; | |
| 894 ASSERT(info->pc_ >= pc); | 905 ASSERT(info->pc_ >= pc); |
| 895 if (pc_diff != 0) { | 906 |
| 896 w->Write<uint8_t>(DW_LNS_ADVANCE_PC); | 907 // Reduce bloating in the debug line table by removing duplicate line |
| 897 w->WriteSLEB128(pc_diff); | 908 // entries (per DWARF2 standard). |
| 898 pc += pc_diff; | 909 intptr_t new_line = desc_->GetScriptLineNumber(info->pos_); |
| 910 if (new_line == line) { |
| 911 continue; |
| 899 } | 912 } |
| 900 intptr_t line_diff = desc_->GetScriptLineNumber(info->pos_) - line; | 913 |
| 901 if (line_diff != 0) { | 914 // Mark statement boundaries. For a better debugging experience, mark |
| 902 w->Write<uint8_t>(DW_LNS_ADVANCE_LINE); | 915 // the last pc address in the function as a statement (e.g. "}"), so that |
| 903 w->WriteSLEB128(line_diff); | 916 // a user can see the result of the last line executed in the function, |
| 904 line += line_diff; | 917 // should control reach the end. |
| 905 } | 918 if ((i+1) == pc_info_length) { |
| 906 if (is_statement != info->is_statement_) { | 919 if (!is_statement) { |
| 920 w->Write<uint8_t>(DW_LNS_NEGATE_STMT); |
| 921 } |
| 922 } else if (is_statement != info->is_statement_) { |
| 907 w->Write<uint8_t>(DW_LNS_NEGATE_STMT); | 923 w->Write<uint8_t>(DW_LNS_NEGATE_STMT); |
| 908 is_statement = !is_statement; | 924 is_statement = !is_statement; |
| 909 } | 925 } |
| 910 if (pc_diff != 0 || i == 0) { | 926 |
| 927 // Generate special opcodes, if possible. This results in more compact |
| 928 // debug line tables. See the DWARF 2.0 standard to learn more about |
| 929 // special opcodes. |
| 930 uintptr_t pc_diff = info->pc_ - pc; |
| 931 intptr_t line_diff = new_line - line; |
| 932 |
| 933 // Compute special opcode (see DWARF 2.0 standard) |
| 934 intptr_t special_opcode = (line_diff - line_base) + |
| 935 (line_range * pc_diff) + opcode_base; |
| 936 |
| 937 // If special_opcode is less than or equal to 255, it can be used as a |
| 938 // special opcode. If line_diff is larger than the max line increment |
| 939 // allowed for a special opcode, or if line_diff is less than the minimum |
| 940 // line that can be added to the line register (i.e. line_base), then |
| 941 // special_opcode can't be used. |
| 942 if ((special_opcode >= opcode_base) && (special_opcode <= 255) && |
| 943 (line_diff <= max_line_incr) && (line_diff >= line_base)) { |
| 944 w->Write<uint8_t>(special_opcode); |
| 945 } else { |
| 946 w->Write<uint8_t>(DW_LNS_ADVANCE_PC); |
| 947 w->WriteSLEB128(pc_diff); |
| 948 w->Write<uint8_t>(DW_LNS_ADVANCE_LINE); |
| 949 w->WriteSLEB128(line_diff); |
| 911 w->Write<uint8_t>(DW_LNS_COPY); | 950 w->Write<uint8_t>(DW_LNS_COPY); |
| 912 } | 951 } |
| 952 |
| 953 // Increment the pc and line operands. |
| 954 pc += pc_diff; |
| 955 line += line_diff; |
| 913 } | 956 } |
| 957 // Advance the pc to the end of the routine, since the end sequence opcode |
| 958 // requires this. |
| 959 w->Write<uint8_t>(DW_LNS_ADVANCE_PC); |
| 960 w->WriteSLEB128(desc_->CodeSize() - pc); |
| 914 WriteExtendedOpcode(w, DW_LNE_END_SEQUENCE, 0); | 961 WriteExtendedOpcode(w, DW_LNE_END_SEQUENCE, 0); |
| 915 total_length.set(static_cast<uint32_t>(w->position() - start)); | 962 total_length.set(static_cast<uint32_t>(w->position() - start)); |
| 916 return true; | 963 return true; |
| 917 } | 964 } |
| 918 | 965 |
| 919 private: | 966 private: |
| 920 void WriteExtendedOpcode(Writer* w, | 967 void WriteExtendedOpcode(Writer* w, |
| 921 DWARF2ExtendedOpcode op, | 968 DWARF2ExtendedOpcode op, |
| 922 size_t operands_size) { | 969 size_t operands_size) { |
| 923 w->Write<uint8_t>(0); | 970 w->Write<uint8_t>(0); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 return entry; | 1277 return entry; |
| 1231 } | 1278 } |
| 1232 | 1279 |
| 1233 | 1280 |
| 1234 static void DestroyCodeEntry(JITCodeEntry* entry) { | 1281 static void DestroyCodeEntry(JITCodeEntry* entry) { |
| 1235 free(entry); | 1282 free(entry); |
| 1236 } | 1283 } |
| 1237 | 1284 |
| 1238 | 1285 |
| 1239 static void RegisterCodeEntry(JITCodeEntry* entry) { | 1286 static void RegisterCodeEntry(JITCodeEntry* entry) { |
| 1287 #if defined(DEBUG) && !defined(WIN32) |
| 1288 static int file_num = 0; |
| 1289 if (FLAG_gdbjit_dump) { |
| 1290 static const int kMaxFileNameSize = 64; |
| 1291 static const char* kElfFilePrefix = "/tmp/elfdump"; |
| 1292 static const char* kObjFileExt = ".o"; |
| 1293 char file_name[64]; |
| 1294 |
| 1295 OS::SNPrintF(Vector<char>(file_name, kMaxFileNameSize), "%s%d%s", |
| 1296 kElfFilePrefix, file_num++, kObjFileExt); |
| 1297 WriteBytes(file_name, entry->symfile_addr_, entry->symfile_size_); |
| 1298 } |
| 1299 #endif |
| 1300 |
| 1240 entry->next_ = __jit_debug_descriptor.first_entry_; | 1301 entry->next_ = __jit_debug_descriptor.first_entry_; |
| 1241 if (entry->next_ != NULL) entry->next_->prev_ = entry; | 1302 if (entry->next_ != NULL) entry->next_->prev_ = entry; |
| 1242 __jit_debug_descriptor.first_entry_ = | 1303 __jit_debug_descriptor.first_entry_ = |
| 1243 __jit_debug_descriptor.relevant_entry_ = entry; | 1304 __jit_debug_descriptor.relevant_entry_ = entry; |
| 1244 | 1305 |
| 1245 __jit_debug_descriptor.action_flag_ = JIT_REGISTER_FN; | 1306 __jit_debug_descriptor.action_flag_ = JIT_REGISTER_FN; |
| 1246 __jit_debug_register_code(); | 1307 __jit_debug_register_code(); |
| 1247 } | 1308 } |
| 1248 | 1309 |
| 1249 | 1310 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 | 1348 |
| 1288 return CreateCodeEntry(w.buffer(), w.position()); | 1349 return CreateCodeEntry(w.buffer(), w.position()); |
| 1289 } | 1350 } |
| 1290 | 1351 |
| 1291 | 1352 |
| 1292 static bool SameCodeObjects(void* key1, void* key2) { | 1353 static bool SameCodeObjects(void* key1, void* key2) { |
| 1293 return key1 == key2; | 1354 return key1 == key2; |
| 1294 } | 1355 } |
| 1295 | 1356 |
| 1296 | 1357 |
| 1297 static HashMap entries(&SameCodeObjects); | 1358 static HashMap* GetEntries() { |
| 1359 static HashMap* entries = NULL; |
| 1360 if (entries == NULL) { |
| 1361 entries = new HashMap(&SameCodeObjects); |
| 1362 } |
| 1363 return entries; |
| 1364 } |
| 1298 | 1365 |
| 1299 | 1366 |
| 1300 static uint32_t HashForCodeObject(Code* code) { | 1367 static uint32_t HashForCodeObject(Code* code) { |
| 1301 static const uintptr_t kGoldenRatio = 2654435761u; | 1368 static const uintptr_t kGoldenRatio = 2654435761u; |
| 1302 uintptr_t hash = reinterpret_cast<uintptr_t>(code->address()); | 1369 uintptr_t hash = reinterpret_cast<uintptr_t>(code->address()); |
| 1303 return static_cast<uint32_t>((hash >> kCodeAlignmentBits) * kGoldenRatio); | 1370 return static_cast<uint32_t>((hash >> kCodeAlignmentBits) * kGoldenRatio); |
| 1304 } | 1371 } |
| 1305 | 1372 |
| 1306 | 1373 |
| 1307 static const intptr_t kLineInfoTag = 0x1; | 1374 static const intptr_t kLineInfoTag = 0x1; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 } | 1458 } |
| 1392 | 1459 |
| 1393 | 1460 |
| 1394 void GDBJITInterface::AddCode(const char* name, | 1461 void GDBJITInterface::AddCode(const char* name, |
| 1395 Code* code, | 1462 Code* code, |
| 1396 GDBJITInterface::CodeTag tag, | 1463 GDBJITInterface::CodeTag tag, |
| 1397 Script* script) { | 1464 Script* script) { |
| 1398 if (!FLAG_gdbjit) return; | 1465 if (!FLAG_gdbjit) return; |
| 1399 AssertNoAllocation no_gc; | 1466 AssertNoAllocation no_gc; |
| 1400 | 1467 |
| 1401 HashMap::Entry* e = entries.Lookup(code, HashForCodeObject(code), true); | 1468 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
| 1402 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; | 1469 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; |
| 1403 | 1470 |
| 1404 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); | 1471 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); |
| 1405 CodeDescription code_desc(name, | 1472 CodeDescription code_desc(name, |
| 1406 code, | 1473 code, |
| 1407 script != NULL ? Handle<Script>(script) | 1474 script != NULL ? Handle<Script>(script) |
| 1408 : Handle<Script>(), | 1475 : Handle<Script>(), |
| 1409 lineinfo, | 1476 lineinfo, |
| 1410 tag); | 1477 tag); |
| 1411 | 1478 |
| 1412 if (!FLAG_gdbjit_full && !code_desc.IsLineInfoAvailable()) { | 1479 if (!FLAG_gdbjit_full && !code_desc.IsLineInfoAvailable()) { |
| 1413 delete lineinfo; | 1480 delete lineinfo; |
| 1414 entries.Remove(code, HashForCodeObject(code)); | 1481 GetEntries()->Remove(code, HashForCodeObject(code)); |
| 1415 return; | 1482 return; |
| 1416 } | 1483 } |
| 1417 | 1484 |
| 1418 AddUnwindInfo(&code_desc); | 1485 AddUnwindInfo(&code_desc); |
| 1419 JITCodeEntry* entry = CreateELFObject(&code_desc); | 1486 JITCodeEntry* entry = CreateELFObject(&code_desc); |
| 1420 ASSERT(!IsLineInfoTagged(entry)); | 1487 ASSERT(!IsLineInfoTagged(entry)); |
| 1421 | 1488 |
| 1422 delete lineinfo; | 1489 delete lineinfo; |
| 1423 e->value = entry; | 1490 e->value = entry; |
| 1424 | 1491 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { | 1524 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { |
| 1458 if (!FLAG_gdbjit) return; | 1525 if (!FLAG_gdbjit) return; |
| 1459 | 1526 |
| 1460 AddCode(tag, "", code); | 1527 AddCode(tag, "", code); |
| 1461 } | 1528 } |
| 1462 | 1529 |
| 1463 | 1530 |
| 1464 void GDBJITInterface::RemoveCode(Code* code) { | 1531 void GDBJITInterface::RemoveCode(Code* code) { |
| 1465 if (!FLAG_gdbjit) return; | 1532 if (!FLAG_gdbjit) return; |
| 1466 | 1533 |
| 1467 HashMap::Entry* e = entries.Lookup(code, HashForCodeObject(code), false); | 1534 HashMap::Entry* e = GetEntries()->Lookup(code, |
| 1535 HashForCodeObject(code), |
| 1536 false); |
| 1468 if (e == NULL) return; | 1537 if (e == NULL) return; |
| 1469 | 1538 |
| 1470 if (IsLineInfoTagged(e->value)) { | 1539 if (IsLineInfoTagged(e->value)) { |
| 1471 delete UntagLineInfo(e->value); | 1540 delete UntagLineInfo(e->value); |
| 1472 } else { | 1541 } else { |
| 1473 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); | 1542 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); |
| 1474 UnregisterCodeEntry(entry); | 1543 UnregisterCodeEntry(entry); |
| 1475 DestroyCodeEntry(entry); | 1544 DestroyCodeEntry(entry); |
| 1476 } | 1545 } |
| 1477 e->value = NULL; | 1546 e->value = NULL; |
| 1478 entries.Remove(code, HashForCodeObject(code)); | 1547 GetEntries()->Remove(code, HashForCodeObject(code)); |
| 1479 } | 1548 } |
| 1480 | 1549 |
| 1481 | 1550 |
| 1482 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, | 1551 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, |
| 1483 GDBJITLineInfo* line_info) { | 1552 GDBJITLineInfo* line_info) { |
| 1484 ASSERT(!IsLineInfoTagged(line_info)); | 1553 ASSERT(!IsLineInfoTagged(line_info)); |
| 1485 HashMap::Entry* e = entries.Lookup(code, HashForCodeObject(code), true); | 1554 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
| 1486 ASSERT(e->value == NULL); | 1555 ASSERT(e->value == NULL); |
| 1487 e->value = TagLineInfo(line_info); | 1556 e->value = TagLineInfo(line_info); |
| 1488 } | 1557 } |
| 1489 | 1558 |
| 1490 | 1559 |
| 1491 } } // namespace v8::internal | 1560 } } // namespace v8::internal |
| 1492 #endif | 1561 #endif |
| OLD | NEW |