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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 GDBJITLineInfo* lineinfo_; | 1012 GDBJITLineInfo* lineinfo_; |
1013 GDBJITInterface::CodeTag tag_; | 1013 GDBJITInterface::CodeTag tag_; |
1014 CompilationInfo* info_; | 1014 CompilationInfo* info_; |
1015 #ifdef V8_TARGET_ARCH_X64 | 1015 #ifdef V8_TARGET_ARCH_X64 |
1016 uintptr_t stack_state_start_addresses_[STACK_STATE_MAX]; | 1016 uintptr_t stack_state_start_addresses_[STACK_STATE_MAX]; |
1017 #endif | 1017 #endif |
1018 }; | 1018 }; |
1019 | 1019 |
1020 #if defined(__ELF) | 1020 #if defined(__ELF) |
1021 static void CreateSymbolsTable(CodeDescription* desc, | 1021 static void CreateSymbolsTable(CodeDescription* desc, |
| 1022 Zone* zone, |
1022 ELF* elf, | 1023 ELF* elf, |
1023 int text_section_index) { | 1024 int text_section_index) { |
1024 Zone* zone = desc->info()->zone(); | |
1025 ELFSymbolTable* symtab = new(zone) ELFSymbolTable(".symtab", zone); | 1025 ELFSymbolTable* symtab = new(zone) ELFSymbolTable(".symtab", zone); |
1026 ELFStringTable* strtab = new(zone) ELFStringTable(".strtab"); | 1026 ELFStringTable* strtab = new(zone) ELFStringTable(".strtab"); |
1027 | 1027 |
1028 // Symbol table should be followed by the linked string table. | 1028 // Symbol table should be followed by the linked string table. |
1029 elf->AddSection(symtab, zone); | 1029 elf->AddSection(symtab, zone); |
1030 elf->AddSection(strtab, zone); | 1030 elf->AddSection(strtab, zone); |
1031 | 1031 |
1032 symtab->Add(ELFSymbol("V8 Code", | 1032 symtab->Add(ELFSymbol("V8 Code", |
1033 0, | 1033 0, |
1034 0, | 1034 0, |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 | 1782 |
1783 bool UnwindInfoSection::WriteBodyInternal(Writer* w) { | 1783 bool UnwindInfoSection::WriteBodyInternal(Writer* w) { |
1784 uint32_t cie_position = WriteCIE(w); | 1784 uint32_t cie_position = WriteCIE(w); |
1785 WriteFDE(w, cie_position); | 1785 WriteFDE(w, cie_position); |
1786 return true; | 1786 return true; |
1787 } | 1787 } |
1788 | 1788 |
1789 | 1789 |
1790 #endif // V8_TARGET_ARCH_X64 | 1790 #endif // V8_TARGET_ARCH_X64 |
1791 | 1791 |
1792 static void CreateDWARFSections(CodeDescription* desc, DebugObject* obj) { | 1792 static void CreateDWARFSections(CodeDescription* desc, |
1793 Zone* zone = desc->info()->zone(); | 1793 Zone* zone, |
| 1794 DebugObject* obj) { |
1794 if (desc->IsLineInfoAvailable()) { | 1795 if (desc->IsLineInfoAvailable()) { |
1795 obj->AddSection(new(zone) DebugInfoSection(desc), zone); | 1796 obj->AddSection(new(zone) DebugInfoSection(desc), zone); |
1796 obj->AddSection(new(zone) DebugAbbrevSection(desc), zone); | 1797 obj->AddSection(new(zone) DebugAbbrevSection(desc), zone); |
1797 obj->AddSection(new(zone) DebugLineSection(desc), zone); | 1798 obj->AddSection(new(zone) DebugLineSection(desc), zone); |
1798 } | 1799 } |
1799 #ifdef V8_TARGET_ARCH_X64 | 1800 #ifdef V8_TARGET_ARCH_X64 |
1800 obj->AddSection(new(zone) UnwindInfoSection(desc), zone); | 1801 obj->AddSection(new(zone) UnwindInfoSection(desc), zone); |
1801 #endif | 1802 #endif |
1802 } | 1803 } |
1803 | 1804 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 if (entry->next_ != NULL) { | 1909 if (entry->next_ != NULL) { |
1909 entry->next_->prev_ = entry->prev_; | 1910 entry->next_->prev_ = entry->prev_; |
1910 } | 1911 } |
1911 | 1912 |
1912 __jit_debug_descriptor.relevant_entry_ = entry; | 1913 __jit_debug_descriptor.relevant_entry_ = entry; |
1913 __jit_debug_descriptor.action_flag_ = JIT_UNREGISTER_FN; | 1914 __jit_debug_descriptor.action_flag_ = JIT_UNREGISTER_FN; |
1914 __jit_debug_register_code(); | 1915 __jit_debug_register_code(); |
1915 } | 1916 } |
1916 | 1917 |
1917 | 1918 |
1918 static JITCodeEntry* CreateELFObject(CodeDescription* desc) { | 1919 static JITCodeEntry* CreateELFObject(CodeDescription* desc, Zone* zone) { |
1919 Zone* zone = desc->info()->zone(); | |
1920 ZoneScope zone_scope(zone, DELETE_ON_EXIT); | 1920 ZoneScope zone_scope(zone, DELETE_ON_EXIT); |
1921 #ifdef __MACH_O | 1921 #ifdef __MACH_O |
1922 MachO mach_o; | 1922 MachO mach_o; |
1923 Writer w(&mach_o); | 1923 Writer w(&mach_o); |
1924 | 1924 |
1925 mach_o.AddSection(new MachOTextSection(kCodeAlignment, | 1925 mach_o.AddSection(new MachOTextSection(kCodeAlignment, |
1926 desc->CodeStart(), | 1926 desc->CodeStart(), |
1927 desc->CodeSize())); | 1927 desc->CodeSize())); |
1928 | 1928 |
1929 CreateDWARFSections(desc, &mach_o); | 1929 CreateDWARFSections(desc, &mach_o); |
1930 | 1930 |
1931 mach_o.Write(&w, desc->CodeStart(), desc->CodeSize()); | 1931 mach_o.Write(&w, desc->CodeStart(), desc->CodeSize()); |
1932 #else | 1932 #else |
1933 ELF elf(zone); | 1933 ELF elf(zone); |
1934 Writer w(&elf); | 1934 Writer w(&elf); |
1935 | 1935 |
1936 int text_section_index = elf.AddSection( | 1936 int text_section_index = elf.AddSection( |
1937 new(zone) FullHeaderELFSection( | 1937 new(zone) FullHeaderELFSection( |
1938 ".text", | 1938 ".text", |
1939 ELFSection::TYPE_NOBITS, | 1939 ELFSection::TYPE_NOBITS, |
1940 kCodeAlignment, | 1940 kCodeAlignment, |
1941 desc->CodeStart(), | 1941 desc->CodeStart(), |
1942 0, | 1942 0, |
1943 desc->CodeSize(), | 1943 desc->CodeSize(), |
1944 ELFSection::FLAG_ALLOC | ELFSection::FLAG_EXEC), | 1944 ELFSection::FLAG_ALLOC | ELFSection::FLAG_EXEC), |
1945 zone); | 1945 zone); |
1946 | 1946 |
1947 CreateSymbolsTable(desc, &elf, text_section_index); | 1947 CreateSymbolsTable(desc, zone, &elf, text_section_index); |
1948 | 1948 |
1949 CreateDWARFSections(desc, &elf); | 1949 CreateDWARFSections(desc, zone, &elf); |
1950 | 1950 |
1951 elf.Write(&w); | 1951 elf.Write(&w); |
1952 #endif | 1952 #endif |
1953 | 1953 |
1954 return CreateCodeEntry(w.buffer(), w.position()); | 1954 return CreateCodeEntry(w.buffer(), w.position()); |
1955 } | 1955 } |
1956 | 1956 |
1957 | 1957 |
1958 static bool SameCodeObjects(void* key1, void* key2) { | 1958 static bool SameCodeObjects(void* key1, void* key2) { |
1959 return key1 == key2; | 1959 return key1 == key2; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2076 tag, | 2076 tag, |
2077 info); | 2077 info); |
2078 | 2078 |
2079 if (!FLAG_gdbjit_full && !code_desc.IsLineInfoAvailable()) { | 2079 if (!FLAG_gdbjit_full && !code_desc.IsLineInfoAvailable()) { |
2080 delete lineinfo; | 2080 delete lineinfo; |
2081 GetEntries()->Remove(code, HashForCodeObject(code)); | 2081 GetEntries()->Remove(code, HashForCodeObject(code)); |
2082 return; | 2082 return; |
2083 } | 2083 } |
2084 | 2084 |
2085 AddUnwindInfo(&code_desc); | 2085 AddUnwindInfo(&code_desc); |
2086 JITCodeEntry* entry = CreateELFObject(&code_desc); | 2086 Zone* zone = code->GetIsolate()->runtime_zone(); |
| 2087 JITCodeEntry* entry = CreateELFObject(&code_desc, zone); |
2087 ASSERT(!IsLineInfoTagged(entry)); | 2088 ASSERT(!IsLineInfoTagged(entry)); |
2088 | 2089 |
2089 delete lineinfo; | 2090 delete lineinfo; |
2090 e->value = entry; | 2091 e->value = entry; |
2091 | 2092 |
2092 const char* name_hint = NULL; | 2093 const char* name_hint = NULL; |
2093 bool should_dump = false; | 2094 bool should_dump = false; |
2094 if (FLAG_gdbjit_dump) { | 2095 if (FLAG_gdbjit_dump) { |
2095 if (strlen(FLAG_gdbjit_dump_filter) == 0) { | 2096 if (strlen(FLAG_gdbjit_dump_filter) == 0) { |
2096 name_hint = name; | 2097 name_hint = name; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 ScopedLock lock(mutex.Pointer()); | 2170 ScopedLock lock(mutex.Pointer()); |
2170 ASSERT(!IsLineInfoTagged(line_info)); | 2171 ASSERT(!IsLineInfoTagged(line_info)); |
2171 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 2172 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
2172 ASSERT(e->value == NULL); | 2173 ASSERT(e->value == NULL); |
2173 e->value = TagLineInfo(line_info); | 2174 e->value = TagLineInfo(line_info); |
2174 } | 2175 } |
2175 | 2176 |
2176 | 2177 |
2177 } } // namespace v8::internal | 2178 } } // namespace v8::internal |
2178 #endif | 2179 #endif |
OLD | NEW |