43 #ifdef ENABLE_DISASSEMBLER
49 reinterpret_cast<intptr_t>(
pc),
54 reinterpret_cast<uintptr_t>(
pc),
pc - begin, *
pc);
62 explicit V8NameConverter(Code*
code) : code_(code) {}
63 virtual const char* NameOfAddress(
byte*
pc)
const;
64 virtual const char* NameInCode(
byte* addr)
const;
65 Code*
code()
const {
return code_; }
69 EmbeddedVector<char, 128> v8_buffer_;
73 const char* V8NameConverter::NameOfAddress(
byte*
pc)
const {
74 const char*
name = code_->GetIsolate()->builtins()->Lookup(pc);
77 return v8_buffer_.start();
81 int offs =
static_cast<int>(pc - code_->instruction_start());
83 if (0 <= offs && offs < code_->instruction_size()) {
85 return v8_buffer_.start();
93 const char* V8NameConverter::NameInCode(
byte* addr)
const {
96 return (code_ !=
NULL) ?
reinterpret_cast<const char*
>(addr) :
"";
100 static void DumpBuffer(FILE* f, StringBuilder* out) {
102 PrintF(
"%s\n", out->Finalize());
104 PrintF(f,
"%s\n", out->Finalize());
111 static const int kRelocInfoPosition = 57;
113 static int DecodeIt(Isolate* isolate,
115 const V8NameConverter& converter,
118 SealHandleScope shs(isolate);
120 ExternalReferenceEncoder ref_encoder(isolate);
121 Heap* heap = isolate->heap();
125 StringBuilder out(out_buffer.
start(), out_buffer.
length());
128 RelocIterator* it =
NULL;
129 if (converter.code() !=
NULL) {
130 it =
new RelocIterator(converter.code());
142 *reinterpret_cast<int32_t*>(pc));
146 int num_const = d.ConstantPoolSizeAt(pc);
147 if (num_const >= 0) {
149 "%08x constant pool begin",
150 *reinterpret_cast<int32_t*>(pc));
151 constants = num_const;
153 }
else if (it !=
NULL && !it->done() && it->rinfo()->pc() == pc &&
154 it->rinfo()->rmode() == RelocInfo::INTERNAL_REFERENCE) {
163 decode_buffer[0] =
'\0';
164 pc += d.InstructionDecode(decode_buffer, pc);
169 List<const char*> comments(4);
171 List<RelocInfo::Mode> rmodes(1);
172 List<intptr_t> datas(1);
174 while (!it->done() && it->rinfo()->pc() <
pc) {
175 if (RelocInfo::IsComment(it->rinfo()->rmode())) {
177 comments.Add(reinterpret_cast<const char*>(it->rinfo()->data()));
180 pcs.Add(it->rinfo()->pc());
181 rmodes.Add(it->rinfo()->rmode());
182 datas.Add(it->rinfo()->data());
189 for (
int i = 0; i < comments.length(); i++) {
190 out.AddFormatted(
" %s", comments[i]);
195 out.AddFormatted(
"%p %4d ", prev_pc, prev_pc - begin);
198 out.AddFormatted(
"%s", decode_buffer.
start());
201 for (
int i = 0; i < pcs.length(); i++) {
203 RelocInfo relocinfo(pcs[i], rmodes[i], datas[i], converter.code());
208 out.AddPadding(
' ', kRelocInfoPosition - out.position());
212 out.AddPadding(
' ', kRelocInfoPosition);
215 RelocInfo::Mode rmode = relocinfo.rmode();
216 if (RelocInfo::IsPosition(rmode)) {
217 if (RelocInfo::IsStatementPosition(rmode)) {
218 out.AddFormatted(
" ;; debug: statement %d", relocinfo.data());
220 out.AddFormatted(
" ;; debug: position %d", relocinfo.data());
222 }
else if (rmode == RelocInfo::EMBEDDED_OBJECT) {
223 HeapStringAllocator allocator;
224 StringStream accumulator(&allocator);
225 relocinfo.target_object()->ShortPrint(&accumulator);
226 SmartArrayPointer<const char> obj_name = accumulator.ToCString();
227 out.AddFormatted(
" ;; object: %s", obj_name.get());
228 }
else if (rmode == RelocInfo::EXTERNAL_REFERENCE) {
229 const char* reference_name =
230 ref_encoder.NameOfAddress(relocinfo.target_reference());
231 out.AddFormatted(
" ;; external reference (%s)", reference_name);
232 }
else if (RelocInfo::IsCodeTarget(rmode)) {
233 out.AddFormatted(
" ;; code:");
234 if (rmode == RelocInfo::CONSTRUCT_CALL) {
235 out.AddFormatted(
" constructor,");
239 if (code->is_inline_cache_stub()) {
240 if (kind == Code::LOAD_IC &&
242 out.AddFormatted(
" contextual,");
246 Code::ICState2String(ic_state));
249 out.AddFormatted(
", %s", Code::StubType2String(type));
254 Object*
obj = heap->code_stubs()->SlowReverseLookup(code);
255 if (obj != heap->undefined_value()) {
259 uint32_t minor_key = CodeStub::MinorKeyFromKey(key);
260 CodeStub::Major major_key = CodeStub::GetMajorKey(code);
261 ASSERT(major_key == CodeStub::MajorKeyFromKey(key));
262 out.AddFormatted(
" %s, %s, ",
264 CodeStub::MajorName(major_key,
false));
266 case CodeStub::CallFunction: {
269 out.AddFormatted(
"argc = %d", argc);
273 out.AddFormatted(
"minor: %d", minor_key);
279 if (rmode == RelocInfo::CODE_TARGET_WITH_ID) {
280 out.AddFormatted(
" (id = %d)", static_cast<int>(relocinfo.data()));
282 }
else if (RelocInfo::IsRuntimeEntry(rmode) &&
283 isolate->deoptimizer_data() !=
NULL) {
285 Address addr = relocinfo.target_address();
298 out.AddFormatted(
" ;; %s", RelocInfo::RelocModeName(rmode));
300 out.AddFormatted(
" ;; soft deoptimization bailout %d",
id);
303 out.AddFormatted(
" ;; lazy deoptimization bailout %d",
id);
306 out.AddFormatted(
" ;; deoptimization bailout %d",
id);
309 out.AddFormatted(
" ;; %s", RelocInfo::RelocModeName(rmode));
317 for ( ; !it->done(); it->next()) {
318 if (RelocInfo::IsComment(it->rinfo()->rmode())) {
319 out.AddFormatted(
" %s",
320 reinterpret_cast<const char*>(it->rinfo()->data()));
327 return static_cast<int>(pc - begin);
332 V8NameConverter defaultConverter(
NULL);
333 return DecodeIt(isolate, f, defaultConverter, begin, end);
339 Isolate* isolate = code->GetIsolate();
340 int decode_size = code->is_crankshafted()
341 ?
static_cast<int>(code->safepoint_table_offset())
342 : code->instruction_size();
344 if (code->kind() == Code::FUNCTION) {
346 Min(decode_size, static_cast<int>(code->back_edge_table_offset()));
349 byte* begin = code->instruction_start();
350 byte* end = begin + decode_size;
351 V8NameConverter v8NameConverter(code);
352 DecodeIt(isolate, f, v8NameConverter, begin, end);
355 #else // ENABLE_DISASSEMBLER
365 #endif // ENABLE_DISASSEMBLER
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
void PrintF(const char *format,...)
static int Decode(Isolate *isolate, FILE *f, byte *begin, byte *end)
static int ExtractArgcFromMinorKey(int minor_key)
static ContextualMode GetContextualMode(ExtraICState state)
kSerializedDataOffset Object
#define ASSERT(condition)
static Smi * cast(Object *object)
static int GetDeoptimizationId(Isolate *isolate, Address addr, BailoutType type)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
static const char * Kind2String(Kind kind)
static Code * GetCodeFromTargetAddress(Address address)
virtual const char * NameOfAddress(byte *addr) const
static const int kMaxShortPrintLength
static int SNPrintF(Vector< char > str, const char *format,...)
static const int kNotDeoptimizationEntry
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
static void Dump(FILE *f, byte *begin, byte *end)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name