Home | History | Annotate | Download | only in tools

Lines Matching refs:Code

8 #     * Redistributions of source code must retain the above copyright
80 class Code(object):
81 """Code object."""
86 self.id = Code._id
87 Code._id += 1
180 filename = options.log + ".code"
192 """Group of adjacent code objects."""
214 def Add(self, code):
215 self.code_objects.append(code)
217 def Remove(self, code):
218 self.code_objects.remove(code)
222 for i, code in enumerate(code_objects):
223 if code.start_address <= pc < code.end_address:
224 code_objects[0], code_objects[i] = code, code_objects[0]
225 return code
233 """Code object map."""
240 def Add(self, code, max_pages=-1):
241 page_id = CodePage.PageId(code.start_address)
242 limit_id = CodePage.PageId(code.end_address + CodePage.SIZE - 1)
248 max_pages, code.name, code.origin)
255 page.Add(code)
258 self.min_address = min(self.min_address, code.start_address)
259 self.max_address = max(self.max_address, code.end_address)
261 def Remove(self, code):
262 page_id = CodePage.PageId(code.start_address)
263 limit_id = CodePage.PageId(code.end_address + CodePage.SIZE - 1)
270 page.Remove(code)
277 for code in page:
278 if CodePage.PageAddress(code.start_address) == page.address:
279 yield code
282 for code in self.AllCode():
283 if code.IsUsed():
284 yield code
287 for code in self.AllCode():
288 print code
300 """Generic info about generated code objects."""
308 """V8 code event log reader."""
311 r"code-info,([^,]+),(\d+)")
314 r"code-creation,([^,]+),(0x[a-f0-9]+),(\d+),\"(.*)\"(?:,(0x[a-f0-9]+),([~*])?)?(?:,(\d+))?")
317 r"code-move,(0x[a-f0-9]+),(0x[a-f0-9]+)")
320 r"code-delete,(0x[a-f0-9]+)")
325 _CODE_MOVING_GC = "code-moving-gc"
337 assert match, "No code info in log"
373 code = Code(name, start_address, end_address, origin, origin_offset)
376 CodeLogReader._HandleCodeConflict(conficting_code, code)
378 # attempts to reconstruct code log from the snapshot.
380 # "Warning: Skipping duplicate code log entry %s" % code
382 self.code_map.Add(code)
390 # Skip useless code move entries.
392 code = self.code_map.Find(old_start_address)
393 if not code:
396 assert code.start_address == old_start_address, \
397 "Inexact move address %x for %s" % (old_start_address, code)
398 self.code_map.Remove(code)
399 size = code.end_address - code.start_address
400 code.start_address = new_start_address
401 code.end_address = new_start_address + size
402 self.code_map.Add(code)
408 code = self.code_map.Find(old_start_address)
409 if not code:
412 assert code.start_address == old_start_address, \
413 "Inexact delete address %x for %s" % (old_start_address, code)
414 self.code_map.Remove(code)
422 code = self.code_map.Find(start_address)
423 if code:
424 assert code.start_address == start_address, \
425 "Inexact snapshot address %x for %s" % (start_address, code)
426 self.snapshot_pos_to_name[snapshot_pos] = code.name
439 "Conficting code log entries %s and %s" % (old_code, new_code)
446 # Kludge: there are code objects with custom names that don't
451 # Code object may be shared by a few functions. Collect the full
689 if line.find("CODE") != -1:
717 code_map.Add(Code(name, start_address, start_address + size,
745 code = None
752 if code:
753 code.end_address = start_address
754 code_map.Add(code, 16)
755 code = Code(name, start_address, end_address, "kernel", 0)
761 used_code = [code for code in code_map.UsedCode()]
763 for i, code in enumerate(used_code):
764 print "%10d %s [%s]" % (code.self_ticks, code.FullName(), code.origin)
766 code.PrintAnnotated(code_info, options)
777 for code in code_map.UsedCode():
778 if code.self_ticks < 10:
780 print "n%d [shape=box,label=\"%s\"];" % (code.id, code.name)
781 if code.callee_ticks:
782 for callee, ticks in code.callee_ticks.iteritems():
783 print "n%d -> n%d [label=\"%d\"];" % (code.id, callee.id, ticks)
828 print "V8 logs: %s, %s, %s.code" % (options.snapshot_log,
832 print "V8 log: %s, %s.code (no snapshot)" % (options.log, options.log)
843 # Initialize the log reader and get the code info.
852 print "Generated code architecture: %s" % code_info.arch
864 # Process the code and trace logs.
885 code = code_map.Find(sample.ip)
886 if code:
887 code.Tick(sample.ip)
890 if not library_repo.Tick(sample.ip) and not code:
896 if code:
897 caller_code.CalleeTick(code)
898 code = caller_code