• Benedikt Meurer's avatar
    [builtins] Use @@species protector for the PromiseResolve fast-path. · 9a6c54fc
    Benedikt Meurer authored
    The @@species protector guards the following (in case of Promises):
    
      - The initial Promise.prototype has the initial "constructor"
        pointing to the Promise constructor.
      - No JSPromise instance has a "constructor" property.
    
    So this is sufficient to guard the fast-path in PromiseResolve, given
    that we check whether the value is actually a JSPromise and that the
    [[Prototype]] of value is the (initial) Promise.prototype.
    
    Also refactor the code a bit and avoid the BranchIfSameValue, which
    blows up the builtin quite a lot, since we already know that constructor
    must be a valid JSReceiver and thus we can simply use WordEqual to
    compare value's "constructor" to the constructor.
    
    Bug: v8:7253
    Change-Id: I6413882241c9648c95bb2299100a6c3a7c803110
    Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
    Reviewed-on: https://chromium-review.googlesource.com/890438Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
    Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#50933}
    9a6c54fc
code-stub-assembler.h 101 KB