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

Side by Side Diff: src/safepoint-table.cc

Issue 43273004: Allow redirecting disassembly and deoptimization traces into a file. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/safepoint-table.h ('k') | src/stub-cache.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 SafepointEntry SafepointTable::FindEntry(Address pc) const { 76 SafepointEntry SafepointTable::FindEntry(Address pc) const {
77 unsigned pc_offset = static_cast<unsigned>(pc - code_->instruction_start()); 77 unsigned pc_offset = static_cast<unsigned>(pc - code_->instruction_start());
78 for (unsigned i = 0; i < length(); i++) { 78 for (unsigned i = 0; i < length(); i++) {
79 // TODO(kasperl): Replace the linear search with binary search. 79 // TODO(kasperl): Replace the linear search with binary search.
80 if (GetPcOffset(i) == pc_offset) return GetEntry(i); 80 if (GetPcOffset(i) == pc_offset) return GetEntry(i);
81 } 81 }
82 return SafepointEntry(); 82 return SafepointEntry();
83 } 83 }
84 84
85 85
86 void SafepointTable::PrintEntry(unsigned index) const { 86 void SafepointTable::PrintEntry(unsigned index, FILE* out) const {
87 disasm::NameConverter converter; 87 disasm::NameConverter converter;
88 SafepointEntry entry = GetEntry(index); 88 SafepointEntry entry = GetEntry(index);
89 uint8_t* bits = entry.bits(); 89 uint8_t* bits = entry.bits();
90 90
91 // Print the stack slot bits. 91 // Print the stack slot bits.
92 if (entry_size_ > 0) { 92 if (entry_size_ > 0) {
93 ASSERT(IsAligned(kNumSafepointRegisters, kBitsPerByte)); 93 ASSERT(IsAligned(kNumSafepointRegisters, kBitsPerByte));
94 const int first = kNumSafepointRegisters >> kBitsPerByteLog2; 94 const int first = kNumSafepointRegisters >> kBitsPerByteLog2;
95 int last = entry_size_ - 1; 95 int last = entry_size_ - 1;
96 for (int i = first; i < last; i++) PrintBits(bits[i], kBitsPerByte); 96 for (int i = first; i < last; i++) PrintBits(out, bits[i], kBitsPerByte);
97 int last_bits = code_->stack_slots() - ((last - first) * kBitsPerByte); 97 int last_bits = code_->stack_slots() - ((last - first) * kBitsPerByte);
98 PrintBits(bits[last], last_bits); 98 PrintBits(out, bits[last], last_bits);
99 99
100 // Print the registers (if any). 100 // Print the registers (if any).
101 if (!entry.HasRegisters()) return; 101 if (!entry.HasRegisters()) return;
102 for (int j = 0; j < kNumSafepointRegisters; j++) { 102 for (int j = 0; j < kNumSafepointRegisters; j++) {
103 if (entry.HasRegisterAt(j)) { 103 if (entry.HasRegisterAt(j)) {
104 PrintF(" | %s", converter.NameOfCPURegister(j)); 104 PrintF(out, " | %s", converter.NameOfCPURegister(j));
105 } 105 }
106 } 106 }
107 } 107 }
108 } 108 }
109 109
110 110
111 void SafepointTable::PrintBits(uint8_t byte, int digits) { 111 void SafepointTable::PrintBits(FILE* out, uint8_t byte, int digits) {
112 ASSERT(digits >= 0 && digits <= kBitsPerByte); 112 ASSERT(digits >= 0 && digits <= kBitsPerByte);
113 for (int i = 0; i < digits; i++) { 113 for (int i = 0; i < digits; i++) {
114 PrintF("%c", ((byte & (1 << i)) == 0) ? '0' : '1'); 114 PrintF(out, "%c", ((byte & (1 << i)) == 0) ? '0' : '1');
115 } 115 }
116 } 116 }
117 117
118 118
119 void Safepoint::DefinePointerRegister(Register reg, Zone* zone) { 119 void Safepoint::DefinePointerRegister(Register reg, Zone* zone) {
120 registers_->Add(reg.code(), zone); 120 registers_->Add(reg.code(), zone);
121 } 121 }
122 122
123 123
124 Safepoint SafepointTableBuilder::DefineSafepoint( 124 Safepoint SafepointTableBuilder::DefineSafepoint(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 unsigned index) { 228 unsigned index) {
229 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index); 229 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index);
230 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments); 230 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments);
231 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles); 231 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles);
232 return encoding; 232 return encoding;
233 } 233 }
234 234
235 235
236 236
237 } } // namespace v8::internal 237 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/safepoint-table.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698