• Jakob Gruber's avatar
    [compiler] Introduce TryMakeRef/MakeRef factory functions · ca7f2852
    Jakob Gruber authored
    In the near future we'll have more cases where Ref construction is not
    guaranteed to succeed. Currently, we don't have convenient patterns to
    support optional construction. This CL adds the following helpers:
    
     base::Optional<FooRef> ref = TryMakeRef(broker, o);
     if (!ref.has_value()) return {};  // bailout
     // .. use ref.
    
    Or, in the case where construction is guaranteed to succeed:
    
     FooRef ref = MakeRef(broker, o);
     // .. use ref.
    
    Bug: v8:7790
    Change-Id: I759235c314056c080d79ec413125d3957452c64c
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2859169Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
    Commit-Queue: Jakob Gruber <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#74325}
    ca7f2852
heap-refs.cc 169 KB