Lines Matching refs:Code
8 # * Redistributions of source code must retain the above copyright
84 class Code(object):
85 """Code object."""
94 self.id = Code._id
95 Code._id += 1
106 self.codetype = Code.OPTIMIZED
108 self.codetype = Code.FULL_CODEGEN
110 self.codetype = Code.V8INTERNAL
112 self.codetype = Code.UNKNOWN
208 """Group of adjacent code objects."""
230 def Add(self, code):
231 self.code_objects.append(code)
233 def Remove(self, code):
234 self.code_objects.remove(code)
238 for i, code in enumerate(code_objects):
239 if code.start_address <= pc < code.end_address:
240 code_objects[0], code_objects[i] = code, code_objects[0]
241 return code
249 """Code object map."""
256 def Add(self, code, max_pages=-1):
257 page_id = CodePage.PageId(code.start_address)
258 limit_id = CodePage.PageId(code.end_address + CodePage.SIZE - 1)
264 max_pages, code.name, code.origin)
271 page.Add(code)
274 self.min_address = min(self.min_address, code.start_address)
275 self.max_address = max(self.max_address, code.end_address)
277 def Remove(self, code):
278 page_id = CodePage.PageId(code.start_address)
279 limit_id = CodePage.PageId(code.end_address + CodePage.SIZE - 1)
286 page.Remove(code)
293 for code in page:
294 if CodePage.PageAddress(code.start_address) == page.address:
295 yield code
298 for code in self.AllCode():
299 if code.IsUsed():
300 yield code
303 for code in self.AllCode():
304 print code
316 """Generic info about generated code objects."""
327 r"snapshot-code-name,(\d+),\"(.*)\"")
416 code = Code(name, start_address, end_address, origin, origin_offset)
419 if not (conficting_code.start_address == code.start_address and
420 conficting_code.end_address == code.end_address):
423 LogReader._HandleCodeConflict(conficting_code, code)
425 # attempts to reconstruct code log from the snapshot.
427 # "Warning: Skipping duplicate code log entry %s" % code
429 self.code_map.Add(code)
438 # Skip useless code move entries.
440 code = self.code_map.Find(old_start_address)
441 if not code:
444 assert code.start_address == old_start_address, \
445 "Inexact move address %x for %s" % (old_start_address, code)
446 self.code_map.Remove(code)
447 size = code.end_address - code.start_address
448 code.start_address = new_start_address
449 code.end_address = new_start_address + size
450 self.code_map.Add(code)
457 code = self.code_map.Find(old_start_address)
458 if not code:
461 assert code.start_address == old_start_address, \
462 "Inexact delete address %x for %s" % (old_start_address, code)
463 self.code_map.Remove(code)
493 "Conficting code
496 # Code object may be shared by a few functions. Collect the full
747 if line.find("CODE") != -1:
775 code_map.Add(Code(name, start_address, start_address + size,
803 code = None
810 if code:
811 code.end_address = start_address
812 code_map.Add(code, 16)
813 code = Code(name, start_address, end_address, "kernel", 0)
819 used_code = [code for code in code_map.UsedCode()]
821 for i, code in enumerate(used_code):
822 code_ticks = code.self_ticks
824 code.FullName(), code.origin)
826 code.PrintAnnotated(arch, options)
839 for code in code_map.UsedCode():
840 if code.self_ticks < 10:
842 print "n%d [shape=box,label=\"%s\"];" % (code.id, code.name)
843 if code.callee_ticks:
844 for callee, ticks in code.callee_ticks.iteritems():
845 print "n%d -> n%d [label=\"%d\"];" % (code.id, callee.id, ticks)
937 print "Generated code architecture: %s" % log_reader.arch
941 # Process the code and trace logs.
962 code = code_map.Find(sample.ip)
963 if code:
964 code.Tick(sample.ip)
965 if code.codetype == Code.OPTIMIZED:
967 elif code.codetype == Code.FULL_CODEGEN:
969 elif code.codetype == Code.V8INTERNAL:
973 if not library_repo.Tick(sample.ip) and not code:
979 if code:
980 code)
981 code = caller_code
1002 PrintTicks(optimized_ticks, ticks, "ticks in optimized code")
1003 PrintTicks(generated_ticks, ticks, "ticks in other lazily compiled code")