| 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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 | 1082 |
| 1083 bool WriteBodyInternal(Writer* w) { | 1083 bool WriteBodyInternal(Writer* w) { |
| 1084 uintptr_t cu_start = w->position(); | 1084 uintptr_t cu_start = w->position(); |
| 1085 Writer::Slot<uint32_t> size = w->CreateSlotHere<uint32_t>(); | 1085 Writer::Slot<uint32_t> size = w->CreateSlotHere<uint32_t>(); |
| 1086 uintptr_t start = w->position(); | 1086 uintptr_t start = w->position(); |
| 1087 w->Write<uint16_t>(2); // DWARF version. | 1087 w->Write<uint16_t>(2); // DWARF version. |
| 1088 w->Write<uint32_t>(0); // Abbreviation table offset. | 1088 w->Write<uint32_t>(0); // Abbreviation table offset. |
| 1089 w->Write<uint8_t>(sizeof(intptr_t)); | 1089 w->Write<uint8_t>(sizeof(intptr_t)); |
| 1090 | 1090 |
| 1091 w->WriteULEB128(1); // Abbreviation code. | 1091 w->WriteULEB128(1); // Abbreviation code. |
| 1092 w->WriteString(*desc_->GetFilename()); | 1092 w->WriteString(desc_->GetFilename().get()); |
| 1093 w->Write<intptr_t>(desc_->CodeStart()); | 1093 w->Write<intptr_t>(desc_->CodeStart()); |
| 1094 w->Write<intptr_t>(desc_->CodeStart() + desc_->CodeSize()); | 1094 w->Write<intptr_t>(desc_->CodeStart() + desc_->CodeSize()); |
| 1095 w->Write<uint32_t>(0); | 1095 w->Write<uint32_t>(0); |
| 1096 | 1096 |
| 1097 uint32_t ty_offset = static_cast<uint32_t>(w->position() - cu_start); | 1097 uint32_t ty_offset = static_cast<uint32_t>(w->position() - cu_start); |
| 1098 w->WriteULEB128(3); | 1098 w->WriteULEB128(3); |
| 1099 w->Write<uint8_t>(kPointerSize); | 1099 w->Write<uint8_t>(kPointerSize); |
| 1100 w->WriteString("v8value"); | 1100 w->WriteString("v8value"); |
| 1101 | 1101 |
| 1102 if (desc_->IsInfoAvailable()) { | 1102 if (desc_->IsInfoAvailable()) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1124 int slots = scope->num_stack_slots(); | 1124 int slots = scope->num_stack_slots(); |
| 1125 int context_slots = scope->ContextLocalCount(); | 1125 int context_slots = scope->ContextLocalCount(); |
| 1126 // The real slot ID is internal_slots + context_slot_id. | 1126 // The real slot ID is internal_slots + context_slot_id. |
| 1127 int internal_slots = Context::MIN_CONTEXT_SLOTS; | 1127 int internal_slots = Context::MIN_CONTEXT_SLOTS; |
| 1128 int locals = scope->StackLocalCount(); | 1128 int locals = scope->StackLocalCount(); |
| 1129 int current_abbreviation = 4; | 1129 int current_abbreviation = 4; |
| 1130 | 1130 |
| 1131 for (int param = 0; param < params; ++param) { | 1131 for (int param = 0; param < params; ++param) { |
| 1132 w->WriteULEB128(current_abbreviation++); | 1132 w->WriteULEB128(current_abbreviation++); |
| 1133 w->WriteString( | 1133 w->WriteString( |
| 1134 *scope->parameter(param)->name()->ToCString(DISALLOW_NULLS)); | 1134 scope->parameter(param)->name()->ToCString(DISALLOW_NULLS).get()); |
| 1135 w->Write<uint32_t>(ty_offset); | 1135 w->Write<uint32_t>(ty_offset); |
| 1136 Writer::Slot<uint32_t> block_size = w->CreateSlotHere<uint32_t>(); | 1136 Writer::Slot<uint32_t> block_size = w->CreateSlotHere<uint32_t>(); |
| 1137 uintptr_t block_start = w->position(); | 1137 uintptr_t block_start = w->position(); |
| 1138 w->Write<uint8_t>(DW_OP_fbreg); | 1138 w->Write<uint8_t>(DW_OP_fbreg); |
| 1139 w->WriteSLEB128( | 1139 w->WriteSLEB128( |
| 1140 JavaScriptFrameConstants::kLastParameterOffset + | 1140 JavaScriptFrameConstants::kLastParameterOffset + |
| 1141 kPointerSize * (params - param - 1)); | 1141 kPointerSize * (params - param - 1)); |
| 1142 block_size.set(static_cast<uint32_t>(w->position() - block_start)); | 1142 block_size.set(static_cast<uint32_t>(w->position() - block_start)); |
| 1143 } | 1143 } |
| 1144 | 1144 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1175 builder.AddFormatted("context_slot%d", context_slot + internal_slots); | 1175 builder.AddFormatted("context_slot%d", context_slot + internal_slots); |
| 1176 w->WriteString(builder.Finalize()); | 1176 w->WriteString(builder.Finalize()); |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 ZoneList<Variable*> stack_locals(locals, scope->zone()); | 1179 ZoneList<Variable*> stack_locals(locals, scope->zone()); |
| 1180 ZoneList<Variable*> context_locals(context_slots, scope->zone()); | 1180 ZoneList<Variable*> context_locals(context_slots, scope->zone()); |
| 1181 scope->CollectStackAndContextLocals(&stack_locals, &context_locals); | 1181 scope->CollectStackAndContextLocals(&stack_locals, &context_locals); |
| 1182 for (int local = 0; local < locals; ++local) { | 1182 for (int local = 0; local < locals; ++local) { |
| 1183 w->WriteULEB128(current_abbreviation++); | 1183 w->WriteULEB128(current_abbreviation++); |
| 1184 w->WriteString( | 1184 w->WriteString( |
| 1185 *stack_locals[local]->name()->ToCString(DISALLOW_NULLS)); | 1185 stack_locals[local]->name()->ToCString(DISALLOW_NULLS).get()); |
| 1186 w->Write<uint32_t>(ty_offset); | 1186 w->Write<uint32_t>(ty_offset); |
| 1187 Writer::Slot<uint32_t> block_size = w->CreateSlotHere<uint32_t>(); | 1187 Writer::Slot<uint32_t> block_size = w->CreateSlotHere<uint32_t>(); |
| 1188 uintptr_t block_start = w->position(); | 1188 uintptr_t block_start = w->position(); |
| 1189 w->Write<uint8_t>(DW_OP_fbreg); | 1189 w->Write<uint8_t>(DW_OP_fbreg); |
| 1190 w->WriteSLEB128( | 1190 w->WriteSLEB128( |
| 1191 JavaScriptFrameConstants::kLocal0Offset - | 1191 JavaScriptFrameConstants::kLocal0Offset - |
| 1192 kPointerSize * local); | 1192 kPointerSize * local); |
| 1193 block_size.set(static_cast<uint32_t>(w->position() - block_start)); | 1193 block_size.set(static_cast<uint32_t>(w->position() - block_start)); |
| 1194 } | 1194 } |
| 1195 | 1195 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 w->Write<int8_t>(line_base); // Field line_base. | 1448 w->Write<int8_t>(line_base); // Field line_base. |
| 1449 w->Write<uint8_t>(line_range); // Field line_range. | 1449 w->Write<uint8_t>(line_range); // Field line_range. |
| 1450 w->Write<uint8_t>(opcode_base); // Field opcode_base. | 1450 w->Write<uint8_t>(opcode_base); // Field opcode_base. |
| 1451 w->Write<uint8_t>(0); // DW_LNS_COPY operands count. | 1451 w->Write<uint8_t>(0); // DW_LNS_COPY operands count. |
| 1452 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_PC operands count. | 1452 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_PC operands count. |
| 1453 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_LINE operands count. | 1453 w->Write<uint8_t>(1); // DW_LNS_ADVANCE_LINE operands count. |
| 1454 w->Write<uint8_t>(1); // DW_LNS_SET_FILE operands count. | 1454 w->Write<uint8_t>(1); // DW_LNS_SET_FILE operands count. |
| 1455 w->Write<uint8_t>(1); // DW_LNS_SET_COLUMN operands count. | 1455 w->Write<uint8_t>(1); // DW_LNS_SET_COLUMN operands count. |
| 1456 w->Write<uint8_t>(0); // DW_LNS_NEGATE_STMT operands count. | 1456 w->Write<uint8_t>(0); // DW_LNS_NEGATE_STMT operands count. |
| 1457 w->Write<uint8_t>(0); // Empty include_directories sequence. | 1457 w->Write<uint8_t>(0); // Empty include_directories sequence. |
| 1458 w->WriteString(*desc_->GetFilename()); // File name. | 1458 w->WriteString(desc_->GetFilename().get()); // File name. |
| 1459 w->WriteULEB128(0); // Current directory. | 1459 w->WriteULEB128(0); // Current directory. |
| 1460 w->WriteULEB128(0); // Unknown modification time. | 1460 w->WriteULEB128(0); // Unknown modification time. |
| 1461 w->WriteULEB128(0); // Unknown file size. | 1461 w->WriteULEB128(0); // Unknown file size. |
| 1462 w->Write<uint8_t>(0); | 1462 w->Write<uint8_t>(0); |
| 1463 prologue_length.set(static_cast<uint32_t>(w->position() - prologue_start)); | 1463 prologue_length.set(static_cast<uint32_t>(w->position() - prologue_start)); |
| 1464 | 1464 |
| 1465 WriteExtendedOpcode(w, DW_LNE_SET_ADDRESS, sizeof(intptr_t)); | 1465 WriteExtendedOpcode(w, DW_LNE_SET_ADDRESS, sizeof(intptr_t)); |
| 1466 w->Write<intptr_t>(desc_->CodeStart()); | 1466 w->Write<intptr_t>(desc_->CodeStart()); |
| 1467 w->Write<uint8_t>(DW_LNS_COPY); | 1467 w->Write<uint8_t>(DW_LNS_COPY); |
| 1468 | 1468 |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2002 Handle<Code> code, | 2002 Handle<Code> code, |
| 2003 CompilationInfo* info) { | 2003 CompilationInfo* info) { |
| 2004 if (!FLAG_gdbjit) return; | 2004 if (!FLAG_gdbjit) return; |
| 2005 | 2005 |
| 2006 // Force initialization of line_ends array. | 2006 // Force initialization of line_ends array. |
| 2007 GetScriptLineNumber(script, 0); | 2007 GetScriptLineNumber(script, 0); |
| 2008 | 2008 |
| 2009 if (!name.is_null() && name->IsString()) { | 2009 if (!name.is_null() && name->IsString()) { |
| 2010 SmartArrayPointer<char> name_cstring = | 2010 SmartArrayPointer<char> name_cstring = |
| 2011 Handle<String>::cast(name)->ToCString(DISALLOW_NULLS); | 2011 Handle<String>::cast(name)->ToCString(DISALLOW_NULLS); |
| 2012 AddCode(*name_cstring, *code, GDBJITInterface::FUNCTION, *script, info); | 2012 AddCode(name_cstring.get(), *code, GDBJITInterface::FUNCTION, *script, |
| 2013 info); |
| 2013 } else { | 2014 } else { |
| 2014 AddCode("", *code, GDBJITInterface::FUNCTION, *script, info); | 2015 AddCode("", *code, GDBJITInterface::FUNCTION, *script, info); |
| 2015 } | 2016 } |
| 2016 } | 2017 } |
| 2017 | 2018 |
| 2018 | 2019 |
| 2019 static void AddUnwindInfo(CodeDescription* desc) { | 2020 static void AddUnwindInfo(CodeDescription* desc) { |
| 2020 #if V8_TARGET_ARCH_X64 | 2021 #if V8_TARGET_ARCH_X64 |
| 2021 if (desc->tag() == GDBJITInterface::FUNCTION) { | 2022 if (desc->tag() == GDBJITInterface::FUNCTION) { |
| 2022 // To avoid propagating unwinding information through | 2023 // To avoid propagating unwinding information through |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 | 2126 |
| 2126 AddCode(builder.Finalize(), code, tag, NULL, NULL); | 2127 AddCode(builder.Finalize(), code, tag, NULL, NULL); |
| 2127 } | 2128 } |
| 2128 | 2129 |
| 2129 | 2130 |
| 2130 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, | 2131 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, |
| 2131 Name* name, | 2132 Name* name, |
| 2132 Code* code) { | 2133 Code* code) { |
| 2133 if (!FLAG_gdbjit) return; | 2134 if (!FLAG_gdbjit) return; |
| 2134 if (name != NULL && name->IsString()) { | 2135 if (name != NULL && name->IsString()) { |
| 2135 AddCode(tag, *String::cast(name)->ToCString(DISALLOW_NULLS), code); | 2136 AddCode(tag, String::cast(name)->ToCString(DISALLOW_NULLS).get(), code); |
| 2136 } else { | 2137 } else { |
| 2137 AddCode(tag, "", code); | 2138 AddCode(tag, "", code); |
| 2138 } | 2139 } |
| 2139 } | 2140 } |
| 2140 | 2141 |
| 2141 | 2142 |
| 2142 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { | 2143 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { |
| 2143 if (!FLAG_gdbjit) return; | 2144 if (!FLAG_gdbjit) return; |
| 2144 | 2145 |
| 2145 AddCode(tag, "", code); | 2146 AddCode(tag, "", code); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 LockGuard<Mutex> lock_guard(mutex.Pointer()); | 2191 LockGuard<Mutex> lock_guard(mutex.Pointer()); |
| 2191 ASSERT(!IsLineInfoTagged(line_info)); | 2192 ASSERT(!IsLineInfoTagged(line_info)); |
| 2192 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 2193 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
| 2193 ASSERT(e->value == NULL); | 2194 ASSERT(e->value == NULL); |
| 2194 e->value = TagLineInfo(line_info); | 2195 e->value = TagLineInfo(line_info); |
| 2195 } | 2196 } |
| 2196 | 2197 |
| 2197 | 2198 |
| 2198 } } // namespace v8::internal | 2199 } } // namespace v8::internal |
| 2199 #endif | 2200 #endif |
| OLD | NEW |