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 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1909 if (entry->next_ != NULL) { | 1909 if (entry->next_ != NULL) { |
1910 entry->next_->prev_ = entry->prev_; | 1910 entry->next_->prev_ = entry->prev_; |
1911 } | 1911 } |
1912 | 1912 |
1913 __jit_debug_descriptor.relevant_entry_ = entry; | 1913 __jit_debug_descriptor.relevant_entry_ = entry; |
1914 __jit_debug_descriptor.action_flag_ = JIT_UNREGISTER_FN; | 1914 __jit_debug_descriptor.action_flag_ = JIT_UNREGISTER_FN; |
1915 __jit_debug_register_code(); | 1915 __jit_debug_register_code(); |
1916 } | 1916 } |
1917 | 1917 |
1918 | 1918 |
1919 static JITCodeEntry* CreateELFObject(CodeDescription* desc, Zone* zone) { | 1919 static JITCodeEntry* CreateELFObject(CodeDescription* desc, Isolate* isolate) { |
1920 ZoneScope zone_scope(zone, DELETE_ON_EXIT); | |
1921 #ifdef __MACH_O | 1920 #ifdef __MACH_O |
1922 MachO mach_o; | 1921 MachO mach_o; |
1923 Writer w(&mach_o); | 1922 Writer w(&mach_o); |
1924 | 1923 |
1925 mach_o.AddSection(new MachOTextSection(kCodeAlignment, | 1924 mach_o.AddSection(new MachOTextSection(kCodeAlignment, |
1926 desc->CodeStart(), | 1925 desc->CodeStart(), |
1927 desc->CodeSize())); | 1926 desc->CodeSize())); |
1928 | 1927 |
1929 CreateDWARFSections(desc, &mach_o); | 1928 CreateDWARFSections(desc, &mach_o); |
1930 | 1929 |
1931 mach_o.Write(&w, desc->CodeStart(), desc->CodeSize()); | 1930 mach_o.Write(&w, desc->CodeStart(), desc->CodeSize()); |
1932 #else | 1931 #else |
1933 ELF elf(zone); | 1932 Zone zone(isolate); |
| 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, zone, &elf, text_section_index); | 1947 CreateSymbolsTable(desc, &zone, &elf, text_section_index); |
1948 | 1948 |
1949 CreateDWARFSections(desc, zone, &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 Isolate* isolate = code->GetIsolate(); |
2086 Zone* zone = code->GetIsolate()->runtime_zone(); | 2087 Zone* zone = code->GetIsolate()->runtime_zone(); |
2087 JITCodeEntry* entry = CreateELFObject(&code_desc, zone); | 2088 JITCodeEntry* entry = CreateELFObject(&code_desc, isolate); |
2088 ASSERT(!IsLineInfoTagged(entry)); | 2089 ASSERT(!IsLineInfoTagged(entry)); |
2089 | 2090 |
2090 delete lineinfo; | 2091 delete lineinfo; |
2091 e->value = entry; | 2092 e->value = entry; |
2092 | 2093 |
2093 const char* name_hint = NULL; | 2094 const char* name_hint = NULL; |
2094 bool should_dump = false; | 2095 bool should_dump = false; |
2095 if (FLAG_gdbjit_dump) { | 2096 if (FLAG_gdbjit_dump) { |
2096 if (strlen(FLAG_gdbjit_dump_filter) == 0) { | 2097 if (strlen(FLAG_gdbjit_dump_filter) == 0) { |
2097 name_hint = name; | 2098 name_hint = name; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 ScopedLock lock(mutex.Pointer()); | 2171 ScopedLock lock(mutex.Pointer()); |
2171 ASSERT(!IsLineInfoTagged(line_info)); | 2172 ASSERT(!IsLineInfoTagged(line_info)); |
2172 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 2173 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
2173 ASSERT(e->value == NULL); | 2174 ASSERT(e->value == NULL); |
2174 e->value = TagLineInfo(line_info); | 2175 e->value = TagLineInfo(line_info); |
2175 } | 2176 } |
2176 | 2177 |
2177 | 2178 |
2178 } } // namespace v8::internal | 2179 } } // namespace v8::internal |
2179 #endif | 2180 #endif |
OLD | NEW |