• Yang Guo's avatar
    [snapshot] clear internal fields that are serialized by callback · 4495cba3
    Yang Guo authored
    This is to ensure the snapshot is deterministic.
    
    Internal fields can contain:
    - reference to heap object
    - embedder-defined aligned pointer
    - a smi
    
    The latter two are not distinguishable by V8, so if the serializer
    callback returns non-zero value, we consider it to be an aligned pointer
    and clear it to ensure that the snapshot does not contain memory
    addresses that may not be deterministic. If the callback returns
    { nullptr, 0 } as result, we consider it to be a smi or some in-place
    data that we then serialize verbatim.
    
    
    R=jgruber@chromium.org
    
    Bug: chromium:870584
    Change-Id: I3cf9abf135ffd28d8138fa32636b12596b076e13
    Reviewed-on: https://chromium-review.googlesource.com/c/1304441
    Commit-Queue: Yang Guo <yangguo@chromium.org>
    Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#57272}
    4495cba3
v8.h 335 KB