• Seth Brenith's avatar
    [torque] Automatically generate verifier functions · e483fb27
    Seth Brenith authored
    This change generates functions that verify the things that Torque knows
    about objects and their fields. We still must implement each verifier
    function in objects-debug.cc, but we can call into the generated code to
    verify that field types match their Torque definitions. If no additional
    verification is required, we can use the macro USE_TORQUE_VERIFIER as a
    shorthand for a verifier that calls the corresponding generated
    function.
    
    A new annotation @noVerifier can be applied to both class and field
    definitions, to prevent generating verification code. This allows fully
    customized verification for complicated cases like
    JSFunction::prototype_or_initial_map, which might not exist at all, and
    JSObject::elements, which might be a one pointer filler map.
    
    Because Factory::InitializeJSObjectFromMap fills new objects with
    undefined values, and many verifiers need to deal with partially-
    initialized objects, the generated verifiers allow undefined values on
    every class deriving from JSObject. In cases where stricter checks were
    previously performed, they are kept in objects-debug.cc.
    
    Bug: v8:7793
    Change-Id: I84034efadca89ba0aceddf92e886ffbfaa4c23fa
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1594042
    Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
    Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#61422}
    e483fb27
objects-debug.cc 74.2 KB