Changeset 196022 in webkit


Ignore:
Timestamp:
Feb 2, 2016 11:33:05 AM (8 years ago)
Author:
Yusuke Suzuki
Message:

[JSC] Introduce BytecodeIntrinsic constant rep like @undefined
https://bugs.webkit.org/show_bug.cgi?id=153737

Reviewed by Darin Adler.

Source/JavaScriptCore:

This patch enhances existing BytecodeIntrinsic mechanism to accept @xxx form,
that will be used to represent bytecode intrinsic constants.
After this change, we can use 2 forms for bytecode intrinsics. (1) Function form (like, @toString(value))
and (2) Constant form (like @undefined).

Bytecode intrinsic constants allow us to easily expose constant values from C++ world.
For example, we can expose ArrayIterationKind flags to JS world without using private global variables.
Exposed constant values are loaded from bytecodes directly through constant registers.
While previously we expose them through private global variables, bytecode intrinsic constants
can be loaded directly from CodeBlock. And later, it will become JSConstant in DFG.

And by using this mechanism, we implement several constants. @undefined, @arrayIterationKindKeyValue etc.

  • builtins/ArrayConstructor.js:

(from):

  • builtins/ArrayIteratorPrototype.js:

(next):

  • builtins/ArrayPrototype.js:

(reduce):
(reduceRight):
(every):
(forEach):
(filter):
(map):
(some):
(fill):
(find):
(findIndex):
(includes):
(sort.compactSparse):
(sort.compactSlow):
(sort.compact):
(sort):
(copyWithin):

  • builtins/DatePrototype.js:

(toLocaleString.toDateTimeOptionsAnyAll):
(toLocaleString):
(toLocaleDateString.toDateTimeOptionsDateDate):
(toLocaleDateString):
(toLocaleTimeString.toDateTimeOptionsTimeTime):
(toLocaleTimeString):

  • builtins/GeneratorPrototype.js:

(generatorResume):

  • builtins/GlobalObject.js:

(isDictionary):

  • builtins/InternalPromiseConstructor.js:

(internalAll.newResolveElement):
(internalAll):

  • builtins/IteratorPrototype.js:

(symbolIteratorGetter):
(symbolIterator): Deleted.

  • builtins/MapPrototype.js:

(forEach):

  • builtins/ModuleLoaderObject.js:

(newRegistryEntry):
(forceFulfillPromise):
(commitInstantiated):
(requestFetch):
(requestTranslate):
(requestInstantiate):
(requestLink):
(provide):

  • builtins/PromiseConstructor.js:

(all.newResolveElement):
(all):
(race):
(reject):
(resolve):

  • builtins/PromiseOperations.js:

(newPromiseCapability.executor):
(newPromiseCapability):
(rejectPromise):
(fulfillPromise):
(createResolvingFunctions.resolve):
(createResolvingFunctions.reject):
(createResolvingFunctions):
(promiseReactionJob):
(promiseResolveThenableJob):
(initializePromise):

  • builtins/PromisePrototype.js:

(catch):
(then):

  • builtins/SetPrototype.js:

(forEach):

  • builtins/StringConstructor.js:

(raw):

  • builtins/StringIteratorPrototype.js:

(next):

  • builtins/StringPrototype.js:

(localeCompare):

  • builtins/TypedArrayConstructor.js:

(of):
(from):

  • builtins/TypedArrayPrototype.js:

(every):
(find):
(findIndex):
(forEach):
(some):
(reduce):
(reduceRight):
(map):
(filter):

  • bytecode/BytecodeIntrinsicRegistry.cpp:

(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
(JSC::BytecodeIntrinsicRegistry::lookup):

  • bytecode/BytecodeIntrinsicRegistry.h:
  • bytecompiler/NodesCodegen.cpp:
  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createResolve):
(JSC::ASTBuilder::makeFunctionCallNode):

  • parser/NodeConstructors.h:

(JSC::BytecodeIntrinsicNode::BytecodeIntrinsicNode):

  • parser/Nodes.h:

(JSC::ExpressionNode::isBytecodeIntrinsicNode):
(JSC::BytecodeIntrinsicNode::type):
(JSC::BytecodeIntrinsicNode::emitter):

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parsePrimaryExpression):

  • parser/SyntaxChecker.h:

(JSC::SyntaxChecker::createResolve):

  • runtime/CommonIdentifiers.cpp:

(JSC::CommonIdentifiers::CommonIdentifiers): Deleted.

  • runtime/CommonIdentifiers.h:

(JSC::CommonIdentifiers::bytecodeIntrinsicRegistry): Deleted.

  • runtime/IteratorPrototype.cpp:

(JSC::IteratorPrototype::finishCreation):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init): Deleted.

  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:

(JSC::VM::bytecodeIntrinsicRegistry):

Source/WebCore:

  • Modules/fetch/FetchHeaders.js:

(initializeFetchHeaders):

  • Modules/streams/ReadableStream.js:

(initializeReadableStream):
(closeDestination):
(abortDestination):
(pipeTo):

  • Modules/streams/ReadableStreamInternals.js:

(privateInitializeReadableStreamController):
(teeReadableStream):
(isReadableStreamReader):
(errorReadableStream):
(finishClosingReadableStream):
(enqueueInReadableStream):
(readFromReadableStreamReader):

  • Modules/streams/ReadableStreamReader.js:

(releaseLock):

  • Modules/streams/StreamInternals.js:

(shieldingPromiseResolve):
(promiseInvokeOrNoopNoCatch):
(promiseInvokeOrFallbackOrNoop):
(validateAndNormalizeQueuingStrategy):

  • Modules/streams/WritableStream.js:

(initializeWritableStream):
(write):

  • Modules/streams/WritableStreamInternals.js:

(errorWritableStream):

Location:
trunk/Source
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r196019 r196022  
     12016-02-02  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [JSC] Introduce BytecodeIntrinsic constant rep like @undefined
     4        https://bugs.webkit.org/show_bug.cgi?id=153737
     5
     6        Reviewed by Darin Adler.
     7
     8        This patch enhances existing BytecodeIntrinsic mechanism to accept `@xxx` form,
     9        that will be used to represent bytecode intrinsic constants.
     10        After this change, we can use 2 forms for bytecode intrinsics. (1) Function form (like, @toString(value))
     11        and (2) Constant form (like @undefined).
     12
     13        Bytecode intrinsic constants allow us to easily expose constant values from C++ world.
     14        For example, we can expose ArrayIterationKind flags to JS world without using private global variables.
     15        Exposed constant values are loaded from bytecodes directly through constant registers.
     16        While previously we expose them through private global variables, bytecode intrinsic constants
     17        can be loaded directly from CodeBlock. And later, it will become JSConstant in DFG.
     18
     19        And by using this mechanism, we implement several constants. @undefined, @arrayIterationKindKeyValue etc.
     20
     21        * builtins/ArrayConstructor.js:
     22        (from):
     23        * builtins/ArrayIteratorPrototype.js:
     24        (next):
     25        * builtins/ArrayPrototype.js:
     26        (reduce):
     27        (reduceRight):
     28        (every):
     29        (forEach):
     30        (filter):
     31        (map):
     32        (some):
     33        (fill):
     34        (find):
     35        (findIndex):
     36        (includes):
     37        (sort.compactSparse):
     38        (sort.compactSlow):
     39        (sort.compact):
     40        (sort):
     41        (copyWithin):
     42        * builtins/DatePrototype.js:
     43        (toLocaleString.toDateTimeOptionsAnyAll):
     44        (toLocaleString):
     45        (toLocaleDateString.toDateTimeOptionsDateDate):
     46        (toLocaleDateString):
     47        (toLocaleTimeString.toDateTimeOptionsTimeTime):
     48        (toLocaleTimeString):
     49        * builtins/GeneratorPrototype.js:
     50        (generatorResume):
     51        * builtins/GlobalObject.js:
     52        (isDictionary):
     53        * builtins/InternalPromiseConstructor.js:
     54        (internalAll.newResolveElement):
     55        (internalAll):
     56        * builtins/IteratorPrototype.js:
     57        (symbolIteratorGetter):
     58        (symbolIterator): Deleted.
     59        * builtins/MapPrototype.js:
     60        (forEach):
     61        * builtins/ModuleLoaderObject.js:
     62        (newRegistryEntry):
     63        (forceFulfillPromise):
     64        (commitInstantiated):
     65        (requestFetch):
     66        (requestTranslate):
     67        (requestInstantiate):
     68        (requestLink):
     69        (provide):
     70        * builtins/PromiseConstructor.js:
     71        (all.newResolveElement):
     72        (all):
     73        (race):
     74        (reject):
     75        (resolve):
     76        * builtins/PromiseOperations.js:
     77        (newPromiseCapability.executor):
     78        (newPromiseCapability):
     79        (rejectPromise):
     80        (fulfillPromise):
     81        (createResolvingFunctions.resolve):
     82        (createResolvingFunctions.reject):
     83        (createResolvingFunctions):
     84        (promiseReactionJob):
     85        (promiseResolveThenableJob):
     86        (initializePromise):
     87        * builtins/PromisePrototype.js:
     88        (catch):
     89        (then):
     90        * builtins/SetPrototype.js:
     91        (forEach):
     92        * builtins/StringConstructor.js:
     93        (raw):
     94        * builtins/StringIteratorPrototype.js:
     95        (next):
     96        * builtins/StringPrototype.js:
     97        (localeCompare):
     98        * builtins/TypedArrayConstructor.js:
     99        (of):
     100        (from):
     101        * builtins/TypedArrayPrototype.js:
     102        (every):
     103        (find):
     104        (findIndex):
     105        (forEach):
     106        (some):
     107        (reduce):
     108        (reduceRight):
     109        (map):
     110        (filter):
     111        * bytecode/BytecodeIntrinsicRegistry.cpp:
     112        (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
     113        (JSC::BytecodeIntrinsicRegistry::lookup):
     114        * bytecode/BytecodeIntrinsicRegistry.h:
     115        * bytecompiler/NodesCodegen.cpp:
     116        * parser/ASTBuilder.h:
     117        (JSC::ASTBuilder::createResolve):
     118        (JSC::ASTBuilder::makeFunctionCallNode):
     119        * parser/NodeConstructors.h:
     120        (JSC::BytecodeIntrinsicNode::BytecodeIntrinsicNode):
     121        * parser/Nodes.h:
     122        (JSC::ExpressionNode::isBytecodeIntrinsicNode):
     123        (JSC::BytecodeIntrinsicNode::type):
     124        (JSC::BytecodeIntrinsicNode::emitter):
     125        * parser/Parser.cpp:
     126        (JSC::Parser<LexerType>::parseProperty):
     127        (JSC::Parser<LexerType>::parsePrimaryExpression):
     128        * parser/SyntaxChecker.h:
     129        (JSC::SyntaxChecker::createResolve):
     130        * runtime/CommonIdentifiers.cpp:
     131        (JSC::CommonIdentifiers::CommonIdentifiers): Deleted.
     132        * runtime/CommonIdentifiers.h:
     133        (JSC::CommonIdentifiers::bytecodeIntrinsicRegistry): Deleted.
     134        * runtime/IteratorPrototype.cpp:
     135        (JSC::IteratorPrototype::finishCreation):
     136        * runtime/JSGlobalObject.cpp:
     137        (JSC::JSGlobalObject::init): Deleted.
     138        * runtime/VM.cpp:
     139        (JSC::VM::VM):
     140        * runtime/VM.h:
     141        (JSC::VM::bytecodeIntrinsicRegistry):
     142
    11432016-02-02  Per Arne Vollan  <peavo@outlook.com>
    2144
  • trunk/Source/JavaScriptCore/builtins/ArrayConstructor.js

    r188542 r196022  
    4343    var thisObj = this;
    4444
    45     var mapFn = arguments.length > 1 ? arguments[1] : undefined;
     45    var mapFn = arguments.length > 1 ? arguments[1] : @undefined;
    4646
    4747    var thisArg;
    4848
    49     if (mapFn !== undefined) {
     49    if (mapFn !== @undefined) {
    5050        if (typeof mapFn !== "function")
    5151            throw new @TypeError("Array.from requires that the second argument, when provided, be a function");
     
    8080        for (var value of wrapper) {
    8181            if (mapFn)
    82                 @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));
     82                @putByValDirect(result, k, thisArg === @undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));
    8383            else
    8484                @putByValDirect(result, k, value);
     
    100100        var value = arrayLike[k];
    101101        if (mapFn)
    102             @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));
     102            @putByValDirect(result, k, thisArg === @undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));
    103103        else
    104104            @putByValDirect(result, k, value);
  • trunk/Source/JavaScriptCore/builtins/ArrayIteratorPrototype.js

    r192751 r196022  
    3232
    3333    var itemKind = this.@arrayIterationKind;
    34     if (itemKind === undefined)
     34    if (itemKind === @undefined)
    3535        throw new @TypeError("%ArrayIteratorPrototype%.next requires that |this| be an Array Iterator instance");
    3636
    3737    var done = true;
    38     var value = undefined;
     38    var value = @undefined;
    3939
    4040    var array = this.@iteratedObject;
    41     if (array !== undefined) {
     41    if (array !== @undefined) {
    4242        var index = this.@arrayIteratorNextIndex;
    4343        var length = array.length >>> 0;
    4444        if (index >= length) {
    45             this.@iteratedObject = undefined;
     45            this.@iteratedObject = @undefined;
    4646        } else {
    4747            this.@arrayIteratorNextIndex = index + 1;
  • trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js

    r192751 r196022  
    3232        throw new @TypeError("Array.prototype.reduce requires that |this| not be null");
    3333
    34     if (this === undefined)
     34    if (this === @undefined)
    3535        throw new @TypeError("Array.prototype.reduce requires that |this| not be undefined");
    3636
     
    5757    while (k < length) {
    5858        if (k in array)
    59             accumulator = callback.@call(undefined, accumulator, array[k], k, array);
     59            accumulator = callback.@call(@undefined, accumulator, array[k], k, array);
    6060        k += 1;
    6161    }
     
    7070        throw new @TypeError("Array.prototype.reduceRight requires that |this| not be null");
    7171
    72     if (this === undefined)
     72    if (this === @undefined)
    7373        throw new @TypeError("Array.prototype.reduceRight requires that |this| not be undefined");
    7474
     
    9595    while (k >= 0) {
    9696        if (k in array)
    97             accumulator = callback.@call(undefined, accumulator, array[k], k, array);
     97            accumulator = callback.@call(@undefined, accumulator, array[k], k, array);
    9898        k -= 1;
    9999    }
     
    108108        throw new @TypeError("Array.prototype.every requires that |this| not be null");
    109109   
    110     if (this === undefined)
     110    if (this === @undefined)
    111111        throw new @TypeError("Array.prototype.every requires that |this| not be undefined");
    112112   
     
    117117        throw new @TypeError("Array.prototype.every callback must be a function");
    118118   
    119     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     119    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    120120   
    121121    for (var i = 0; i < length; i++) {
     
    136136        throw new @TypeError("Array.prototype.forEach requires that |this| not be null");
    137137   
    138     if (this === undefined)
     138    if (this === @undefined)
    139139        throw new @TypeError("Array.prototype.forEach requires that |this| not be undefined");
    140140   
     
    145145        throw new @TypeError("Array.prototype.forEach callback must be a function");
    146146   
    147     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     147    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    148148   
    149149    for (var i = 0; i < length; i++) {
     
    160160        throw new @TypeError("Array.prototype.filter requires that |this| not be null");
    161161   
    162     if (this === undefined)
     162    if (this === @undefined)
    163163        throw new @TypeError("Array.prototype.filter requires that |this| not be undefined");
    164164   
     
    169169        throw new @TypeError("Array.prototype.filter callback must be a function");
    170170   
    171     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     171    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    172172    var result = [];
    173173    var nextIndex = 0;
     
    191191        throw new @TypeError("Array.prototype.map requires that |this| not be null");
    192192   
    193     if (this === undefined)
     193    if (this === @undefined)
    194194        throw new @TypeError("Array.prototype.map requires that |this| not be undefined");
    195195   
     
    200200        throw new @TypeError("Array.prototype.map callback must be a function");
    201201   
    202     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     202    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    203203    var result = [];
    204204    result.length = length;
     
    220220        throw new @TypeError("Array.prototype.some requires that |this| not be null");
    221221   
    222     if (this === undefined)
     222    if (this === @undefined)
    223223        throw new @TypeError("Array.prototype.some requires that |this| not be undefined");
    224224   
     
    229229        throw new @TypeError("Array.prototype.some callback must be a function");
    230230   
    231     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     231    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    232232    for (var i = 0; i < length; i++) {
    233233        if (!(i in array))
     
    246246        throw new @TypeError("Array.prototype.fill requires that |this| not be null");
    247247   
    248     if (this === undefined)
     248    if (this === @undefined)
    249249        throw new @TypeError("Array.prototype.fill requires that |this| not be undefined");
    250250    var O = @Object(this);
    251251    var len = @toLength(O.length);
    252252    var relativeStart = 0;
    253     if (arguments.length > 1 && arguments[1] !== undefined)
     253    if (arguments.length > 1 && arguments[1] !== @undefined)
    254254        relativeStart = arguments[1] | 0;
    255255    var k = 0;
     
    264264    }
    265265    var relativeEnd = len;
    266     if (arguments.length > 2 && arguments[2] !== undefined)
     266    if (arguments.length > 2 && arguments[2] !== @undefined)
    267267        relativeEnd = arguments[2] | 0;
    268268    var final = 0;
     
    288288        throw new @TypeError("Array.prototype.find requires that |this| not be null");
    289289   
    290     if (this === undefined)
     290    if (this === @undefined)
    291291        throw new @TypeError("Array.prototype.find requires that |this| not be undefined");
    292292   
     
    297297        throw new @TypeError("Array.prototype.find callback must be a function");
    298298   
    299     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     299    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    300300    for (var i = 0; i < length; i++) {
    301301        var kValue = array[i];
     
    303303            return kValue;
    304304    }
    305     return undefined;
     305    return @undefined;
    306306}
    307307
     
    313313        throw new @TypeError("Array.prototype.findIndex requires that |this| not be null");
    314314   
    315     if (this === undefined)
     315    if (this === @undefined)
    316316        throw new @TypeError("Array.prototype.findIndex requires that |this| not be undefined");
    317317   
     
    322322        throw new @TypeError("Array.prototype.findIndex callback must be a function");
    323323   
    324     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     324    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    325325    for (var i = 0; i < length; i++) {
    326326        if (callback.@call(thisArg, array[i], i, array))
     
    337337        throw new @TypeError("Array.prototype.includes requires that |this| not be null");
    338338
    339     if (this === undefined)
     339    if (this === @undefined)
    340340        throw new @TypeError("Array.prototype.includes requires that |this| not be undefined");
    341341
     
    347347
    348348    var fromIndex = 0;
    349     if (arguments.length > 1 && arguments[1] !== undefined)
     349    if (arguments.length > 1 && arguments[1] !== @undefined)
    350350        fromIndex = arguments[1] | 0;
    351351
     
    424424                    delete array[index];
    425425
    426                     if (value === undefined) {
     426                    if (value === @undefined) {
    427427                        ++undefinedCount;
    428428                        continue;
     
    435435
    436436        for (var i = valueCount; i < valueCount + undefinedCount; ++i)
    437             array[i] = undefined;
     437            array[i] = @undefined;
    438438
    439439        return valueCount;
     
    453453
    454454            var value = array[src];
    455             if (value === undefined)
     455            if (value === @undefined)
    456456                continue;
    457457
     
    463463
    464464        for (var i = valueCount; i < valueCount + undefinedCount; ++i)
    465             array[i] = undefined;
     465            array[i] = @undefined;
    466466
    467467        for (var i = valueCount + undefinedCount; i < length; ++i)
     
    475475    {
    476476        for (var i = 0; i < array.length; ++i) {
    477             if (array[i] === undefined)
     477            if (array[i] === @undefined)
    478478                return compactSlow(array, length);
    479479        }
     
    590590        throw new @TypeError("Array.prototype.sort requires that |this| not be null");
    591591
    592     if (this === undefined)
     592    if (this === @undefined)
    593593        throw new @TypeError("Array.prototype.sort requires that |this| not be undefined");
    594594
     
    620620    }
    621621
    622     if (this === null || this === undefined)
     622    if (this === null || this === @undefined)
    623623        throw new @TypeError("Array.copyWithin requires that |this| not be null or undefined");
    624624    var thisObject = @Object(this);
     
    635635    if (arguments.length >= 3) {
    636636        var end = arguments[2];
    637         if (end === undefined)
     637        if (end === @undefined)
    638638            relativeEnd = length;
    639639        else
  • trunk/Source/JavaScriptCore/builtins/DatePrototype.js

    r195381 r196022  
    3636
    3737        var options;
    38         if (opts === undefined)
     38        if (opts === @undefined)
    3939            options = null;
    4040        else if (opts === null)
     
    4545        // Check original instead of descendant to reduce lookups up the prototype chain.
    4646        var needsDefaults = !options || (
    47             options.weekday === undefined &&
    48             options.year === undefined &&
    49             options.month === undefined &&
    50             options.day === undefined &&
    51             options.hour === undefined &&
    52             options.minute === undefined &&
    53             options.second === undefined
     47            options.weekday === @undefined &&
     48            options.year === @undefined &&
     49            options.month === @undefined &&
     50            options.day === @undefined &&
     51            options.hour === @undefined &&
     52            options.minute === @undefined &&
     53            options.second === @undefined
    5454        );
    5555
     
    9393
    9494        var options;
    95         if (opts === undefined)
     95        if (opts === @undefined)
    9696            options = null;
    9797        else if (opts === null)
     
    102102        // Check original instead of descendant to reduce lookups up the prototype chain.
    103103        var needsDefaults = !options || (
    104             options.weekday === undefined &&
    105             options.year === undefined &&
    106             options.month === undefined &&
    107             options.day === undefined
     104            options.weekday === @undefined &&
     105            options.year === @undefined &&
     106            options.month === @undefined &&
     107            options.day === @undefined
    108108        );
    109109
     
    143143
    144144        var options;
    145         if (opts === undefined)
     145        if (opts === @undefined)
    146146            options = null;
    147147        else if (opts === null)
     
    152152        // Check original instead of descendant to reduce lookups up the prototype chain.
    153153        var needsDefaults = !options || (
    154             options.hour === undefined &&
    155             options.minute === undefined &&
    156             options.second === undefined
     154            options.hour === @undefined &&
     155            options.minute === @undefined &&
     156            options.second === @undefined
    157157        );
    158158
  • trunk/Source/JavaScriptCore/builtins/GeneratorPrototype.js

    r192937 r196022  
    4141    let state = generator.@generatorState;
    4242    let done = false;
    43     let value = undefined;
     43    let value = @undefined;
    4444
    4545    if (typeof state !== 'number')
  • trunk/Source/JavaScriptCore/builtins/GlobalObject.js

    r195460 r196022  
    6363    "use strict";
    6464
    65     return typeof object === "undefined" || object == null || typeof object === "object";
     65    return object === @undefined || object == null || typeof object === "object";
    6666}
    6767
  • trunk/Source/JavaScriptCore/builtins/InternalPromiseConstructor.js

    r188681 r196022  
    4949        {
    5050            if (alreadyCalled)
    51                 return undefined;
     51                return @undefined;
    5252            alreadyCalled = true;
    5353
     
    5656            --remainingElementsCount;
    5757            if (remainingElementsCount === 0)
    58                 return promiseCapability.@resolve.@call(undefined, values);
     58                return promiseCapability.@resolve.@call(@undefined, values);
    5959
    60             return undefined;
     60            return @undefined;
    6161        }
    6262    }
     
    6464    try {
    6565        if (array.length === 0)
    66             promiseCapability.@resolve.@call(undefined, values);
     66            promiseCapability.@resolve.@call(@undefined, values);
    6767        else {
    6868            for (var index = 0, length = array.length; index < length; ++index) {
    6969                var value = array[index];
    70                 @putByValDirect(values, index, undefined);
     70                @putByValDirect(values, index, @undefined);
    7171
    7272                var nextPromiseCapability = @newPromiseCapability(@InternalPromise);
    73                 nextPromiseCapability.@resolve.@call(undefined, value);
     73                nextPromiseCapability.@resolve.@call(@undefined, value);
    7474                var nextPromise = nextPromiseCapability.@promise;
    7575
     
    8080        }
    8181    } catch (error) {
    82         promiseCapability.@reject.@call(undefined, error);
     82        promiseCapability.@reject.@call(@undefined, error);
    8383    }
    8484
  • trunk/Source/JavaScriptCore/builtins/IteratorPrototype.js

    r192751 r196022  
    2424 */
    2525
    26 function symbolIterator()
     26function symbolIteratorGetter()
    2727{
    2828    "use strict";
  • trunk/Source/JavaScriptCore/builtins/MapPrototype.js

    r194838 r196022  
    3434        throw new @TypeError("Map.prototype.forEach callback must be a function");
    3535
    36     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     36    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    3737    var iterator = @MapIterator(this);
    3838
    3939    // To avoid object allocations for iterator result objects, we pass the placeholder to the special "next" function in order to fill the results.
    40     var value = [ undefined, undefined ];
     40    var value = [ @undefined, @undefined ];
    4141    for (;;) {
    4242        if (@mapIteratorNext.@call(iterator, value))
  • trunk/Source/JavaScriptCore/builtins/ModuleLoaderObject.js

    r189941 r196022  
    9999        key: key,
    100100        state: this.Fetch,
    101         metadata: undefined,
    102         fetch: undefined,
    103         translate: undefined,
    104         instantiate: undefined,
    105         resolveDependencies: undefined,
     101        metadata: @undefined,
     102        fetch: @undefined,
     103        translate: @undefined,
     104        instantiate: @undefined,
     105        resolveDependencies: @undefined,
    106106        dependencies: [], // To keep the module order, we store the module keys in the array.
    107         dependenciesMap: undefined,
    108         module: undefined, // JSModuleRecord
    109         error: undefined,
     107        dependenciesMap: @undefined,
     108        module: @undefined, // JSModuleRecord
     109        error: @undefined,
    110110    };
    111111}
     
    131131    "use strict";
    132132
    133     if (promise.@promiseState === @promisePending)
     133    if (promise.@promiseState === @promiseStatePending)
    134134        @fulfillPromise(promise, value);
    135135}
     
    200200        var pair = {
    201201            key: depKey,
    202             value: undefined
     202            value: @undefined
    203203        };
    204204        @putByValDirect(dependencies, i, pair);
     
    233233    if (entry.state > this.Link) {
    234234        var deferred = @newPromiseCapability(@InternalPromise);
    235         deferred.@reject.@call(undefined, new @TypeError("Requested module is already ready to be executed."));
     235        deferred.@reject.@call(@undefined, new @TypeError("Requested module is already ready to be executed."));
    236236        return deferred.@promise;
    237237    }
     
    265265    if (entry.state > this.Link) {
    266266        var deferred = @newPromiseCapability(@InternalPromise);
    267         deferred.@reject.@call(undefined, new @TypeError("Requested module is already ready to be executed."));
     267        deferred.@reject.@call(@undefined, new @TypeError("Requested module is already ready to be executed."));
    268268        return deferred.@promise;
    269269    }
     
    297297    if (entry.state > this.Link) {
    298298        var deferred = @newPromiseCapability(@InternalPromise);
    299         deferred.@reject.@call(undefined, new @TypeError("Requested module is already ready to be executed."));
     299        deferred.@reject.@call(@undefined, new @TypeError("Requested module is already ready to be executed."));
    300300        return deferred.@promise;
    301301    }
     
    339339    if (entry.state > this.Link) {
    340340        var deferred = @newPromiseCapability(@InternalPromise);
    341         deferred.@reject.@call(undefined, new @TypeError("Requested module is already ready to be executed."));
     341        deferred.@reject.@call(@undefined, new @TypeError("Requested module is already ready to be executed."));
    342342        return deferred.@promise;
    343343    }
     
    412412    if (entry.state > this.Link) {
    413413        var deferred = @newPromiseCapability(@InternalPromise);
    414         deferred.@resolve.@call(undefined, entry.module);
     414        deferred.@resolve.@call(@undefined, entry.module);
    415415        return deferred.@promise;
    416416    }
     
    505505        if (entry.status > this.Translate)
    506506            throw new @TypeError("Requested module is already translated.");
    507         this.fulfillFetch(entry, undefined);
     507        this.fulfillFetch(entry, @undefined);
    508508        this.fulfillTranslate(entry, value);
    509509        return;
     
    513513        if (entry.status > this.Instantiate)
    514514            throw new @TypeError("Requested module is already instantiated.");
    515         this.fulfillFetch(entry, undefined);
     515        this.fulfillFetch(entry, @undefined);
    516516        this.fulfillTranslate(entry, value);
    517517        var loader = this;
  • trunk/Source/JavaScriptCore/builtins/PromiseConstructor.js

    r188681 r196022  
    4747        {
    4848            if (alreadyCalled)
    49                 return undefined;
     49                return @undefined;
    5050            alreadyCalled = true;
    5151
     
    5454            --remainingElementsCount;
    5555            if (remainingElementsCount === 0)
    56                 return promiseCapability.@resolve.@call(undefined, values);
     56                return promiseCapability.@resolve.@call(@undefined, values);
    5757
    58             return undefined;
     58            return @undefined;
    5959        }
    6060    }
     
    6262    try {
    6363        for (var value of iterable) {
    64             @putByValDirect(values, index, undefined);
     64            @putByValDirect(values, index, @undefined);
    6565            var nextPromise = constructor.resolve(value);
    6666            var resolveElement = newResolveElement(index);
     
    7272        --remainingElementsCount;
    7373        if (remainingElementsCount === 0)
    74             promiseCapability.@resolve.@call(undefined, values);
     74            promiseCapability.@resolve.@call(@undefined, values);
    7575    } catch (error) {
    76         promiseCapability.@reject.@call(undefined, error);
     76        promiseCapability.@reject.@call(@undefined, error);
    7777    }
    7878
     
    9999        }
    100100    } catch (error) {
    101         promiseCapability.@reject.@call(undefined, error);
     101        promiseCapability.@reject.@call(@undefined, error);
    102102    }
    103103
     
    114114    var promiseCapability = @newPromiseCapability(this);
    115115
    116     promiseCapability.@reject.@call(undefined, reason);
     116    promiseCapability.@reject.@call(@undefined, reason);
    117117
    118118    return promiseCapability.@promise;
     
    134134    var promiseCapability = @newPromiseCapability(this);
    135135
    136     promiseCapability.@resolve.@call(undefined, value);
     136    promiseCapability.@resolve.@call(@undefined, value);
    137137
    138138    return promiseCapability.@promise;
  • trunk/Source/JavaScriptCore/builtins/PromiseOperations.js

    r192751 r196022  
    5252
    5353    var promiseCapability = {
    54         @promise: undefined,
    55         @resolve: undefined,
    56         @reject: undefined
     54        @promise: @undefined,
     55        @resolve: @undefined,
     56        @reject: @undefined
    5757    };
    5858
    5959    function executor(resolve, reject)
    6060    {
    61         if (promiseCapability.@resolve !== undefined)
     61        if (promiseCapability.@resolve !== @undefined)
    6262            throw new @TypeError("resolve function is already set");
    63         if (promiseCapability.@reject !== undefined)
     63        if (promiseCapability.@reject !== @undefined)
    6464            throw new @TypeError("reject function is already set");
    6565
     
    9595    var reactions = promise.@promiseRejectReactions;
    9696    promise.@promiseResult = reason;
    97     promise.@promiseFulfillReactions = undefined;
    98     promise.@promiseRejectReactions = undefined;
    99     promise.@promiseState = @promiseRejected;
     97    promise.@promiseFulfillReactions = @undefined;
     98    promise.@promiseRejectReactions = @undefined;
     99    promise.@promiseState = @promiseStateRejected;
    100100
    101101    @InspectorInstrumentation.promiseRejected(promise, reason, reactions);
     
    110110    var reactions = promise.@promiseFulfillReactions;
    111111    promise.@promiseResult = value;
    112     promise.@promiseFulfillReactions = undefined;
    113     promise.@promiseRejectReactions = undefined;
    114     promise.@promiseState = @promiseFulfilled;
     112    promise.@promiseFulfillReactions = @undefined;
     113    promise.@promiseRejectReactions = @undefined;
     114    promise.@promiseState = @promiseStateFulfilled;
    115115
    116116    @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);
     
    127127    var resolve = function (resolution) {
    128128        if (alreadyResolved)
    129             return undefined;
     129            return @undefined;
    130130        alreadyResolved = true;
    131131
     
    148148        @enqueueJob(@promiseResolveThenableJob, [promise, resolution, then]);
    149149
    150         return undefined;
     150        return @undefined;
    151151    };
    152152
    153153    var reject = function (reason) {
    154154        if (alreadyResolved)
    155             return undefined;
     155            return @undefined;
    156156        alreadyResolved = true;
    157157
     
    173173    var result;
    174174    try {
    175         result = reaction.@handler.@call(undefined, argument);
     175        result = reaction.@handler.@call(@undefined, argument);
    176176    } catch (error) {
    177         return promiseCapability.@reject.@call(undefined, error);
    178     }
    179 
    180     return promiseCapability.@resolve.@call(undefined, result);
     177        return promiseCapability.@reject.@call(@undefined, error);
     178    }
     179
     180    return promiseCapability.@resolve.@call(@undefined, result);
    181181}
    182182
     
    190190        return then.@call(thenable, resolvingFunctions.@resolve, resolvingFunctions.@reject);
    191191    } catch (error) {
    192         return resolvingFunctions.@reject.@call(undefined, error);
     192        return resolvingFunctions.@reject.@call(@undefined, error);
    193193    }
    194194}
     
    201201        throw new @TypeError("Promise constructor takes a function argument");
    202202
    203     this.@promiseState = @promisePending;
     203    this.@promiseState = @promiseStatePending;
    204204    this.@promiseFulfillReactions = [];
    205205    this.@promiseRejectReactions = [];
     
    209209        executor(resolvingFunctions.@resolve, resolvingFunctions.@reject);
    210210    } catch (error) {
    211         return resolvingFunctions.@reject.@call(undefined, error);
     211        return resolvingFunctions.@reject.@call(@undefined, error);
    212212    }
    213213
  • trunk/Source/JavaScriptCore/builtins/PromisePrototype.js

    r192751 r196022  
    2828    "use strict";
    2929
    30     return this.then(undefined, onRejected);
     30    return this.then(@undefined, onRejected);
    3131}
    3232
     
    5555    var state = this.@promiseState;
    5656
    57     if (state === @promisePending) {
     57    if (state === @promiseStatePending) {
    5858        @putByValDirect(this.@promiseFulfillReactions, this.@promiseFulfillReactions.length, fulfillReaction)
    5959        @putByValDirect(this.@promiseRejectReactions, this.@promiseRejectReactions.length, rejectReaction)
    60     } else if (state === @promiseFulfilled)
     60    } else if (state === @promiseStateFulfilled)
    6161        @enqueueJob(@promiseReactionJob, [fulfillReaction, this.@promiseResult]);
    62     else if (state === @promiseRejected)
     62    else if (state === @promiseStateRejected)
    6363        @enqueueJob(@promiseReactionJob, [rejectReaction, this.@promiseResult]);
    6464
  • trunk/Source/JavaScriptCore/builtins/SetPrototype.js

    r194838 r196022  
    3434        throw new @TypeError("Set.prototype.forEach callback must be a function");
    3535
    36     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     36    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    3737    var iterator = @SetIterator(this);
    3838
    3939    // To avoid object allocations for iterator result objects, we pass the placeholder to the special "next" function in order to fill the results.
    40     var value = [ undefined ];
     40    var value = [ @undefined ];
    4141    for (;;) {
    4242        if (@setIteratorNext.@call(iterator, value))
  • trunk/Source/JavaScriptCore/builtins/StringConstructor.js

    r188542 r196022  
    2828    "use strict";
    2929
    30     if (template === null || template === undefined)
     30    if (template === null || template === @undefined)
    3131        throw new @TypeError("String.raw requires template not be null or undefined");
    3232    var cookedSegments = @Object(template);
    3333
    3434    var rawValue = cookedSegments.raw;
    35     if (rawValue === null || rawValue === undefined)
     35    if (rawValue === null || rawValue === @undefined)
    3636        throw new @TypeError("String.raw requires template.raw not be null or undefined");
    3737    var rawSegments = @Object(rawValue);
  • trunk/Source/JavaScriptCore/builtins/StringIteratorPrototype.js

    r192751 r196022  
    3232
    3333    var position = this.@stringIteratorNextIndex;
    34     if (position === undefined)
     34    if (position === @undefined)
    3535        throw new @TypeError("%StringIteratorPrototype%.next requires that |this| be a String Iterator instance");
    3636
    3737    var done = true;
    38     var value = undefined;
     38    var value = @undefined;
    3939
    4040    var string = this.@iteratedString;
    41     if (string !== undefined) {
     41    if (string !== @undefined) {
    4242        var length = string.length >>> 0;
    4343        if (position >= length) {
    44             this.@iteratedString = undefined;
     44            this.@iteratedString = @undefined;
    4545        } else {
    4646            done = false;
  • trunk/Source/JavaScriptCore/builtins/StringPrototype.js

    r194394 r196022  
    3737        throw new @TypeError("String.prototype.localeCompare requires that |this| not be null");
    3838   
    39     if (this === undefined)
     39    if (this === @undefined)
    4040        throw new @TypeError("String.prototype.localeCompare requires that |this| not be undefined");
    4141
     
    4949
    5050    // Avoid creating a collator for defaults.
    51     if (arguments[1] === undefined && arguments[2] === undefined)
     51    if (arguments[1] === @undefined && arguments[2] === @undefined)
    5252        return @Collator.prototype.compare(thisString, thatString);
    5353
  • trunk/Source/JavaScriptCore/builtins/TypedArrayConstructor.js

    r191059 r196022  
    3434    let len = arguments.length;
    3535    let constructFunction = this.@allocateTypedArray;
    36     if (constructFunction === undefined)
     36    if (constructFunction === @undefined)
    3737        throw new @TypeError("TypedArray.from requires its this argument to subclass a TypedArray constructor");
    3838
     
    5353    let thisArg;
    5454
    55     if (mapFn !== undefined) {
     55    if (mapFn !== @undefined) {
    5656        if (typeof mapFn !== "function")
    5757            throw new @TypeError("TypedArray.from requires that the second argument, when provided, be a function");
     
    8686        for (let value of wrapper) {
    8787            if (mapFn)
    88                 @putByValDirect(accumulator, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));
     88                @putByValDirect(accumulator, k, thisArg === @undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));
    8989            else
    9090                @putByValDirect(accumulator, k, value);
     
    9393
    9494        let constructFunction = this.@allocateTypedArray;
    95         if (constructFunction === undefined)
     95        if (constructFunction === @undefined)
    9696            throw new @TypeError("TypedArray.from requires its this argument subclass a TypedArray constructor");
    9797
     
    109109
    110110    let constructFunction = this.@allocateTypedArray;
    111     if (constructFunction === undefined)
     111    if (constructFunction === @undefined)
    112112        throw new @TypeError("this does not subclass a TypedArray constructor");
    113113
     
    118118        let value = arrayLike[k];
    119119        if (mapFn)
    120             result[k] = thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k);
     120            result[k] = thisArg === @undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k);
    121121        else
    122122            result[k] = value;
  • trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js

    r193899 r196022  
    3131    "use strict";
    3232    var length = @typedArrayLength(this);
    33     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     33    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    3434
    3535    if (typeof callback !== "function")
     
    4848    "use strict";
    4949    var length = @typedArrayLength(this);
    50     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     50    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    5151
    5252    if (typeof callback !== "function")
     
    5858            return elem;
    5959    }
    60     return undefined;
     60    return @undefined;
    6161}
    6262
     
    6565    "use strict";
    6666    var length = @typedArrayLength(this);
    67     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     67    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    6868
    6969    if (typeof callback !== "function")
     
    8181    "use strict";
    8282    var length = @typedArrayLength(this);
    83     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     83    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    8484
    8585    if (typeof callback !== "function")
     
    9595    "use strict";
    9696    var length = @typedArrayLength(this);
    97     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     97    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    9898
    9999    if (typeof callback !== "function")
     
    193193
    194194    for (; k < length; k++)
    195         accumulator = callback.@call(undefined, accumulator, this[k], k, this);
     195        accumulator = callback.@call(@undefined, accumulator, this[k], k, this);
    196196
    197197    return accumulator;
     
    218218
    219219    for (; k >= 0; k--)
    220         accumulator = callback.@call(undefined, accumulator, this[k], k, this);
     220        accumulator = callback.@call(@undefined, accumulator, this[k], k, this);
    221221
    222222    return accumulator;
     
    233233        throw new @TypeError("TypedArray.prototype.map callback must be a function");
    234234
    235     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     235    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    236236    // FIXME: This should be a species constructor.
    237237    var result = new this.constructor(length);
     
    252252        throw new @TypeError("TypedArray.prototype.filter callback must be a function");
    253253
    254     var thisArg = arguments.length > 1 ? arguments[1] : undefined;
     254    var thisArg = arguments.length > 1 ? arguments[1] : @undefined;
    255255
    256256    var kept = [];
  • trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp

    r182997 r196022  
    2626#include "config.h"
    2727#include "BytecodeIntrinsicRegistry.h"
    28 
    29 #include "CommonIdentifiers.h"
     28#include "BytecodeGenerator.h"
     29#include "JSArrayIterator.h"
     30#include "JSCJSValueInlines.h"
     31#include "JSPromise.h"
    3032#include "Nodes.h"
     33#include "StrongInlines.h"
    3134
    3235namespace JSC {
    3336
    34 #define INITIALISE_BYTECODE_INTRINSIC_NAMES_TO_SET(name) m_bytecodeIntrinsicMap.add(propertyNames.name##PrivateName.impl(), &BytecodeIntrinsicNode::emit_intrinsic_##name);
     37#define INITIALIZE_BYTECODE_INTRINSIC_NAMES_TO_SET(name) m_bytecodeIntrinsicMap.add(vm.propertyNames->name##PrivateName.impl(), &BytecodeIntrinsicNode::emit_intrinsic_##name);
    3538
    36 BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry(const CommonIdentifiers& propertyNames)
    37     : m_propertyNames(propertyNames)
     39BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry(VM& vm)
     40    : m_vm(vm)
    3841    , m_bytecodeIntrinsicMap()
    3942{
    40     JSC_COMMON_BYTECODE_INTRINSICS_EACH_NAME(INITIALISE_BYTECODE_INTRINSIC_NAMES_TO_SET)
     43    JSC_COMMON_BYTECODE_INTRINSIC_FUNCTIONS_EACH_NAME(INITIALIZE_BYTECODE_INTRINSIC_NAMES_TO_SET)
     44    JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(INITIALIZE_BYTECODE_INTRINSIC_NAMES_TO_SET)
     45
     46    m_undefined.set(m_vm, jsUndefined());
     47    m_arrayIterationKindKey.set(m_vm, jsNumber(ArrayIterateKey));
     48    m_arrayIterationKindValue.set(m_vm, jsNumber(ArrayIterateValue));
     49    m_arrayIterationKindKeyValue.set(m_vm, jsNumber(ArrayIterateKeyValue));
     50    m_promiseStatePending.set(m_vm, jsNumber(static_cast<unsigned>(JSPromise::Status::Pending)));
     51    m_promiseStateFulfilled.set(m_vm, jsNumber(static_cast<unsigned>(JSPromise::Status::Fulfilled)));
     52    m_promiseStateRejected.set(m_vm, jsNumber(static_cast<unsigned>(JSPromise::Status::Rejected)));
     53    m_symbolIterator.set(m_vm, Symbol::create(m_vm, static_cast<SymbolImpl&>(*m_vm.propertyNames->iteratorSymbol.impl())));
    4154}
    4255
    4356BytecodeIntrinsicNode::EmitterType BytecodeIntrinsicRegistry::lookup(const Identifier& ident) const
    4457{
    45     if (!m_propertyNames.isPrivateName(ident))
     58    if (!m_vm.propertyNames->isPrivateName(ident))
    4659        return nullptr;
    4760    auto iterator = m_bytecodeIntrinsicMap.find(ident.impl());
     
    5164}
    5265
     66#define JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS(name) \
     67    JSValue BytecodeIntrinsicRegistry::name##Value(BytecodeGenerator&) \
     68    { \
     69        return m_##name.get(); \
     70    }
     71    JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS)
     72#undef JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS
     73
    5374} // namespace JSC
    5475
  • trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h

    r184828 r196022  
    3737class BytecodeIntrinsicNode;
    3838class RegisterID;
     39class Identifier;
     40
     41#define JSC_COMMON_BYTECODE_INTRINSIC_FUNCTIONS_EACH_NAME(macro) \
     42    macro(assert) \
     43    macro(putByValDirect) \
     44    macro(toString)
     45
     46#define JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(macro) \
     47    macro(undefined) \
     48    macro(arrayIterationKindKey) \
     49    macro(arrayIterationKindValue) \
     50    macro(arrayIterationKindKeyValue) \
     51    macro(promiseStatePending) \
     52    macro(promiseStateFulfilled) \
     53    macro(promiseStateRejected) \
     54    macro(symbolIterator)
    3955
    4056class BytecodeIntrinsicRegistry {
    4157    WTF_MAKE_NONCOPYABLE(BytecodeIntrinsicRegistry);
    4258public:
    43     explicit BytecodeIntrinsicRegistry(const CommonIdentifiers&);
     59    explicit BytecodeIntrinsicRegistry(VM&);
    4460
    4561    typedef RegisterID* (BytecodeIntrinsicNode::* EmitterType)(BytecodeGenerator&, RegisterID*);
     
    4763    EmitterType lookup(const Identifier&) const;
    4864
     65#define JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS(name) JSValue name##Value(BytecodeGenerator&);
     66    JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS)
     67#undef JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS
     68
    4969private:
    50     const CommonIdentifiers& m_propertyNames;
     70    VM& m_vm;
    5171    HashMap<RefPtr<UniquedStringImpl>, EmitterType, IdentifierRepHash> m_bytecodeIntrinsicMap;
     72
     73#define JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS(name) Strong<Unknown> m_##name;
     74    JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS)
     75#undef JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS
    5276};
    5377
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r195439 r196022  
    850850    return generator.moveToDestinationIfNeeded(dst, generator.emitToString(generator.tempDestination(dst), src.get()));
    851851}
     852
     853
     854#define JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS(name) \
     855    RegisterID* BytecodeIntrinsicNode::emit_intrinsic_##name(BytecodeGenerator& generator, RegisterID* dst) \
     856    { \
     857        ASSERT(!m_args); \
     858        ASSERT(type() == Type::Constant); \
     859        if (dst == generator.ignoredResult()) \
     860            return nullptr; \
     861        return generator.emitLoad(dst, generator.vm()->bytecodeIntrinsicRegistry().name##Value(generator)); \
     862    }
     863    JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS)
     864#undef JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS
    852865
    853866// ------------------------------ FunctionCallBracketNode ----------------------------------
  • trunk/Source/JavaScriptCore/parser/ASTBuilder.h

    r195439 r196022  
    183183        return new (m_parserArena) NewTargetNode(location);
    184184    }
    185     ExpressionNode* createResolve(const JSTokenLocation& location, const Identifier* ident, const JSTextPosition& start)
    186     {
    187         if (m_vm->propertyNames->arguments == *ident)
     185    ExpressionNode* createResolve(const JSTokenLocation& location, const Identifier& ident, const JSTextPosition& start, const JSTextPosition& end)
     186    {
     187        if (m_vm->propertyNames->arguments == ident)
    188188            usesArguments();
    189         return new (m_parserArena) ResolveNode(location, *ident, start);
     189
     190        if (ident.isSymbol()) {
     191            if (BytecodeIntrinsicNode::EmitterType emitter = m_vm->bytecodeIntrinsicRegistry().lookup(ident))
     192                return new (m_parserArena) BytecodeIntrinsicNode(BytecodeIntrinsicNode::Type::Constant, location, emitter, ident, nullptr, start, start, end);
     193        }
     194
     195        return new (m_parserArena) ResolveNode(location, ident, start);
    190196    }
    191197    ExpressionNode* createObjectLiteral(const JSTokenLocation& location) { return new (m_parserArena) ObjectLiteralNode(location); }
     
    11371143{
    11381144    ASSERT(divot.offset >= divot.lineStartOffset);
     1145    if (func->isBytecodeIntrinsicNode()) {
     1146        BytecodeIntrinsicNode* intrinsic = static_cast<BytecodeIntrinsicNode*>(func);
     1147        if (intrinsic->type() == BytecodeIntrinsicNode::Type::Constant)
     1148            return new (m_parserArena) BytecodeIntrinsicNode(BytecodeIntrinsicNode::Type::Function, location, intrinsic->emitter(), intrinsic->identifier(), args, divot, divotStart, divotEnd);
     1149    }
    11391150    if (!func->isLocation())
    11401151        return new (m_parserArena) FunctionCallValueNode(location, func, args, divot, divotStart, divotEnd);
     
    11461157            return new (m_parserArena) EvalFunctionCallNode(location, args, divot, divotStart, divotEnd);
    11471158        }
    1148         if (BytecodeIntrinsicNode::EmitterType emitter = m_vm->propertyNames->bytecodeIntrinsicRegistry().lookup(identifier))
    1149             return new (m_parserArena) BytecodeIntrinsicNode(location, emitter, identifier, args, divot, divotStart, divotEnd);
    11501159        return new (m_parserArena) FunctionCallResolveNode(location, identifier, args, divot, divotStart, divotEnd);
    11511160    }
  • trunk/Source/JavaScriptCore/parser/NodeConstructors.h

    r195439 r196022  
    371371    }
    372372
    373     inline BytecodeIntrinsicNode::BytecodeIntrinsicNode(const JSTokenLocation& location, EmitterType emitter, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
     373    inline BytecodeIntrinsicNode::BytecodeIntrinsicNode(Type type, const JSTokenLocation& location, EmitterType emitter, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
    374374        : ExpressionNode(location)
    375375        , ThrowableExpressionData(divot, divotStart, divotEnd)
     376        , m_type(type)
    376377        , m_emitter(emitter)
    377378        , m_ident(ident)
  • trunk/Source/JavaScriptCore/parser/Nodes.h

    r195439 r196022  
    174174        virtual bool isSpreadExpression() const { return false; }
    175175        virtual bool isSuperNode() const { return false; }
     176        virtual bool isBytecodeIntrinsicNode() const { return false; }
    176177
    177178        virtual void emitBytecodeInConditionContext(BytecodeGenerator&, Label*, Label*, FallThroughMode);
     
    802803    class BytecodeIntrinsicNode : public ExpressionNode, public ThrowableExpressionData {
    803804    public:
     805        enum class Type {
     806            Constant,
     807            Function
     808        };
     809
    804810        typedef RegisterID* (BytecodeIntrinsicNode::* EmitterType)(BytecodeGenerator&, RegisterID*);
    805811
    806         BytecodeIntrinsicNode(const JSTokenLocation&, EmitterType, const Identifier&, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
    807 
     812        BytecodeIntrinsicNode(Type, const JSTokenLocation&, EmitterType, const Identifier&, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
     813
     814        virtual bool isBytecodeIntrinsicNode() const override { return true; }
     815
     816        Type type() const { return m_type; }
     817        EmitterType emitter() const { return m_emitter; }
    808818        const Identifier& identifier() const { return m_ident; }
    809819
    810820#define JSC_DECLARE_BYTECODE_INTRINSIC_FUNCTIONS(name) RegisterID* emit_intrinsic_##name(BytecodeGenerator&, RegisterID*);
    811         JSC_COMMON_BYTECODE_INTRINSICS_EACH_NAME(JSC_DECLARE_BYTECODE_INTRINSIC_FUNCTIONS)
     821        JSC_COMMON_BYTECODE_INTRINSIC_FUNCTIONS_EACH_NAME(JSC_DECLARE_BYTECODE_INTRINSIC_FUNCTIONS)
     822        JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(JSC_DECLARE_BYTECODE_INTRINSIC_FUNCTIONS)
    812823#undef JSC_DECLARE_BYTECODE_INTRINSIC_FUNCTIONS
    813824
     
    815826        virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
    816827
     828        Type m_type;
    817829        EmitterType m_emitter;
    818830        const Identifier& m_ident;
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r195484 r196022  
    32033203            JSTokenLocation location(tokenLocation());
    32043204            currentScope()->useVariable(ident, m_vm->propertyNames->eval == *ident);
    3205             TreeExpression node = context.createResolve(location, ident, start);
     3205            TreeExpression node = context.createResolve(location, *ident, start, lastTokenEndPosition());
    32063206            return context.createProperty(ident, node, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Shorthand), PropertyNode::KnownDirect, complete);
    32073207        }
     
    36263626        currentScope()->useVariable(ident, m_vm->propertyNames->eval == *ident);
    36273627        m_parserState.lastIdentifier = ident;
    3628         return context.createResolve(location, ident, start);
     3628        return context.createResolve(location, *ident, start, lastTokenEndPosition());
    36293629    }
    36303630    case STRING: {
  • trunk/Source/JavaScriptCore/parser/SyntaxChecker.h

    r195439 r196022  
    161161    ExpressionType createSuperExpr(const JSTokenLocation&) { return SuperExpr; }
    162162    ExpressionType createNewTargetExpr(const JSTokenLocation&) { return NewTargetExpr; }
    163     ExpressionType createResolve(const JSTokenLocation&, const Identifier*, int) { return ResolveExpr; }
     163    ExpressionType createResolve(const JSTokenLocation&, const Identifier&, int, int) { return ResolveExpr; }
    164164    ExpressionType createObjectLiteral(const JSTokenLocation&) { return ObjectLiteralExpr; }
    165165    ExpressionType createObjectLiteral(const JSTokenLocation&, int) { return ObjectLiteralExpr; }
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.cpp

    r190401 r196022  
    4646    JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALIZE_PRIVATE_NAME)
    4747    JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(INITIALIZE_SYMBOL)
    48     , m_bytecodeIntrinsicRegistry(*this)
    4948{
    5049}
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r195460 r196022  
    279279    macro(unscopables)
    280280
    281 #define JSC_COMMON_BYTECODE_INTRINSICS_EACH_NAME(macro) \
    282     macro(assert) \
    283     macro(putByValDirect) \
    284     macro(toString)
    285 
    286281#define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \
    287     JSC_COMMON_BYTECODE_INTRINSICS_EACH_NAME(macro) \
     282    JSC_COMMON_BYTECODE_INTRINSIC_FUNCTIONS_EACH_NAME(macro) \
     283    JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(macro) \
    288284    macro(iteratedObject) \
    289285    macro(arrayIteratorNextIndex) \
    290286    macro(arrayIterationKind) \
    291     macro(arrayIterationKindKey) \
    292     macro(arrayIterationKindValue) \
    293     macro(arrayIterationKindKeyValue) \
    294287    macro(charCodeAt) \
    295288    macro(iteratedString) \
     
    320313    macro(typedArrayLength) \
    321314    macro(typedArraySort) \
    322     macro(undefined) \
    323315    macro(BuiltinLog) \
    324316    macro(homeObject) \
     
    327319    macro(handler) \
    328320    macro(promiseState) \
    329     macro(promisePending) \
    330321    macro(promiseFulfillReactions) \
    331322    macro(promiseRejectReactions) \
     
    419410        Identifier lookUpPublicName(const Identifier&) const;
    420411
    421         const BytecodeIntrinsicRegistry& bytecodeIntrinsicRegistry() const { return m_bytecodeIntrinsicRegistry; }
    422 
    423412        // Callers of this method should make sure that identifiers given to this method
    424413        // survive the lifetime of CommonIdentifiers and related VM.
    425414        JS_EXPORT_PRIVATE void appendExternalName(const Identifier& publicName, const Identifier& privateName);
    426 
    427     private:
    428         BytecodeIntrinsicRegistry m_bytecodeIntrinsicRegistry;
    429415    };
    430416
  • trunk/Source/JavaScriptCore/runtime/IteratorPrototype.cpp

    r185577 r196022  
    4444    vm.prototypeMap.addPrototype(this);
    4545
    46     JSFunction* iteratorPrototypeFunction = JSFunction::createBuiltinFunction(vm, iteratorPrototypeSymbolIteratorCodeGenerator(vm), globalObject, "[Symbol.iterator]");
     46    JSFunction* iteratorPrototypeFunction = JSFunction::createBuiltinFunction(vm, iteratorPrototypeSymbolIteratorGetterCodeGenerator(vm), globalObject, "[Symbol.iterator]");
    4747    putDirectWithoutTransition(vm, vm.propertyNames->iteratorSymbol, iteratorPrototypeFunction, DontEnum);
    4848}
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r196001 r196022  
    531531        GlobalPropertyInfo(vm.propertyNames->Infinity, jsNumber(std::numeric_limits<double>::infinity()), DontEnum | DontDelete | ReadOnly),
    532532        GlobalPropertyInfo(vm.propertyNames->undefinedKeyword, jsUndefined(), DontEnum | DontDelete | ReadOnly),
    533         GlobalPropertyInfo(vm.propertyNames->undefinedPrivateName, jsUndefined(), DontEnum | DontDelete | ReadOnly),
    534533        GlobalPropertyInfo(vm.propertyNames->ObjectPrivateName, objectConstructor, DontEnum | DontDelete | ReadOnly),
    535534        GlobalPropertyInfo(vm.propertyNames->ownEnumerablePropertyKeysPrivateName, JSFunction::create(vm, this, 0, String(), ownEnumerablePropertyKeys), DontEnum | DontDelete | ReadOnly),
     
    551550        GlobalPropertyInfo(vm.propertyNames->isFinitePrivateName, privateFuncIsFinite, DontEnum | DontDelete | ReadOnly),
    552551        GlobalPropertyInfo(vm.propertyNames->isNaNPrivateName, privateFuncIsNaN, DontEnum | DontDelete | ReadOnly),
    553         GlobalPropertyInfo(vm.propertyNames->arrayIterationKindKeyPrivateName, jsNumber(ArrayIterateKey), DontEnum | DontDelete | ReadOnly),
    554         GlobalPropertyInfo(vm.propertyNames->arrayIterationKindValuePrivateName, jsNumber(ArrayIterateValue), DontEnum | DontDelete | ReadOnly),
    555         GlobalPropertyInfo(vm.propertyNames->arrayIterationKindKeyValuePrivateName, jsNumber(ArrayIterateKeyValue), DontEnum | DontDelete | ReadOnly),
    556         GlobalPropertyInfo(vm.propertyNames->builtinNames().symbolIteratorPrivateName(), Symbol::create(vm, static_cast<SymbolImpl&>(*vm.propertyNames->iteratorSymbol.impl())), DontEnum | DontDelete | ReadOnly),
    557552        GlobalPropertyInfo(vm.propertyNames->PromisePrivateName, promiseConstructor, DontEnum | DontDelete | ReadOnly),
    558553        GlobalPropertyInfo(vm.propertyNames->InternalPromisePrivateName, internalPromiseConstructor, DontEnum | DontDelete | ReadOnly),
    559         GlobalPropertyInfo(vm.propertyNames->promisePendingPrivateName, jsNumber(static_cast<unsigned>(JSPromise::Status::Pending)), DontEnum | DontDelete | ReadOnly),
    560554
    561555        GlobalPropertyInfo(vm.propertyNames->isSetPrivateName, JSFunction::create(vm, this, 1, String(), privateFuncIsSet), DontEnum | DontDelete | ReadOnly),
     
    566560        GlobalPropertyInfo(vm.propertyNames->mapIteratorNextPrivateName, JSFunction::create(vm, this, 0, String(), privateFuncMapIteratorNext), DontEnum | DontDelete | ReadOnly),
    567561
    568         GlobalPropertyInfo(vm.propertyNames->builtinNames().promiseFulfilledPrivateName(), jsNumber(static_cast<unsigned>(JSPromise::Status::Fulfilled)), DontEnum | DontDelete | ReadOnly),
    569         GlobalPropertyInfo(vm.propertyNames->builtinNames().promiseRejectedPrivateName(), jsNumber(static_cast<unsigned>(JSPromise::Status::Rejected)), DontEnum | DontDelete | ReadOnly),
    570562        GlobalPropertyInfo(vm.propertyNames->builtinNames().toLengthPrivateName(), privateFuncToLength, DontEnum | DontDelete | ReadOnly),
    571563        GlobalPropertyInfo(vm.propertyNames->builtinNames().toIntegerPrivateName(), privateFuncToInteger, DontEnum | DontDelete | ReadOnly),
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r196001 r196022  
    3333#include "ArrayBufferNeuteringWatchpoint.h"
    3434#include "BuiltinExecutables.h"
     35#include "BytecodeIntrinsicRegistry.h"
    3536#include "CodeBlock.h"
    3637#include "CodeCache.h"
     
    308309    m_typedArrayController = adoptRef(new SimpleTypedArrayController());
    309310
     311    m_bytecodeIntrinsicRegistry = std::make_unique<BytecodeIntrinsicRegistry>(*this);
     312
    310313    if (Options::useTypeProfiler())
    311314        enableTypeProfiler();
  • trunk/Source/JavaScriptCore/runtime/VM.h

    r196001 r196022  
    7878
    7979class BuiltinExecutables;
     80class BytecodeIntrinsicRegistry;
    8081class CodeBlock;
    8182class CodeCache;
     
    604605    bool shouldBuilderPCToCodeOriginMapping() const { return m_shouldBuildPCToCodeOriginMapping; }
    605606
     607    BytecodeIntrinsicRegistry& bytecodeIntrinsicRegistry() { return *m_bytecodeIntrinsicRegistry; }
     608
    606609private:
    607610    friend class LLIntOffsetsExtractor;
     
    672675    RefPtr<SamplingProfiler> m_samplingProfiler;
    673676#endif
     677    std::unique_ptr<BytecodeIntrinsicRegistry> m_bytecodeIntrinsicRegistry;
    674678};
    675679
  • trunk/Source/WebCore/ChangeLog

    r196021 r196022  
     12016-02-02  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [JSC] Introduce BytecodeIntrinsic constant rep like @undefined
     4        https://bugs.webkit.org/show_bug.cgi?id=153737
     5
     6        Reviewed by Darin Adler.
     7
     8        * Modules/fetch/FetchHeaders.js:
     9        (initializeFetchHeaders):
     10        * Modules/streams/ReadableStream.js:
     11        (initializeReadableStream):
     12        (closeDestination):
     13        (abortDestination):
     14        (pipeTo):
     15        * Modules/streams/ReadableStreamInternals.js:
     16        (privateInitializeReadableStreamController):
     17        (teeReadableStream):
     18        (isReadableStreamReader):
     19        (errorReadableStream):
     20        (finishClosingReadableStream):
     21        (enqueueInReadableStream):
     22        (readFromReadableStreamReader):
     23        * Modules/streams/ReadableStreamReader.js:
     24        (releaseLock):
     25        * Modules/streams/StreamInternals.js:
     26        (shieldingPromiseResolve):
     27        (promiseInvokeOrNoopNoCatch):
     28        (promiseInvokeOrFallbackOrNoop):
     29        (validateAndNormalizeQueuingStrategy):
     30        * Modules/streams/WritableStream.js:
     31        (initializeWritableStream):
     32        (write):
     33        * Modules/streams/WritableStreamInternals.js:
     34        (errorWritableStream):
     35
    1362016-02-02  Brady Eidson  <beidson@apple.com>
    237
  • trunk/Source/WebCore/Modules/fetch/FetchHeaders.js

    r195954 r196022  
    3030    "use strict";
    3131
    32     if (headersInit === undefined)
     32    if (headersInit === @undefined)
    3333        return this;
    3434
  • trunk/Source/WebCore/Modules/streams/ReadableStream.js

    r194035 r196022  
    3131    "use strict";
    3232
    33      if (typeof underlyingSource === "undefined")
     33     if (underlyingSource === @undefined)
    3434         underlyingSource = { };
    35      if (typeof strategy === "undefined")
     35     if (strategy === @undefined)
    3636         strategy = { highWaterMark: 1, size: function() { return 1; } };
    3737
     
    3939        throw new @TypeError("ReadableStream constructor takes an object as first argument");
    4040
    41     if (strategy !== undefined && !@isObject(strategy))
     41    if (strategy !== @undefined && !@isObject(strategy))
    4242        throw new @TypeError("ReadableStream constructor takes an object as second argument, if any");
    4343
     
    5050    this.@pullAgain = false;
    5151    this.@pulling = false;
    52     this.@reader = undefined;
    53     this.@storedError = undefined;
     52    this.@reader = @undefined;
     53    this.@storedError = @undefined;
    5454    this.@disturbed = false;
    5555    this.@controller = new @ReadableStreamController(this);
     
    138138            reader.cancel(reason);
    139139            reader.releaseLock();
    140             promiseCapability.@reject.@call(undefined, reason);
     140            promiseCapability.@reject.@call(@undefined, reason);
    141141        } else {
    142142            @Promise.prototype.@then.@call(lastRead, function() {
    143143                reader.releaseLock();
    144                 promiseCapability.@reject.@call(undefined, reason);
     144                promiseCapability.@reject.@call(@undefined, reason);
    145145            });
    146146        }
     
    154154            closedPurposefully = true;
    155155            @Promise.prototype.@then.@call(destination.close(), promiseCapability.@resolve, promiseCapability.@reject);
    156         } else if (lastWrite !== undefined)
     156        } else if (lastWrite !== @undefined)
    157157            @Promise.prototype.@then.@call(lastWrite, promiseCapability.@resolve, promiseCapability.@reject);
    158158        else
     
    166166        if (!preventAbort)
    167167            destination.abort(reason);
    168         promiseCapability.@reject.@call(undefined, reason);
     168        promiseCapability.@reject.@call(@undefined, reason);
    169169    }
    170170
     
    173173    reader = source.getReader();
    174174
    175     @Promise.prototype.@then.@call(reader.closed, undefined, abortDestination);
     175    @Promise.prototype.@then.@call(reader.closed, @undefined, abortDestination);
    176176    @Promise.prototype.@then.@call(destination.closed,
    177177        function() {
  • trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js

    r194391 r196022  
    6060    if (!@isReadableStream(stream))
    6161        throw new @TypeError("ReadableStreamController needs a ReadableStream");
    62     if (typeof stream.@controller !== "undefined")
     62    if (stream.@controller !== @undefined)
    6363        throw new @TypeError("ReadableStream already has a controller");
    6464    this.@controlledReadableStream = stream;
     
    8080        canceled1: false,
    8181        canceled2: false,
    82         reason1: undefined,
    83         reason: undefined,
     82        reason1: @undefined,
     83        reason: @undefined,
    8484    };
    8585
     
    9797    });
    9898
    99     reader.@closedPromiseCapability.@promise.@then(undefined, function(e) {
     99    reader.@closedPromiseCapability.@promise.@then(@undefined, function(e) {
    100100        if (teeState.closedOrErrored)
    101101            return;
     
    184184    // To reset @ownerReadableStream it must be set to null instead of undefined because there is no way to distinguish
    185185    // between a non-existent slot and an slot set to undefined.
    186     return @isObject(reader) && typeof reader.@ownerReadableStream !== "undefined";
     186    return @isObject(reader) && reader.@ownerReadableStream !== @undefined;
    187187}
    188188
     
    209209    const requests = reader.@readRequests;
    210210    for (let index = 0, length = requests.length; index < length; ++index)
    211         requests[index].@reject.@call(undefined, error);
     211        requests[index].@reject.@call(@undefined, error);
    212212    reader.@readRequests = [];
    213213
    214     reader.@closedPromiseCapability.@reject.@call(undefined, error);
     214    reader.@closedPromiseCapability.@reject.@call(@undefined, error);
    215215}
    216216
     
    288288    const requests = reader.@readRequests;
    289289    for (let index = 0, length = requests.length; index < length; ++index)
    290         requests[index].@resolve.@call(undefined, {value:undefined, done: true});
     290        requests[index].@resolve.@call(@undefined, {value:@undefined, done: true});
    291291    reader.@readRequests = [];
    292292    reader.@closedPromiseCapability.@resolve.@call();
     
    315315        return;
    316316    if (@isReadableStreamLocked(stream) && stream.@reader.@readRequests.length) {
    317         stream.@reader.@readRequests.@shift().@resolve.@call(undefined, {value: chunk, done: false});
     317        stream.@reader.@readRequests.@shift().@resolve.@call(@undefined, {value: chunk, done: false});
    318318        @requestReadableStreamPull(stream);
    319319        return;
     
    344344    stream.@disturbed = true;
    345345    if (stream.@state === @streamClosed)
    346         return @Promise.@resolve({value: undefined, done: true});
     346        return @Promise.@resolve({value: @undefined, done: true});
    347347    if (stream.@state === @streamErrored)
    348348        return @Promise.@reject(stream.@storedError);
  • trunk/Source/WebCore/Modules/streams/ReadableStreamReader.js

    r192466 r196022  
    6666
    6767    if (stream.@state === @streamReadable)
    68         this.@closedPromiseCapability.@reject.@call(undefined, new @TypeError("releasing lock of reader whose stream is still in readable state"));
     68        this.@closedPromiseCapability.@reject.@call(@undefined, new @TypeError("releasing lock of reader whose stream is still in readable state"));
    6969    else
    7070        this.@closedPromiseCapability = { @promise: @Promise.@reject(new @TypeError("reader released lock")) };
    7171
    72     stream.@reader = undefined;
     72    stream.@reader = @undefined;
    7373    this.@ownerReadableStream = null;
    7474}
  • trunk/Source/WebCore/Modules/streams/StreamInternals.js

    r194035 r196022  
    3131{
    3232    const promise = @Promise.@resolve(result);
    33     if (promise.@then === undefined)
     33    if (promise.@then === @undefined)
    3434        promise.@then = @Promise.prototype.@then;
    3535    return promise;
     
    4141
    4242    const method = object[key];
    43     if (method === undefined)
     43    if (method === @undefined)
    4444        return @Promise.@resolve();
    4545    return @shieldingPromiseResolve(method.@apply(object, args));
     
    6565    try {
    6666        const method = object[key1];
    67         if (method === undefined)
     67        if (method === @undefined)
    6868            return @promiseInvokeOrNoopNoCatch(object, key2, args2);
    6969        return @shieldingPromiseResolve(method.@apply(object, args1));
     
    7878    "use strict";
    7979
    80     if (size !== undefined && typeof size !== "function")
     80    if (size !== @undefined && typeof size !== "function")
    8181        throw new @TypeError("size parameter must be a function");
    8282
  • trunk/Source/WebCore/Modules/streams/WritableStream.js

    r194035 r196022  
    3131    "use strict";
    3232
    33     if (typeof underlyingSink === "undefined")
     33    if (underlyingSink === @undefined)
    3434        underlyingSink = { };
    35     if (typeof strategy === "undefined")
     35    if (strategy === @undefined)
    3636        strategy = { highWaterMark: 0, size: function() { return 1; } };
    3737
     
    6060    this.@startedPromise.@then(() => {
    6161        this.@started = true;
    62         this.@startedPromise = undefined;
     62        this.@startedPromise = @undefined;
    6363    }, errorFunction);
    6464
     
    123123
    124124    let chunkSize = 1;
    125     if (this.@strategy.size !== undefined) {
     125    if (this.@strategy.size !== @undefined) {
    126126        try {
    127             chunkSize = this.@strategy.size.@call(undefined, chunk);
     127            chunkSize = this.@strategy.size.@call(@undefined, chunk);
    128128        } catch(e) {
    129129            @errorWritableStream(this, e);
  • trunk/Source/WebCore/Modules/streams/WritableStreamInternals.js

    r194035 r196022  
    6464        const writeRecord = @dequeueValue(stream.@queue);
    6565        if (writeRecord !== "close")
    66             writeRecord.promiseCapability.@reject.@call(undefined, e);
     66            writeRecord.promiseCapability.@reject.@call(@undefined, e);
    6767    }
    6868    stream.@storedError = e;
    6969    if (stream.@state === @streamWaiting)
    7070        stream.@readyPromiseCapability.@resolve.@call();
    71     stream.@closedPromiseCapability.@reject.@call(undefined, e);
     71    stream.@closedPromiseCapability.@reject.@call(@undefined, e);
    7272    stream.@state = @streamErrored;
    7373}
Note: See TracChangeset for help on using the changeset viewer.