• 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...
cctest Loading commit data...
intl Loading commit data...
js-perf-test Loading commit data...
memory Loading commit data...
message Loading commit data...
mjsunit Loading commit data...
mozilla Loading commit data...
preparser Loading commit data...
promises-aplus Loading commit data...
simdjs Loading commit data...
test262 Loading commit data...
unittests Loading commit data...
webkit Loading commit data...
bot_default.gyp Loading commit data...
bot_default.isolate Loading commit data...
default.gyp Loading commit data...
default.isolate Loading commit data...
optimize_for_size.gyp Loading commit data...
optimize_for_size.isolate Loading commit data...