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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 header->type = type_; | 493 header->type = type_; |
494 header->alignment = align_; | 494 header->alignment = align_; |
495 PopulateHeader(header); | 495 PopulateHeader(header); |
496 } | 496 } |
497 #endif // defined(__ELF) | 497 #endif // defined(__ELF) |
498 | 498 |
499 | 499 |
500 #if defined(__MACH_O) | 500 #if defined(__MACH_O) |
501 class MachO BASE_EMBEDDED { | 501 class MachO BASE_EMBEDDED { |
502 public: | 502 public: |
503 MachO() : sections_(6) { } | 503 explicit MachO(Zone * zone) : sections_(6, zone) { } |
504 | 504 |
505 uint32_t AddSection(MachOSection* section) { | 505 uint32_t AddSection(MachOSection* section, Zone* zone) { |
506 sections_.Add(section); | 506 sections_.Add(section, zone); |
507 return sections_.length() - 1; | 507 return sections_.length() - 1; |
508 } | 508 } |
509 | 509 |
510 void Write(Writer* w, uintptr_t code_start, uintptr_t code_size) { | 510 void Write(Writer* w, uintptr_t code_start, uintptr_t code_size) { |
511 Writer::Slot<MachOHeader> header = WriteHeader(w); | 511 Writer::Slot<MachOHeader> header = WriteHeader(w); |
512 uintptr_t load_command_start = w->position(); | 512 uintptr_t load_command_start = w->position(); |
513 Writer::Slot<MachOSegmentCommand> cmd = WriteSegmentCommand(w, | 513 Writer::Slot<MachOSegmentCommand> cmd = WriteSegmentCommand(w, |
514 code_start, | 514 code_start, |
515 code_size); | 515 code_size); |
516 WriteSections(w, cmd, header, load_command_start); | 516 WriteSections(w, cmd, header, load_command_start); |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, Zone* 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(zone); |
1923 Writer w(&mach_o); | 1923 Writer w(&mach_o); |
1924 | 1924 |
1925 mach_o.AddSection(new MachOTextSection(kCodeAlignment, | 1925 mach_o.AddSection(new(zone) MachOTextSection(kCodeAlignment, |
1926 desc->CodeStart(), | 1926 desc->CodeStart(), |
1927 desc->CodeSize())); | 1927 desc->CodeSize()), |
| 1928 zone); |
1928 | 1929 |
1929 CreateDWARFSections(desc, &mach_o); | 1930 CreateDWARFSections(desc, zone, &mach_o); |
1930 | 1931 |
1931 mach_o.Write(&w, desc->CodeStart(), desc->CodeSize()); | 1932 mach_o.Write(&w, desc->CodeStart(), desc->CodeSize()); |
1932 #else | 1933 #else |
1933 ELF elf(zone); | 1934 ELF elf(zone); |
1934 Writer w(&elf); | 1935 Writer w(&elf); |
1935 | 1936 |
1936 int text_section_index = elf.AddSection( | 1937 int text_section_index = elf.AddSection( |
1937 new(zone) FullHeaderELFSection( | 1938 new(zone) FullHeaderELFSection( |
1938 ".text", | 1939 ".text", |
1939 ELFSection::TYPE_NOBITS, | 1940 ELFSection::TYPE_NOBITS, |
(...skipping 230 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 |