Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: src/gdb-jit.cc

Issue 1111733002: [clang] Use -Wshorten-64-to-32 to enable warnings about 64bit to 32bit truncations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Win warnings. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/flags.cc ('k') | src/snapshot/mksnapshot.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 template<typename THeader> 173 template<typename THeader>
174 class DebugSectionBase : public ZoneObject { 174 class DebugSectionBase : public ZoneObject {
175 public: 175 public:
176 virtual ~DebugSectionBase() { } 176 virtual ~DebugSectionBase() { }
177 177
178 virtual void WriteBody(Writer::Slot<THeader> header, Writer* writer) { 178 virtual void WriteBody(Writer::Slot<THeader> header, Writer* writer) {
179 uintptr_t start = writer->position(); 179 uintptr_t start = writer->position();
180 if (WriteBodyInternal(writer)) { 180 if (WriteBodyInternal(writer)) {
181 uintptr_t end = writer->position(); 181 uintptr_t end = writer->position();
182 header->offset = start; 182 header->offset = static_cast<uint32_t>(start);
183 #if defined(__MACH_O) 183 #if defined(__MACH_O)
184 header->addr = 0; 184 header->addr = 0;
185 #endif 185 #endif
186 header->size = end - start; 186 header->size = end - start;
187 } 187 }
188 } 188 }
189 189
190 virtual bool WriteBodyInternal(Writer* writer) { 190 virtual bool WriteBodyInternal(Writer* writer) {
191 return false; 191 return false;
192 } 192 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 458
459 Writer* writer_; 459 Writer* writer_;
460 460
461 uintptr_t offset_; 461 uintptr_t offset_;
462 uintptr_t size_; 462 uintptr_t size_;
463 }; 463 };
464 464
465 465
466 void ELFSection::PopulateHeader(Writer::Slot<ELFSection::Header> header, 466 void ELFSection::PopulateHeader(Writer::Slot<ELFSection::Header> header,
467 ELFStringTable* strtab) { 467 ELFStringTable* strtab) {
468 header->name = strtab->Add(name_); 468 header->name = static_cast<uint32_t>(strtab->Add(name_));
469 header->type = type_; 469 header->type = type_;
470 header->alignment = align_; 470 header->alignment = align_;
471 PopulateHeader(header); 471 PopulateHeader(header);
472 } 472 }
473 #endif // defined(__ELF) 473 #endif // defined(__ELF)
474 474
475 475
476 #if defined(__MACH_O) 476 #if defined(__MACH_O)
477 class MachO BASE_EMBEDDED { 477 class MachO BASE_EMBEDDED {
478 public: 478 public:
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 uint8_t info; 806 uint8_t info;
807 uint8_t other; 807 uint8_t other;
808 uint16_t section; 808 uint16_t section;
809 uintptr_t value; 809 uintptr_t value;
810 uintptr_t size; 810 uintptr_t size;
811 }; 811 };
812 #endif 812 #endif
813 813
814 void Write(Writer::Slot<SerializedLayout> s, ELFStringTable* t) { 814 void Write(Writer::Slot<SerializedLayout> s, ELFStringTable* t) {
815 // Convert symbol names from strings to indexes in the string table. 815 // Convert symbol names from strings to indexes in the string table.
816 s->name = t->Add(name); 816 s->name = static_cast<uint32_t>(t->Add(name));
817 s->value = value; 817 s->value = value;
818 s->size = size; 818 s->size = size;
819 s->info = info; 819 s->info = info;
820 s->other = other; 820 s->other = other;
821 s->section = section; 821 s->section = section;
822 } 822 }
823 823
824 private: 824 private:
825 const char* name; 825 const char* name;
826 uintptr_t value; 826 uintptr_t value;
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 int initial_position) { 1631 int initial_position) {
1632 uint32_t align = (w->position() - initial_position) % kPointerSize; 1632 uint32_t align = (w->position() - initial_position) % kPointerSize;
1633 1633
1634 if (align != 0) { 1634 if (align != 0) {
1635 for (uint32_t i = 0; i < (kPointerSize - align); i++) { 1635 for (uint32_t i = 0; i < (kPointerSize - align); i++) {
1636 w->Write<uint8_t>(DW_CFA_NOP); 1636 w->Write<uint8_t>(DW_CFA_NOP);
1637 } 1637 }
1638 } 1638 }
1639 1639
1640 DCHECK((w->position() - initial_position) % kPointerSize == 0); 1640 DCHECK((w->position() - initial_position) % kPointerSize == 0);
1641 length_slot->set(w->position() - initial_position); 1641 length_slot->set(static_cast<uint32_t>(w->position() - initial_position));
1642 } 1642 }
1643 1643
1644 1644
1645 UnwindInfoSection::UnwindInfoSection(CodeDescription* desc) 1645 UnwindInfoSection::UnwindInfoSection(CodeDescription* desc)
1646 #ifdef __ELF 1646 #ifdef __ELF
1647 : ELFSection(".eh_frame", TYPE_X86_64_UNWIND, 1), 1647 : ELFSection(".eh_frame", TYPE_X86_64_UNWIND, 1),
1648 #else 1648 #else
1649 : MachOSection("__eh_frame", "__TEXT", sizeof(uintptr_t), 1649 : MachOSection("__eh_frame", "__TEXT", sizeof(uintptr_t),
1650 MachOSection::S_REGULAR), 1650 MachOSection::S_REGULAR),
1651 #endif 1651 #endif
1652 desc_(desc) { } 1652 desc_(desc) { }
1653 1653
1654 int UnwindInfoSection::WriteCIE(Writer* w) { 1654 int UnwindInfoSection::WriteCIE(Writer* w) {
1655 Writer::Slot<uint32_t> cie_length_slot = w->CreateSlotHere<uint32_t>(); 1655 Writer::Slot<uint32_t> cie_length_slot = w->CreateSlotHere<uint32_t>();
1656 uint32_t cie_position = w->position(); 1656 uint32_t cie_position = static_cast<uint32_t>(w->position());
1657 1657
1658 // Write out the CIE header. Currently no 'common instructions' are 1658 // Write out the CIE header. Currently no 'common instructions' are
1659 // emitted onto the CIE; every FDE has its own set of instructions. 1659 // emitted onto the CIE; every FDE has its own set of instructions.
1660 1660
1661 w->Write<uint32_t>(CIE_ID); 1661 w->Write<uint32_t>(CIE_ID);
1662 w->Write<uint8_t>(CIE_VERSION); 1662 w->Write<uint8_t>(CIE_VERSION);
1663 w->Write<uint8_t>(0); // Null augmentation string. 1663 w->Write<uint8_t>(0); // Null augmentation string.
1664 w->WriteSLEB128(CODE_ALIGN_FACTOR); 1664 w->WriteSLEB128(CODE_ALIGN_FACTOR);
1665 w->WriteSLEB128(DATA_ALIGN_FACTOR); 1665 w->WriteSLEB128(DATA_ALIGN_FACTOR);
1666 w->Write<uint8_t>(RETURN_ADDRESS_REGISTER); 1666 w->Write<uint8_t>(RETURN_ADDRESS_REGISTER);
1667 1667
1668 WriteLength(w, &cie_length_slot, cie_position); 1668 WriteLength(w, &cie_length_slot, cie_position);
1669 1669
1670 return cie_position; 1670 return cie_position;
1671 } 1671 }
1672 1672
1673 1673
1674 void UnwindInfoSection::WriteFDE(Writer* w, int cie_position) { 1674 void UnwindInfoSection::WriteFDE(Writer* w, int cie_position) {
1675 // The only FDE for this function. The CFA is the current RBP. 1675 // The only FDE for this function. The CFA is the current RBP.
1676 Writer::Slot<uint32_t> fde_length_slot = w->CreateSlotHere<uint32_t>(); 1676 Writer::Slot<uint32_t> fde_length_slot = w->CreateSlotHere<uint32_t>();
1677 int fde_position = w->position(); 1677 int fde_position = static_cast<uint32_t>(w->position());
1678 w->Write<int32_t>(fde_position - cie_position + 4); 1678 w->Write<int32_t>(fde_position - cie_position + 4);
1679 1679
1680 w->Write<uintptr_t>(desc_->CodeStart()); 1680 w->Write<uintptr_t>(desc_->CodeStart());
1681 w->Write<uintptr_t>(desc_->CodeSize()); 1681 w->Write<uintptr_t>(desc_->CodeSize());
1682 1682
1683 WriteFDEStateOnEntry(w); 1683 WriteFDEStateOnEntry(w);
1684 WriteFDEStateAfterRBPPush(w); 1684 WriteFDEStateAfterRBPPush(w);
1685 WriteFDEStateAfterRBPSet(w); 1685 WriteFDEStateAfterRBPSet(w);
1686 WriteFDEStateAfterRBPPop(w); 1686 WriteFDEStateAfterRBPPop(w);
1687 1687
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 JITCodeEntry* entry, bool dump_if_enabled, 2060 JITCodeEntry* entry, bool dump_if_enabled,
2061 const char* name_hint) { 2061 const char* name_hint) {
2062 #if defined(DEBUG) && !V8_OS_WIN 2062 #if defined(DEBUG) && !V8_OS_WIN
2063 static int file_num = 0; 2063 static int file_num = 0;
2064 if (FLAG_gdbjit_dump && dump_if_enabled) { 2064 if (FLAG_gdbjit_dump && dump_if_enabled) {
2065 static const int kMaxFileNameSize = 64; 2065 static const int kMaxFileNameSize = 64;
2066 char file_name[64]; 2066 char file_name[64];
2067 2067
2068 SNPrintF(Vector<char>(file_name, kMaxFileNameSize), "/tmp/elfdump%s%d.o", 2068 SNPrintF(Vector<char>(file_name, kMaxFileNameSize), "/tmp/elfdump%s%d.o",
2069 (name_hint != NULL) ? name_hint : "", file_num++); 2069 (name_hint != NULL) ? name_hint : "", file_num++);
2070 WriteBytes(file_name, entry->symfile_addr_, entry->symfile_size_); 2070 WriteBytes(file_name, entry->symfile_addr_,
2071 static_cast<int>(entry->symfile_size_));
2071 } 2072 }
2072 #endif 2073 #endif
2073 2074
2074 CodeMap::Locator cur; 2075 CodeMap::Locator cur;
2075 CHECK(map->Insert(range, &cur)); 2076 CHECK(map->Insert(range, &cur));
2076 cur.set_value(entry); 2077 cur.set_value(entry);
2077 2078
2078 RegisterCodeEntry(entry); 2079 RegisterCodeEntry(entry);
2079 } 2080 }
2080 2081
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data); 2160 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data);
2160 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info); 2161 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info);
2161 break; 2162 break;
2162 } 2163 }
2163 } 2164 }
2164 } 2165 }
2165 #endif 2166 #endif
2166 } // namespace GDBJITInterface 2167 } // namespace GDBJITInterface
2167 } // namespace internal 2168 } // namespace internal
2168 } // namespace v8 2169 } // namespace v8
OLDNEW
« no previous file with comments | « src/flags.cc ('k') | src/snapshot/mksnapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698