Search code examples
v8

Why %DebugPrint doesn't print all information about my object?


node --allow-natives-syntax test.js

var obj = {a: 1};
%DebugPrint(obj);

It will output: 0x053bedbc1399 <Object map = 0x53b630d1d51>

But in earlier versions of v8 it prints full information about object, something like:

0x337ab90027d9: [Map]
 - type: JS_ARRAY_TYPE
 - instance size: 32
 - inobject properties: 0
 - elements kind: PACKED_SMI_ELEMENTS
 - unused property fields: 0
 - enum length: invalid
 - back pointer: 0x337a1f6822e1 <undefined>
 - instance descriptors (own) #1: 0x337a3c307a69 <FixedArray[5]>
 - layout descriptor: 0x0
 - transitions #1: 0x337a3c307979 <TransitionArray[4]>Transition array #1:
     0x337a1f684631 <Symbol: (elements_transition_symbol)>: (transition to HOLEY_SMI_ELEMENTS) -> 0x337ab9002889 <Map(HOLEY_SMI_ELEMENTS)>

 - prototype: 0x337a3c307809 <JSArray[0]>
 - constructor: 0x337a3c304f21 <JSFunction Array (sfi = 0x337a1f6a9cb1)>
 - code cache: 0x337a1f682251 <FixedArray[0]>
 - dependent code: 0x337a1f682251 <FixedArray[0]>
 - construction counter: 0

Solution

  • This is a difference between Release and Debug builds, not between versions. In Release mode, most of the implementation of debug-printing is skipped (for binary-size reasons), so you'll only get one line of output. In Debug builds, you'll get the full details. This has not changed recently.