OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 Type type_; | 348 Type type_; |
349 uintptr_t align_; | 349 uintptr_t align_; |
350 uint16_t index_; | 350 uint16_t index_; |
351 }; | 351 }; |
352 #endif // defined(__ELF) | 352 #endif // defined(__ELF) |
353 | 353 |
354 | 354 |
355 #if defined(__MACH_O) | 355 #if defined(__MACH_O) |
356 class MachOTextSection : public MachOSection { | 356 class MachOTextSection : public MachOSection { |
357 public: | 357 public: |
358 MachOTextSection(uintptr_t align, | 358 MachOTextSection(uint32_t align, uintptr_t addr, uintptr_t size) |
359 uintptr_t addr, | 359 : MachOSection("__text", "__TEXT", align, |
360 uintptr_t size) | |
361 : MachOSection("__text", | |
362 "__TEXT", | |
363 align, | |
364 MachOSection::S_REGULAR | | 360 MachOSection::S_REGULAR | |
365 MachOSection::S_ATTR_SOME_INSTRUCTIONS | | 361 MachOSection::S_ATTR_SOME_INSTRUCTIONS | |
366 MachOSection::S_ATTR_PURE_INSTRUCTIONS), | 362 MachOSection::S_ATTR_PURE_INSTRUCTIONS), |
367 addr_(addr), | 363 addr_(addr), |
368 size_(size) { } | 364 size_(size) {} |
369 | 365 |
370 protected: | 366 protected: |
371 virtual void PopulateHeader(Writer::Slot<Header> header) { | 367 virtual void PopulateHeader(Writer::Slot<Header> header) { |
372 MachOSection::PopulateHeader(header); | 368 MachOSection::PopulateHeader(header); |
373 header->addr = addr_; | 369 header->addr = addr_; |
374 header->size = size_; | 370 header->size = size_; |
375 } | 371 } |
376 | 372 |
377 private: | 373 private: |
378 uintptr_t addr_; | 374 uintptr_t addr_; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 } | 577 } |
582 | 578 |
583 | 579 |
584 void WriteSections(Writer* w, | 580 void WriteSections(Writer* w, |
585 Writer::Slot<MachOSegmentCommand> cmd, | 581 Writer::Slot<MachOSegmentCommand> cmd, |
586 Writer::Slot<MachOHeader> header, | 582 Writer::Slot<MachOHeader> header, |
587 uintptr_t load_command_start) { | 583 uintptr_t load_command_start) { |
588 Writer::Slot<MachOSection::Header> headers = | 584 Writer::Slot<MachOSection::Header> headers = |
589 w->CreateSlotsHere<MachOSection::Header>(sections_.length()); | 585 w->CreateSlotsHere<MachOSection::Header>(sections_.length()); |
590 cmd->fileoff = w->position(); | 586 cmd->fileoff = w->position(); |
591 header->sizeofcmds = w->position() - load_command_start; | 587 header->sizeofcmds = |
| 588 static_cast<uint32_t>(w->position() - load_command_start); |
592 for (int section = 0; section < sections_.length(); ++section) { | 589 for (int section = 0; section < sections_.length(); ++section) { |
593 sections_[section]->PopulateHeader(headers.at(section)); | 590 sections_[section]->PopulateHeader(headers.at(section)); |
594 sections_[section]->WriteBody(headers.at(section), w); | 591 sections_[section]->WriteBody(headers.at(section), w); |
595 } | 592 } |
596 cmd->filesize = w->position() - (uintptr_t)cmd->fileoff; | 593 cmd->filesize = w->position() - (uintptr_t)cmd->fileoff; |
597 } | 594 } |
598 | 595 |
599 Zone* zone_; | 596 Zone* zone_; |
600 ZoneList<MachOSection*> sections_; | 597 ZoneList<MachOSection*> sections_; |
601 }; | 598 }; |
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data); | 2157 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data); |
2161 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info); | 2158 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info); |
2162 break; | 2159 break; |
2163 } | 2160 } |
2164 } | 2161 } |
2165 } | 2162 } |
2166 #endif | 2163 #endif |
2167 } // namespace GDBJITInterface | 2164 } // namespace GDBJITInterface |
2168 } // namespace internal | 2165 } // namespace internal |
2169 } // namespace v8 | 2166 } // namespace v8 |
OLD | NEW |