| 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 #ifdef ENABLE_GDB_JIT_INTERFACE | 5 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 6 #include "src/v8.h" | 6 #include "src/v8.h" |
| 7 | 7 |
| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 DebugObject* debug_object() { return debug_object_; } | 109 DebugObject* debug_object() { return debug_object_; } |
| 110 | 110 |
| 111 byte* buffer() { return buffer_; } | 111 byte* buffer() { return buffer_; } |
| 112 | 112 |
| 113 void Align(uintptr_t align) { | 113 void Align(uintptr_t align) { |
| 114 uintptr_t delta = position_ % align; | 114 uintptr_t delta = position_ % align; |
| 115 if (delta == 0) return; | 115 if (delta == 0) return; |
| 116 uintptr_t padding = align - delta; | 116 uintptr_t padding = align - delta; |
| 117 Ensure(position_ += padding); | 117 Ensure(position_ += padding); |
| 118 ASSERT((position_ % align) == 0); | 118 DCHECK((position_ % align) == 0); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void WriteULEB128(uintptr_t value) { | 121 void WriteULEB128(uintptr_t value) { |
| 122 do { | 122 do { |
| 123 uint8_t byte = value & 0x7F; | 123 uint8_t byte = value & 0x7F; |
| 124 value >>= 7; | 124 value >>= 7; |
| 125 if (value != 0) byte |= 0x80; | 125 if (value != 0) byte |= 0x80; |
| 126 Write<uint8_t>(byte); | 126 Write<uint8_t>(byte); |
| 127 } while (value != 0); | 127 } while (value != 0); |
| 128 } | 128 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 148 do { | 148 do { |
| 149 Write<char>(*str); | 149 Write<char>(*str); |
| 150 } while (*str++); | 150 } while (*str++); |
| 151 } | 151 } |
| 152 | 152 |
| 153 private: | 153 private: |
| 154 template<typename T> friend class Slot; | 154 template<typename T> friend class Slot; |
| 155 | 155 |
| 156 template<typename T> | 156 template<typename T> |
| 157 T* RawSlotAt(uintptr_t offset) { | 157 T* RawSlotAt(uintptr_t offset) { |
| 158 ASSERT(offset < capacity_ && offset + sizeof(T) <= capacity_); | 158 DCHECK(offset < capacity_ && offset + sizeof(T) <= capacity_); |
| 159 return reinterpret_cast<T*>(&buffer_[offset]); | 159 return reinterpret_cast<T*>(&buffer_[offset]); |
| 160 } | 160 } |
| 161 | 161 |
| 162 DebugObject* debug_object_; | 162 DebugObject* debug_object_; |
| 163 uintptr_t position_; | 163 uintptr_t position_; |
| 164 uintptr_t capacity_; | 164 uintptr_t capacity_; |
| 165 byte* buffer_; | 165 byte* buffer_; |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 class ELFStringTable; | 168 class ELFStringTable; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 MachOSection(const char* name, | 225 MachOSection(const char* name, |
| 226 const char* segment, | 226 const char* segment, |
| 227 uintptr_t align, | 227 uintptr_t align, |
| 228 uint32_t flags) | 228 uint32_t flags) |
| 229 : name_(name), | 229 : name_(name), |
| 230 segment_(segment), | 230 segment_(segment), |
| 231 align_(align), | 231 align_(align), |
| 232 flags_(flags) { | 232 flags_(flags) { |
| 233 if (align_ != 0) { | 233 if (align_ != 0) { |
| 234 ASSERT(IsPowerOf2(align)); | 234 DCHECK(IsPowerOf2(align)); |
| 235 align_ = WhichPowerOf2(align_); | 235 align_ = WhichPowerOf2(align_); |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 virtual ~MachOSection() { } | 239 virtual ~MachOSection() { } |
| 240 | 240 |
| 241 virtual void PopulateHeader(Writer::Slot<Header> header) { | 241 virtual void PopulateHeader(Writer::Slot<Header> header) { |
| 242 header->addr = 0; | 242 header->addr = 0; |
| 243 header->size = 0; | 243 header->size = 0; |
| 244 header->offset = 0; | 244 header->offset = 0; |
| 245 header->align = align_; | 245 header->align = align_; |
| 246 header->reloff = 0; | 246 header->reloff = 0; |
| 247 header->nreloc = 0; | 247 header->nreloc = 0; |
| 248 header->flags = flags_; | 248 header->flags = flags_; |
| 249 header->reserved1 = 0; | 249 header->reserved1 = 0; |
| 250 header->reserved2 = 0; | 250 header->reserved2 = 0; |
| 251 memset(header->sectname, 0, sizeof(header->sectname)); | 251 memset(header->sectname, 0, sizeof(header->sectname)); |
| 252 memset(header->segname, 0, sizeof(header->segname)); | 252 memset(header->segname, 0, sizeof(header->segname)); |
| 253 ASSERT(strlen(name_) < sizeof(header->sectname)); | 253 DCHECK(strlen(name_) < sizeof(header->sectname)); |
| 254 ASSERT(strlen(segment_) < sizeof(header->segname)); | 254 DCHECK(strlen(segment_) < sizeof(header->segname)); |
| 255 strncpy(header->sectname, name_, sizeof(header->sectname)); | 255 strncpy(header->sectname, name_, sizeof(header->sectname)); |
| 256 strncpy(header->segname, segment_, sizeof(header->segname)); | 256 strncpy(header->segname, segment_, sizeof(header->segname)); |
| 257 } | 257 } |
| 258 | 258 |
| 259 private: | 259 private: |
| 260 const char* name_; | 260 const char* name_; |
| 261 const char* segment_; | 261 const char* segment_; |
| 262 uintptr_t align_; | 262 uintptr_t align_; |
| 263 uint32_t flags_; | 263 uint32_t flags_; |
| 264 }; | 264 }; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 436 |
| 437 // First entry in the string table should be an empty string. | 437 // First entry in the string table should be an empty string. |
| 438 WriteString(""); | 438 WriteString(""); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void DetachWriter() { | 441 void DetachWriter() { |
| 442 writer_ = NULL; | 442 writer_ = NULL; |
| 443 } | 443 } |
| 444 | 444 |
| 445 virtual void WriteBody(Writer::Slot<Header> header, Writer* w) { | 445 virtual void WriteBody(Writer::Slot<Header> header, Writer* w) { |
| 446 ASSERT(writer_ == NULL); | 446 DCHECK(writer_ == NULL); |
| 447 header->offset = offset_; | 447 header->offset = offset_; |
| 448 header->size = size_; | 448 header->size = size_; |
| 449 } | 449 } |
| 450 | 450 |
| 451 private: | 451 private: |
| 452 void WriteString(const char* str) { | 452 void WriteString(const char* str) { |
| 453 uintptr_t written = 0; | 453 uintptr_t written = 0; |
| 454 do { | 454 do { |
| 455 writer_->Write(*str); | 455 writer_->Write(*str); |
| 456 written++; | 456 written++; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 uint32_t flags; | 529 uint32_t flags; |
| 530 }; | 530 }; |
| 531 | 531 |
| 532 enum MachOLoadCommandCmd { | 532 enum MachOLoadCommandCmd { |
| 533 LC_SEGMENT_32 = 0x00000001u, | 533 LC_SEGMENT_32 = 0x00000001u, |
| 534 LC_SEGMENT_64 = 0x00000019u | 534 LC_SEGMENT_64 = 0x00000019u |
| 535 }; | 535 }; |
| 536 | 536 |
| 537 | 537 |
| 538 Writer::Slot<MachOHeader> WriteHeader(Writer* w) { | 538 Writer::Slot<MachOHeader> WriteHeader(Writer* w) { |
| 539 ASSERT(w->position() == 0); | 539 DCHECK(w->position() == 0); |
| 540 Writer::Slot<MachOHeader> header = w->CreateSlotHere<MachOHeader>(); | 540 Writer::Slot<MachOHeader> header = w->CreateSlotHere<MachOHeader>(); |
| 541 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 | 541 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
| 542 header->magic = 0xFEEDFACEu; | 542 header->magic = 0xFEEDFACEu; |
| 543 header->cputype = 7; // i386 | 543 header->cputype = 7; // i386 |
| 544 header->cpusubtype = 3; // CPU_SUBTYPE_I386_ALL | 544 header->cpusubtype = 3; // CPU_SUBTYPE_I386_ALL |
| 545 #elif V8_TARGET_ARCH_X64 | 545 #elif V8_TARGET_ARCH_X64 |
| 546 header->magic = 0xFEEDFACFu; | 546 header->magic = 0xFEEDFACFu; |
| 547 header->cputype = 7 | 0x01000000; // i386 | 64-bit ABI | 547 header->cputype = 7 | 0x01000000; // i386 | 64-bit ABI |
| 548 header->cpusubtype = 3; // CPU_SUBTYPE_I386_ALL | 548 header->cpusubtype = 3; // CPU_SUBTYPE_I386_ALL |
| 549 header->reserved = 0; | 549 header->reserved = 0; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 uint16_t header_size; | 641 uint16_t header_size; |
| 642 uint16_t pht_entry_size; | 642 uint16_t pht_entry_size; |
| 643 uint16_t pht_entry_num; | 643 uint16_t pht_entry_num; |
| 644 uint16_t sht_entry_size; | 644 uint16_t sht_entry_size; |
| 645 uint16_t sht_entry_num; | 645 uint16_t sht_entry_num; |
| 646 uint16_t sht_strtab_index; | 646 uint16_t sht_strtab_index; |
| 647 }; | 647 }; |
| 648 | 648 |
| 649 | 649 |
| 650 void WriteHeader(Writer* w) { | 650 void WriteHeader(Writer* w) { |
| 651 ASSERT(w->position() == 0); | 651 DCHECK(w->position() == 0); |
| 652 Writer::Slot<ELFHeader> header = w->CreateSlotHere<ELFHeader>(); | 652 Writer::Slot<ELFHeader> header = w->CreateSlotHere<ELFHeader>(); |
| 653 #if (V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X87 || \ | 653 #if (V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X87 || \ |
| 654 (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT)) | 654 (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT)) |
| 655 const uint8_t ident[16] = | 655 const uint8_t ident[16] = |
| 656 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 656 { 0x7f, 'E', 'L', 'F', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 657 #elif V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT | 657 #elif V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT |
| 658 const uint8_t ident[16] = | 658 const uint8_t ident[16] = |
| 659 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 659 { 0x7f, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 660 #else | 660 #else |
| 661 #error Unsupported target architecture. | 661 #error Unsupported target architecture. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 684 header->header_size = sizeof(ELFHeader); | 684 header->header_size = sizeof(ELFHeader); |
| 685 header->pht_entry_size = 0; | 685 header->pht_entry_size = 0; |
| 686 header->pht_entry_num = 0; | 686 header->pht_entry_num = 0; |
| 687 header->sht_entry_size = sizeof(ELFSection::Header); | 687 header->sht_entry_size = sizeof(ELFSection::Header); |
| 688 header->sht_entry_num = sections_.length(); | 688 header->sht_entry_num = sections_.length(); |
| 689 header->sht_strtab_index = 1; | 689 header->sht_strtab_index = 1; |
| 690 } | 690 } |
| 691 | 691 |
| 692 void WriteSectionTable(Writer* w) { | 692 void WriteSectionTable(Writer* w) { |
| 693 // Section headers table immediately follows file header. | 693 // Section headers table immediately follows file header. |
| 694 ASSERT(w->position() == sizeof(ELFHeader)); | 694 DCHECK(w->position() == sizeof(ELFHeader)); |
| 695 | 695 |
| 696 Writer::Slot<ELFSection::Header> headers = | 696 Writer::Slot<ELFSection::Header> headers = |
| 697 w->CreateSlotsHere<ELFSection::Header>(sections_.length()); | 697 w->CreateSlotsHere<ELFSection::Header>(sections_.length()); |
| 698 | 698 |
| 699 // String table for section table is the first section. | 699 // String table for section table is the first section. |
| 700 ELFStringTable* strtab = static_cast<ELFStringTable*>(SectionAt(1)); | 700 ELFStringTable* strtab = static_cast<ELFStringTable*>(SectionAt(1)); |
| 701 strtab->AttachWriter(w); | 701 strtab->AttachWriter(w); |
| 702 for (int i = 0, length = sections_.length(); | 702 for (int i = 0, length = sections_.length(); |
| 703 i < length; | 703 i < length; |
| 704 i++) { | 704 i++) { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 bool IsLineInfoAvailable() { | 980 bool IsLineInfoAvailable() { |
| 981 return !script_.is_null() && | 981 return !script_.is_null() && |
| 982 script_->source()->IsString() && | 982 script_->source()->IsString() && |
| 983 script_->HasValidSource() && | 983 script_->HasValidSource() && |
| 984 script_->name()->IsString() && | 984 script_->name()->IsString() && |
| 985 lineinfo_ != NULL; | 985 lineinfo_ != NULL; |
| 986 } | 986 } |
| 987 | 987 |
| 988 #if V8_TARGET_ARCH_X64 | 988 #if V8_TARGET_ARCH_X64 |
| 989 uintptr_t GetStackStateStartAddress(StackState state) const { | 989 uintptr_t GetStackStateStartAddress(StackState state) const { |
| 990 ASSERT(state < STACK_STATE_MAX); | 990 DCHECK(state < STACK_STATE_MAX); |
| 991 return stack_state_start_addresses_[state]; | 991 return stack_state_start_addresses_[state]; |
| 992 } | 992 } |
| 993 | 993 |
| 994 void SetStackStateStartAddress(StackState state, uintptr_t addr) { | 994 void SetStackStateStartAddress(StackState state, uintptr_t addr) { |
| 995 ASSERT(state < STACK_STATE_MAX); | 995 DCHECK(state < STACK_STATE_MAX); |
| 996 stack_state_start_addresses_[state] = addr; | 996 stack_state_start_addresses_[state] = addr; |
| 997 } | 997 } |
| 998 #endif | 998 #endif |
| 999 | 999 |
| 1000 SmartArrayPointer<char> GetFilename() { | 1000 SmartArrayPointer<char> GetFilename() { |
| 1001 return String::cast(script_->name())->ToCString(); | 1001 return String::cast(script_->name())->ToCString(); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 int GetScriptLineNumber(int pos) { | 1004 int GetScriptLineNumber(int pos) { |
| 1005 return script_->GetLineNumber(pos) + 1; | 1005 return script_->GetLineNumber(pos) + 1; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 StringBuilder builder(buffer.start(), buffer.length()); | 1148 StringBuilder builder(buffer.start(), buffer.length()); |
| 1149 | 1149 |
| 1150 for (int slot = 0; slot < slots; ++slot) { | 1150 for (int slot = 0; slot < slots; ++slot) { |
| 1151 w->WriteULEB128(current_abbreviation++); | 1151 w->WriteULEB128(current_abbreviation++); |
| 1152 builder.Reset(); | 1152 builder.Reset(); |
| 1153 builder.AddFormatted("slot%d", slot); | 1153 builder.AddFormatted("slot%d", slot); |
| 1154 w->WriteString(builder.Finalize()); | 1154 w->WriteString(builder.Finalize()); |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 // See contexts.h for more information. | 1157 // See contexts.h for more information. |
| 1158 ASSERT(Context::MIN_CONTEXT_SLOTS == 4); | 1158 DCHECK(Context::MIN_CONTEXT_SLOTS == 4); |
| 1159 ASSERT(Context::CLOSURE_INDEX == 0); | 1159 DCHECK(Context::CLOSURE_INDEX == 0); |
| 1160 ASSERT(Context::PREVIOUS_INDEX == 1); | 1160 DCHECK(Context::PREVIOUS_INDEX == 1); |
| 1161 ASSERT(Context::EXTENSION_INDEX == 2); | 1161 DCHECK(Context::EXTENSION_INDEX == 2); |
| 1162 ASSERT(Context::GLOBAL_OBJECT_INDEX == 3); | 1162 DCHECK(Context::GLOBAL_OBJECT_INDEX == 3); |
| 1163 w->WriteULEB128(current_abbreviation++); | 1163 w->WriteULEB128(current_abbreviation++); |
| 1164 w->WriteString(".closure"); | 1164 w->WriteString(".closure"); |
| 1165 w->WriteULEB128(current_abbreviation++); | 1165 w->WriteULEB128(current_abbreviation++); |
| 1166 w->WriteString(".previous"); | 1166 w->WriteString(".previous"); |
| 1167 w->WriteULEB128(current_abbreviation++); | 1167 w->WriteULEB128(current_abbreviation++); |
| 1168 w->WriteString(".extension"); | 1168 w->WriteString(".extension"); |
| 1169 w->WriteULEB128(current_abbreviation++); | 1169 w->WriteULEB128(current_abbreviation++); |
| 1170 w->WriteString(".global"); | 1170 w->WriteString(".global"); |
| 1171 | 1171 |
| 1172 for (int context_slot = 0; | 1172 for (int context_slot = 0; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 w->WriteULEB128(DW_AT_LOCATION); | 1300 w->WriteULEB128(DW_AT_LOCATION); |
| 1301 w->WriteULEB128(DW_FORM_BLOCK4); | 1301 w->WriteULEB128(DW_FORM_BLOCK4); |
| 1302 } | 1302 } |
| 1303 w->WriteULEB128(0); | 1303 w->WriteULEB128(0); |
| 1304 w->WriteULEB128(0); | 1304 w->WriteULEB128(0); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 bool WriteBodyInternal(Writer* w) { | 1307 bool WriteBodyInternal(Writer* w) { |
| 1308 int current_abbreviation = 1; | 1308 int current_abbreviation = 1; |
| 1309 bool extra_info = desc_->IsInfoAvailable(); | 1309 bool extra_info = desc_->IsInfoAvailable(); |
| 1310 ASSERT(desc_->IsLineInfoAvailable()); | 1310 DCHECK(desc_->IsLineInfoAvailable()); |
| 1311 w->WriteULEB128(current_abbreviation++); | 1311 w->WriteULEB128(current_abbreviation++); |
| 1312 w->WriteULEB128(DW_TAG_COMPILE_UNIT); | 1312 w->WriteULEB128(DW_TAG_COMPILE_UNIT); |
| 1313 w->Write<uint8_t>(extra_info ? DW_CHILDREN_YES : DW_CHILDREN_NO); | 1313 w->Write<uint8_t>(extra_info ? DW_CHILDREN_YES : DW_CHILDREN_NO); |
| 1314 w->WriteULEB128(DW_AT_NAME); | 1314 w->WriteULEB128(DW_AT_NAME); |
| 1315 w->WriteULEB128(DW_FORM_STRING); | 1315 w->WriteULEB128(DW_FORM_STRING); |
| 1316 w->WriteULEB128(DW_AT_LOW_PC); | 1316 w->WriteULEB128(DW_AT_LOW_PC); |
| 1317 w->WriteULEB128(DW_FORM_ADDR); | 1317 w->WriteULEB128(DW_FORM_ADDR); |
| 1318 w->WriteULEB128(DW_AT_HIGH_PC); | 1318 w->WriteULEB128(DW_AT_HIGH_PC); |
| 1319 w->WriteULEB128(DW_FORM_ADDR); | 1319 w->WriteULEB128(DW_FORM_ADDR); |
| 1320 w->WriteULEB128(DW_AT_STMT_LIST); | 1320 w->WriteULEB128(DW_AT_STMT_LIST); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 intptr_t pc = 0; | 1471 intptr_t pc = 0; |
| 1472 intptr_t line = 1; | 1472 intptr_t line = 1; |
| 1473 bool is_statement = true; | 1473 bool is_statement = true; |
| 1474 | 1474 |
| 1475 List<LineInfo::PCInfo>* pc_info = desc_->lineinfo()->pc_info(); | 1475 List<LineInfo::PCInfo>* pc_info = desc_->lineinfo()->pc_info(); |
| 1476 pc_info->Sort(&ComparePCInfo); | 1476 pc_info->Sort(&ComparePCInfo); |
| 1477 | 1477 |
| 1478 int pc_info_length = pc_info->length(); | 1478 int pc_info_length = pc_info->length(); |
| 1479 for (int i = 0; i < pc_info_length; i++) { | 1479 for (int i = 0; i < pc_info_length; i++) { |
| 1480 LineInfo::PCInfo* info = &pc_info->at(i); | 1480 LineInfo::PCInfo* info = &pc_info->at(i); |
| 1481 ASSERT(info->pc_ >= pc); | 1481 DCHECK(info->pc_ >= pc); |
| 1482 | 1482 |
| 1483 // Reduce bloating in the debug line table by removing duplicate line | 1483 // Reduce bloating in the debug line table by removing duplicate line |
| 1484 // entries (per DWARF2 standard). | 1484 // entries (per DWARF2 standard). |
| 1485 intptr_t new_line = desc_->GetScriptLineNumber(info->pos_); | 1485 intptr_t new_line = desc_->GetScriptLineNumber(info->pos_); |
| 1486 if (new_line == line) { | 1486 if (new_line == line) { |
| 1487 continue; | 1487 continue; |
| 1488 } | 1488 } |
| 1489 | 1489 |
| 1490 // Mark statement boundaries. For a better debugging experience, mark | 1490 // Mark statement boundaries. For a better debugging experience, mark |
| 1491 // the last pc address in the function as a statement (e.g. "}"), so that | 1491 // the last pc address in the function as a statement (e.g. "}"), so that |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 Writer::Slot<uint32_t>* length_slot, | 1641 Writer::Slot<uint32_t>* length_slot, |
| 1642 int initial_position) { | 1642 int initial_position) { |
| 1643 uint32_t align = (w->position() - initial_position) % kPointerSize; | 1643 uint32_t align = (w->position() - initial_position) % kPointerSize; |
| 1644 | 1644 |
| 1645 if (align != 0) { | 1645 if (align != 0) { |
| 1646 for (uint32_t i = 0; i < (kPointerSize - align); i++) { | 1646 for (uint32_t i = 0; i < (kPointerSize - align); i++) { |
| 1647 w->Write<uint8_t>(DW_CFA_NOP); | 1647 w->Write<uint8_t>(DW_CFA_NOP); |
| 1648 } | 1648 } |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 ASSERT((w->position() - initial_position) % kPointerSize == 0); | 1651 DCHECK((w->position() - initial_position) % kPointerSize == 0); |
| 1652 length_slot->set(w->position() - initial_position); | 1652 length_slot->set(w->position() - initial_position); |
| 1653 } | 1653 } |
| 1654 | 1654 |
| 1655 | 1655 |
| 1656 UnwindInfoSection::UnwindInfoSection(CodeDescription* desc) | 1656 UnwindInfoSection::UnwindInfoSection(CodeDescription* desc) |
| 1657 #ifdef __ELF | 1657 #ifdef __ELF |
| 1658 : ELFSection(".eh_frame", TYPE_X86_64_UNWIND, 1), | 1658 : ELFSection(".eh_frame", TYPE_X86_64_UNWIND, 1), |
| 1659 #else | 1659 #else |
| 1660 : MachOSection("__eh_frame", "__TEXT", sizeof(uintptr_t), | 1660 : MachOSection("__eh_frame", "__TEXT", sizeof(uintptr_t), |
| 1661 MachOSection::S_REGULAR), | 1661 MachOSection::S_REGULAR), |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 | 2081 |
| 2082 if (!FLAG_gdbjit_full && !code_desc.IsLineInfoAvailable()) { | 2082 if (!FLAG_gdbjit_full && !code_desc.IsLineInfoAvailable()) { |
| 2083 delete lineinfo; | 2083 delete lineinfo; |
| 2084 GetEntries()->Remove(code, HashForCodeObject(code)); | 2084 GetEntries()->Remove(code, HashForCodeObject(code)); |
| 2085 return; | 2085 return; |
| 2086 } | 2086 } |
| 2087 | 2087 |
| 2088 AddUnwindInfo(&code_desc); | 2088 AddUnwindInfo(&code_desc); |
| 2089 Isolate* isolate = code->GetIsolate(); | 2089 Isolate* isolate = code->GetIsolate(); |
| 2090 JITCodeEntry* entry = CreateELFObject(&code_desc, isolate); | 2090 JITCodeEntry* entry = CreateELFObject(&code_desc, isolate); |
| 2091 ASSERT(!IsLineInfoTagged(entry)); | 2091 DCHECK(!IsLineInfoTagged(entry)); |
| 2092 | 2092 |
| 2093 delete lineinfo; | 2093 delete lineinfo; |
| 2094 e->value = entry; | 2094 e->value = entry; |
| 2095 | 2095 |
| 2096 const char* name_hint = NULL; | 2096 const char* name_hint = NULL; |
| 2097 bool should_dump = false; | 2097 bool should_dump = false; |
| 2098 if (FLAG_gdbjit_dump) { | 2098 if (FLAG_gdbjit_dump) { |
| 2099 if (strlen(FLAG_gdbjit_dump_filter) == 0) { | 2099 if (strlen(FLAG_gdbjit_dump_filter) == 0) { |
| 2100 name_hint = name; | 2100 name_hint = name; |
| 2101 should_dump = true; | 2101 should_dump = true; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 } | 2142 } |
| 2143 | 2143 |
| 2144 for (int i = 0; i < dead_codes.length(); i++) { | 2144 for (int i = 0; i < dead_codes.length(); i++) { |
| 2145 RemoveCode(dead_codes.at(i)); | 2145 RemoveCode(dead_codes.at(i)); |
| 2146 } | 2146 } |
| 2147 } | 2147 } |
| 2148 | 2148 |
| 2149 | 2149 |
| 2150 static void RegisterDetailedLineInfo(Code* code, LineInfo* line_info) { | 2150 static void RegisterDetailedLineInfo(Code* code, LineInfo* line_info) { |
| 2151 base::LockGuard<base::Mutex> lock_guard(mutex.Pointer()); | 2151 base::LockGuard<base::Mutex> lock_guard(mutex.Pointer()); |
| 2152 ASSERT(!IsLineInfoTagged(line_info)); | 2152 DCHECK(!IsLineInfoTagged(line_info)); |
| 2153 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 2153 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
| 2154 ASSERT(e->value == NULL); | 2154 DCHECK(e->value == NULL); |
| 2155 e->value = TagLineInfo(line_info); | 2155 e->value = TagLineInfo(line_info); |
| 2156 } | 2156 } |
| 2157 | 2157 |
| 2158 | 2158 |
| 2159 void GDBJITInterface::EventHandler(const v8::JitCodeEvent* event) { | 2159 void GDBJITInterface::EventHandler(const v8::JitCodeEvent* event) { |
| 2160 if (!FLAG_gdbjit) return; | 2160 if (!FLAG_gdbjit) return; |
| 2161 switch (event->type) { | 2161 switch (event->type) { |
| 2162 case v8::JitCodeEvent::CODE_ADDED: { | 2162 case v8::JitCodeEvent::CODE_ADDED: { |
| 2163 Code* code = Code::GetCodeFromTargetAddress( | 2163 Code* code = Code::GetCodeFromTargetAddress( |
| 2164 reinterpret_cast<Address>(event->code_start)); | 2164 reinterpret_cast<Address>(event->code_start)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2199 reinterpret_cast<Address>(event->code_start)); | 2199 reinterpret_cast<Address>(event->code_start)); |
| 2200 RegisterDetailedLineInfo(code, line_info); | 2200 RegisterDetailedLineInfo(code, line_info); |
| 2201 break; | 2201 break; |
| 2202 } | 2202 } |
| 2203 } | 2203 } |
| 2204 } | 2204 } |
| 2205 | 2205 |
| 2206 | 2206 |
| 2207 } } // namespace v8::internal | 2207 } } // namespace v8::internal |
| 2208 #endif | 2208 #endif |
| OLD | NEW |