• caitpotter88's avatar
    [es6] refactor Promise resolution · 24ff30b7
    caitpotter88 authored
    Several changes are included here:
    
    1. Each resolution callback references shared data indicating whether
    it has already been resolved or not, as described in 25.4.1.3
    http://tc39.github.io/ecma262/#sec-createresolvingfunctions.
    Previously this was handled exclusively by the Promise's status,
    which does not work correctly with the current chaining behaviour.
    
    2. During fulfillment, When a Promise is resolved with a thenable, the
    spec chains the promises together by invoking the thenable's `then`
    function with the original Promise's resolve and reject methods (per
    section 25.4.2.2, or
    http://tc39.github.io/ecma262/#sec-promiseresolvethenablejob, on the
    next tick, regardless of whether or not there are pending tasks.
    
    3. Adds a spec compliance fix to ensure that the Promise constructor
    is only loaded once when `then()` is called, solving v8:4539 as well.
    This involves refactoring PromiseChain to accept a constructor
    argument. PromiseChain/PromiseDeferred will hopefully be removed soon,
    simplifying the process.
    
    BUG=v8:4162, v8:4539, v8:3237
    LOG=N
    R=rossberg@chromium.org, littledan@chromium.org, adamk@chromium.org
    
    Review URL: https://codereview.chromium.org/1394463003
    
    Cr-Commit-Position: refs/heads/master@{#32046}
    24ff30b7
Name
Last commit
Last update
benchmarks Loading commit data...
build Loading commit data...
docs Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party/binutils Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.gitignore Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
Makefile Loading commit data...
Makefile.android Loading commit data...
Makefile.nacl Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...