Chromium Code Reviews| 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) |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
I think that you need to change SConstruct to enab
| |
| 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 |
| 854 w->WriteSLEB128(pc_diff); | 866 // <file, line, column> entries (per dwarf 2.0 standard). |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
Comment is slightly confusing as we do not track c
| |
| 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 bool special_opcode_used = false; | |
| 889 uintptr_t pc_diff = info->pc_ - pc; | |
| 890 intptr_t line_diff = desc_->GetScriptLineNumber(info->pos_) - line; | |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
I think desc_->GetScriptLineNumber(info->pos_) is
| |
| 891 | |
| 892 // Compute special opcode (see DWARF 2.0 standard) | |
| 893 intptr_t special_opcode = (line_diff - line_base) + | |
| 894 (line_range * pc_diff) + opcode_base; | |
| 895 | |
| 896 // If the special opcode is < 255, it can be used as a special opcode. | |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
I prefer to write "less than" instead of "<".
BT
| |
| 897 // If line_diff is larger than the max line increment allowed for a | |
| 898 // special opcode, or if line_diff is less than the minimum line that can | |
| 899 // be added to the line register (i.e. line_base), then special opcode | |
| 900 // can't be used. | |
| 901 if ((special_opcode >= opcode_base) && (special_opcode <= 255) && | |
| 902 (line_diff <= max_line_incr) && (line_diff >= line_base)) { | |
| 903 w->Write<uint8_t>(special_opcode); | |
| 904 special_opcode_used = true; | |
| 905 } else { | |
| 906 if (pc_diff != 0) { | |
| 907 w->Write<uint8_t>(DW_LNS_ADVANCE_PC); | |
| 908 w->WriteSLEB128(pc_diff); | |
| 909 } | |
| 910 if (line_diff != 0) { | |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
line_diff is guaranteed to be non-zero now.
| |
| 911 w->Write<uint8_t>(DW_LNS_ADVANCE_LINE); | |
| 912 w->WriteSLEB128(line_diff); | |
| 913 } | |
| 914 } | |
| 915 | |
| 916 // Increment the pc and line operands. | |
| 917 pc += pc_diff; | |
| 918 line += line_diff; | |
| 919 | |
| 920 // Copy state machine registers if there is a line number difference. | |
| 921 // A copy operation is not needed if a special opcode was emitted. | |
| 922 if (!special_opcode_used && (line_diff != 0)) { | |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
line_diff is guaranteed to be non-zero now.
So y
| |
| 868 w->Write<uint8_t>(DW_LNS_COPY); | 923 w->Write<uint8_t>(DW_LNS_COPY); |
| 869 } | 924 } |
| 870 } | 925 } |
| 926 // Need to advance the pc to the end of the routine before an end sequence | |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
Empty line before comment.
| |
| 927 // can be generated (otherwise the wrong pc address gets associated with | |
| 928 // the last line). | |
| 929 | |
| 930 // Advance the pc to the end of the routine, since the end sequence opcode | |
| 931 // requires this. | |
| 932 w->Write<uint8_t>(DW_LNS_ADVANCE_PC); | |
| 933 w->WriteSLEB128(desc_->code_size() - pc); | |
| 871 WriteExtendedOpcode(w, DW_LNE_END_SEQUENCE, 0); | 934 WriteExtendedOpcode(w, DW_LNE_END_SEQUENCE, 0); |
| 872 total_length.set(static_cast<uint32_t>(w->position() - start)); | 935 total_length.set(static_cast<uint32_t>(w->position() - start)); |
| 873 return true; | 936 return true; |
| 874 } | 937 } |
| 875 | 938 |
| 876 private: | 939 private: |
| 877 void WriteExtendedOpcode(Writer* w, | 940 void WriteExtendedOpcode(Writer* w, |
| 878 DWARF2ExtendedOpcode op, | 941 DWARF2ExtendedOpcode op, |
| 879 size_t operands_size) { | 942 size_t operands_size) { |
| 880 w->Write<uint8_t>(0); | 943 w->Write<uint8_t>(0); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 961 return entry; | 1024 return entry; |
| 962 } | 1025 } |
| 963 | 1026 |
| 964 | 1027 |
| 965 static void DestroyCodeEntry(JITCodeEntry* entry) { | 1028 static void DestroyCodeEntry(JITCodeEntry* entry) { |
| 966 free(entry); | 1029 free(entry); |
| 967 } | 1030 } |
| 968 | 1031 |
| 969 | 1032 |
| 970 static void RegisterCodeEntry(JITCodeEntry* entry) { | 1033 static void RegisterCodeEntry(JITCodeEntry* entry) { |
| 1034 #if defined(DEBUG) && !defined(WIN32) | |
| 1035 static int fileNum = 0; | |
| 1036 FILE* file; | |
| 1037 if (FLAG_gdbjit_dump) { | |
| 1038 static const int kBufferSize = 64; | |
| 1039 static const char* kElfFilePre = "/tmp/elfdump"; | |
| 1040 static const char* kObjFileExt = ".o"; | |
| 1041 char buffer[64]; | |
| 1042 | |
| 1043 OS::SNPrintF(Vector<char>(buffer, kBufferSize), "%s%d%s", | |
| 1044 kElfFilePre, fileNum, kObjFileExt); | |
| 1045 file = OS::FOpen(buffer, "w"); | |
| 1046 fwrite(entry->symfile_addr_, entry->symfile_size_, 1, file); | |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
I think you can use WriteBytes() utility function
| |
| 1047 } | |
| 1048 #endif | |
| 1049 | |
| 971 entry->next_ = __jit_debug_descriptor.first_entry_; | 1050 entry->next_ = __jit_debug_descriptor.first_entry_; |
| 972 if (entry->next_ != NULL) entry->next_->prev_ = entry; | 1051 if (entry->next_ != NULL) entry->next_->prev_ = entry; |
| 973 __jit_debug_descriptor.first_entry_ = | 1052 __jit_debug_descriptor.first_entry_ = |
| 974 __jit_debug_descriptor.relevant_entry_ = entry; | 1053 __jit_debug_descriptor.relevant_entry_ = entry; |
| 975 | 1054 |
| 976 __jit_debug_descriptor.action_flag_ = JIT_REGISTER_FN; | 1055 __jit_debug_descriptor.action_flag_ = JIT_REGISTER_FN; |
| 977 __jit_debug_register_code(); | 1056 __jit_debug_register_code(); |
| 1057 | |
| 1058 #if defined(DEBUG) && !defined(WIN32) | |
| 1059 if (FLAG_gdbjit_dump) { | |
| 1060 fileNum++; | |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
it's not clear why you close the file after callin
| |
| 1061 fclose(file); | |
| 1062 } | |
| 1063 #endif | |
| 978 } | 1064 } |
| 979 | 1065 |
| 980 | 1066 |
| 981 static void UnregisterCodeEntry(JITCodeEntry* entry) { | 1067 static void UnregisterCodeEntry(JITCodeEntry* entry) { |
| 982 if (entry->prev_ != NULL) { | 1068 if (entry->prev_ != NULL) { |
| 983 entry->prev_->next_ = entry->next_; | 1069 entry->prev_->next_ = entry->next_; |
| 984 } else { | 1070 } else { |
| 985 __jit_debug_descriptor.first_entry_ = entry->next_; | 1071 __jit_debug_descriptor.first_entry_ = entry->next_; |
| 986 } | 1072 } |
| 987 | 1073 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 1018 | 1104 |
| 1019 return CreateCodeEntry(w.buffer(), w.position()); | 1105 return CreateCodeEntry(w.buffer(), w.position()); |
| 1020 } | 1106 } |
| 1021 | 1107 |
| 1022 | 1108 |
| 1023 static bool SameCodeObjects(void* key1, void* key2) { | 1109 static bool SameCodeObjects(void* key1, void* key2) { |
| 1024 return key1 == key2; | 1110 return key1 == key2; |
| 1025 } | 1111 } |
| 1026 | 1112 |
| 1027 | 1113 |
| 1028 static HashMap entries(&SameCodeObjects); | 1114 static HashMap* GetEntries() { |
| 1115 static HashMap entries(&SameCodeObjects); | |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
Google C++ Style Guide explicitly forbid non POD s
| |
| 1116 return &entries; | |
| 1117 } | |
| 1029 | 1118 |
| 1030 | 1119 |
| 1031 static uint32_t HashForCodeObject(Code* code) { | 1120 static uint32_t HashForCodeObject(Code* code) { |
| 1032 static const uintptr_t kGoldenRatio = 2654435761u; | 1121 static const uintptr_t kGoldenRatio = 2654435761u; |
| 1033 uintptr_t hash = reinterpret_cast<uintptr_t>(code->address()); | 1122 uintptr_t hash = reinterpret_cast<uintptr_t>(code->address()); |
| 1034 return static_cast<uint32_t>((hash >> kCodeAlignmentBits) * kGoldenRatio); | 1123 return static_cast<uint32_t>((hash >> kCodeAlignmentBits) * kGoldenRatio); |
| 1035 } | 1124 } |
| 1036 | 1125 |
| 1037 | 1126 |
| 1038 static const intptr_t kLineInfoTag = 0x1; | 1127 static const intptr_t kLineInfoTag = 0x1; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 } | 1160 } |
| 1072 } | 1161 } |
| 1073 | 1162 |
| 1074 | 1163 |
| 1075 void GDBJITInterface::AddCode(const char* name, | 1164 void GDBJITInterface::AddCode(const char* name, |
| 1076 Code* code, | 1165 Code* code, |
| 1077 Script* script) { | 1166 Script* script) { |
| 1078 if (!FLAG_gdbjit) return; | 1167 if (!FLAG_gdbjit) return; |
| 1079 AssertNoAllocation no_gc; | 1168 AssertNoAllocation no_gc; |
| 1080 | 1169 |
| 1081 HashMap::Entry* e = entries.Lookup(code, HashForCodeObject(code), true); | 1170 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
| 1082 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; | 1171 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; |
| 1083 | 1172 |
| 1084 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); | 1173 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); |
| 1085 CodeDescription code_desc(name, | 1174 CodeDescription code_desc(name, |
| 1086 code, | 1175 code, |
| 1087 script != NULL ? Handle<Script>(script) | 1176 script != NULL ? Handle<Script>(script) |
| 1088 : Handle<Script>(), | 1177 : Handle<Script>(), |
| 1089 lineinfo); | 1178 lineinfo); |
| 1090 | 1179 |
| 1091 if (!FLAG_gdbjit_full && !code_desc.is_line_info_available()) { | 1180 if (!FLAG_gdbjit_full && !code_desc.is_line_info_available()) { |
| 1092 delete lineinfo; | 1181 delete lineinfo; |
| 1093 entries.Remove(code, HashForCodeObject(code)); | 1182 GetEntries()->Remove(code, HashForCodeObject(code)); |
| 1094 return; | 1183 return; |
| 1095 } | 1184 } |
| 1096 | 1185 |
| 1097 JITCodeEntry* entry = CreateELFObject(&code_desc); | 1186 JITCodeEntry* entry = CreateELFObject(&code_desc); |
| 1098 ASSERT(!IsLineInfoTagged(entry)); | 1187 ASSERT(!IsLineInfoTagged(entry)); |
| 1099 | 1188 |
| 1100 delete lineinfo; | 1189 delete lineinfo; |
| 1101 e->value = entry; | 1190 e->value = entry; |
| 1102 | 1191 |
| 1103 RegisterCodeEntry(entry); | 1192 RegisterCodeEntry(entry); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1135 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { | 1224 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { |
| 1136 if (!FLAG_gdbjit) return; | 1225 if (!FLAG_gdbjit) return; |
| 1137 | 1226 |
| 1138 AddCode(tag, "", code); | 1227 AddCode(tag, "", code); |
| 1139 } | 1228 } |
| 1140 | 1229 |
| 1141 | 1230 |
| 1142 void GDBJITInterface::RemoveCode(Code* code) { | 1231 void GDBJITInterface::RemoveCode(Code* code) { |
| 1143 if (!FLAG_gdbjit) return; | 1232 if (!FLAG_gdbjit) return; |
| 1144 | 1233 |
| 1145 HashMap::Entry* e = entries.Lookup(code, HashForCodeObject(code), false); | 1234 HashMap::Entry* e =GetEntries()->Lookup(code, HashForCodeObject(code), false); |
|
Vyacheslav Egorov (Chromium)
2011/02/01 12:49:51
after = add space
| |
| 1146 if (e == NULL) return; | 1235 if (e == NULL) return; |
| 1147 | 1236 |
| 1148 if (IsLineInfoTagged(e->value)) { | 1237 if (IsLineInfoTagged(e->value)) { |
| 1149 delete UntagLineInfo(e->value); | 1238 delete UntagLineInfo(e->value); |
| 1150 } else { | 1239 } else { |
| 1151 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); | 1240 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); |
| 1152 UnregisterCodeEntry(entry); | 1241 UnregisterCodeEntry(entry); |
| 1153 DestroyCodeEntry(entry); | 1242 DestroyCodeEntry(entry); |
| 1154 } | 1243 } |
| 1155 e->value = NULL; | 1244 e->value = NULL; |
| 1156 entries.Remove(code, HashForCodeObject(code)); | 1245 GetEntries()->Remove(code, HashForCodeObject(code)); |
| 1157 } | 1246 } |
| 1158 | 1247 |
| 1159 | 1248 |
| 1160 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, | 1249 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, |
| 1161 GDBJITLineInfo* line_info) { | 1250 GDBJITLineInfo* line_info) { |
| 1162 ASSERT(!IsLineInfoTagged(line_info)); | 1251 ASSERT(!IsLineInfoTagged(line_info)); |
| 1163 HashMap::Entry* e = entries.Lookup(code, HashForCodeObject(code), true); | 1252 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
| 1164 ASSERT(e->value == NULL); | 1253 ASSERT(e->value == NULL); |
| 1165 e->value = TagLineInfo(line_info); | 1254 e->value = TagLineInfo(line_info); |
| 1166 } | 1255 } |
| 1167 | 1256 |
| 1168 | 1257 |
| 1169 } } // namespace v8::internal | 1258 } } // namespace v8::internal |
| 1170 #endif | 1259 #endif |
| OLD | NEW |