• Mathias Bynens's avatar
    [printing] Print feedback vectors · 8be73bad
    Mathias Bynens authored
    This patch makes `%DebugPrint(fn)` print `fn`’s feedback vector when
    available.
    
    Example output:
    
    ```
    d8> fn = (x) => x + '.'; fn(''); %DebugPrint(fn)
    DebugPrint: 0x1c12b950df81: [Function]
     - map = 0x1c12b1802361 [FastProperties]
     - prototype = 0x1c12ec904591
     - elements = 0x1c12f5702241 <FixedArray[0]> [HOLEY_ELEMENTS]
     - initial_map =
     - shared_info = 0x1c12ec92fde9 <SharedFunctionInfo fn>
     - name = 0x1c12ec92fcd1 <String[2]: fn>
     - formal_parameter_count = 1
     - kind = [ ArrowFunction ]
     - context = 0x1c12ec903cd1 <FixedArray[278]>
     - code = 0x220721125061 <Code BUILTIN>
     - interpreted
     - bytecode = 0x1c12ec930181
     - source code = (x) => x + '.'
     - properties = 0x1c12f5702241 <FixedArray[0]> {
        #length: 0x1c12e3095eb1 <AccessorInfo> (const accessor descriptor)
        #name: 0x1c12e3095f21 <AccessorInfo> (const accessor descriptor)
     }
    
     - feedback vector: 0x1c12ec9301f9: [FeedbackVector] in OldSpace
     - length: 1
     SharedFunctionInfo: 0x1c12ec92fde9 <SharedFunctionInfo fn>
     Optimized Code: 0
     Invocation Count: 1
     Profiler Ticks: 0
     Slot #0 BinaryOp MONOMORPHIC
      [0]: 8
    0x1c12b1802361: [Map]
     - type: JS_FUNCTION_TYPE
     - instance size: 72
     - inobject properties: 0
     - elements kind: HOLEY_ELEMENTS
     - unused property fields: 0
     - enum length: invalid
     - callable
     - back pointer: 0x1c12f57022d1 <undefined>
     - instance descriptors (own) #2: 0x1c12ec9048e9 <FixedArray[8]>
     - layout descriptor: 0x0
     - prototype: 0x1c12ec904591 <JSFunction (sfi = 0x1c12f5707c91)>
     - constructor: 0x1c12f5702201 <null>
     - code cache: 0x1c12f5702241 <FixedArray[0]>
     - dependent code: 0x1c12f5702241 <FixedArray[0]>
     - construction counter: 0
    
    (x) => x + '.'
    ```
    
    Example output when feedback vector is not available:
    
    ```
    d8> %DebugPrint(() => {})
    DebugPrint: 0x1c12b950bf49: [Function]
     - map = 0x1c12b1802361 [FastProperties]
     - prototype = 0x1c12ec904591
     - elements = 0x1c12f5702241 <FixedArray[0]> [HOLEY_ELEMENTS]
     - initial_map =
     - shared_info = 0x1c12ec92c021 <SharedFunctionInfo>
     - name = 0x1c12f5702431 <String[0]: >
     - formal_parameter_count = 0
     - kind = [ ArrowFunction ]
     - context = 0x1c12ec903cd1 <FixedArray[278]>
     - code = 0x220721004861 <Code BUILTIN>
     - source code = () => {}
     - properties = 0x1c12f5702241 <FixedArray[0]> {
        #length: 0x1c12e3095eb1 <AccessorInfo> (const accessor descriptor)
        #name: 0x1c12e3095f21 <AccessorInfo> (const accessor descriptor)
     }
    
     - feedback vector: not available
    0x1c12b1802361: [Map]
     - type: JS_FUNCTION_TYPE
     - instance size: 72
     - inobject properties: 0
     - elements kind: HOLEY_ELEMENTS
     - unused property fields: 0
     - enum length: invalid
     - callable
     - back pointer: 0x1c12f57022d1 <undefined>
     - instance descriptors (own) #2: 0x1c12ec9048e9 <FixedArray[8]>
     - layout descriptor: 0x0
     - prototype: 0x1c12ec904591 <JSFunction (sfi = 0x1c12f5707c91)>
     - constructor: 0x1c12f5702201 <null>
     - code cache: 0x1c12f5702241 <FixedArray[0]>
     - dependent code: 0x1c12f5702241 <FixedArray[0]>
     - construction counter: 0
    
    () => {}
    ```
    
    Change-Id: Ic80289bff652cfc8d04182c68740843c61c87849
    Reviewed-on: https://chromium-review.googlesource.com/591369
    Commit-Queue: Mathias Bynens <mathias@chromium.org>
    Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
    Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#46977}
    8be73bad
objects-printer.cc 58.6 KB