diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Source/JavaScriptCore/Scripts/tests | |
parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/JavaScriptCore/Scripts/tests')
30 files changed, 3586 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Combined.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Combined.js new file mode 100644 index 000000000..b45d81ceb --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Combined.js @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +function rejectPromise(promise, reason) +{ + "use strict"; + + var reactions = promise.@promiseRejectReactions; + promise.@promiseResult = reason; + promise.@promiseFulfillReactions = undefined; + promise.@promiseRejectReactions = undefined; + promise.@promiseState = @promiseRejected; + + @InspectorInstrumentation.promiseRejected(promise, reason, reactions); + + @triggerPromiseReactions(reactions, reason); +} + +function fulfillPromise(promise, value) +{ + "use strict"; + + var reactions = promise.@promiseFulfillReactions; + promise.@promiseResult = value; + promise.@promiseFulfillReactions = undefined; + promise.@promiseRejectReactions = undefined; + promise.@promiseState = @promiseFulfilled; + + @InspectorInstrumentation.promiseFulfilled(promise, value, reactions); + + @triggerPromiseReactions(reactions, value); +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Separate.js new file mode 100644 index 000000000..b45d81ceb --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Separate.js @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +function rejectPromise(promise, reason) +{ + "use strict"; + + var reactions = promise.@promiseRejectReactions; + promise.@promiseResult = reason; + promise.@promiseFulfillReactions = undefined; + promise.@promiseRejectReactions = undefined; + promise.@promiseState = @promiseRejected; + + @InspectorInstrumentation.promiseRejected(promise, reason, reactions); + + @triggerPromiseReactions(reactions, reason); +} + +function fulfillPromise(promise, value) +{ + "use strict"; + + var reactions = promise.@promiseFulfillReactions; + promise.@promiseResult = value; + promise.@promiseFulfillReactions = undefined; + promise.@promiseRejectReactions = undefined; + promise.@promiseState = @promiseFulfilled; + + @InspectorInstrumentation.promiseFulfilled(promise, value, reactions); + + @triggerPromiseReactions(reactions, value); +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js new file mode 100644 index 000000000..5448b9832 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2014, 2015 Apple Inc. All rights reserved. + * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +function every(callback /*, thisArg */) +{ + "use strict"; + + if (this === null) + throw new @TypeError("Array.prototype.every requires that |this| not be null"); + + if (this === undefined) + throw new @TypeError("Array.prototype.every requires that |this| not be undefined"); + + var array = @Object(this); + var length = @toLength(array.length); + + if (typeof callback !== "function") + throw new @TypeError("Array.prototype.every callback must be a function"); + + var thisArg = arguments.length > 1 ? arguments[1] : undefined; + + for (var i = 0; i < length; i++) { + if (!(i in array)) + continue; + if (!callback.@call(thisArg, array[i], i, array)) + return false; + } + + return true; +} + +function forEach(callback /*, thisArg */) +{ + "use strict"; + + if (this === null) + throw new @TypeError("Array.prototype.forEach requires that |this| not be null"); + + if (this === undefined) + throw new @TypeError("Array.prototype.forEach requires that |this| not be undefined"); + + var array = @Object(this); + var length = @toLength(array.length); + + if (typeof callback !== "function") + throw new @TypeError("Array.prototype.forEach callback must be a function"); + + var thisArg = arguments.length > 1 ? arguments[1] : undefined; + + for (var i = 0; i < length; i++) { + if (i in array) + callback.@call(thisArg, array[i], i, array); + } +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js new file mode 100644 index 000000000..5448b9832 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2014, 2015 Apple Inc. All rights reserved. + * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +function every(callback /*, thisArg */) +{ + "use strict"; + + if (this === null) + throw new @TypeError("Array.prototype.every requires that |this| not be null"); + + if (this === undefined) + throw new @TypeError("Array.prototype.every requires that |this| not be undefined"); + + var array = @Object(this); + var length = @toLength(array.length); + + if (typeof callback !== "function") + throw new @TypeError("Array.prototype.every callback must be a function"); + + var thisArg = arguments.length > 1 ? arguments[1] : undefined; + + for (var i = 0; i < length; i++) { + if (!(i in array)) + continue; + if (!callback.@call(thisArg, array[i], i, array)) + return false; + } + + return true; +} + +function forEach(callback /*, thisArg */) +{ + "use strict"; + + if (this === null) + throw new @TypeError("Array.prototype.forEach requires that |this| not be null"); + + if (this === undefined) + throw new @TypeError("Array.prototype.forEach requires that |this| not be undefined"); + + var array = @Object(this); + var length = @toLength(array.length); + + if (typeof callback !== "function") + throw new @TypeError("Array.prototype.forEach callback must be a function"); + + var thisArg = arguments.length > 1 ? arguments[1] : undefined; + + for (var i = 0; i < length; i++) { + if (i in array) + callback.@call(thisArg, array[i], i, array); + } +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Combined.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Combined.js new file mode 100644 index 000000000..9e8c1b449 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Combined.js @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +function of(/* items... */) +{ + "use strict"; + + var length = arguments.length; + // TODO: Need isConstructor(this) instead of typeof "function" check. + var array = typeof this === 'function' ? new this(length) : new @Array(length); + for (var k = 0; k < length; ++k) + @putByValDirect(array, k, arguments[k]); + array.length = length; + return array; +} + +function from(items /*, mapFn, thisArg */) +{ + "use strict"; + + var thisObj = this; + + var mapFn = arguments.length > 1 ? arguments[1] : undefined; + + var thisArg; + + if (mapFn !== undefined) { + if (typeof mapFn !== "function") + throw new @TypeError("Array.from requires that the second argument, when provided, be a function"); + + if (arguments.length > 2) + thisArg = arguments[2]; + } + + if (items == null) + throw new @TypeError("Array.from requires an array-like object - not null or undefined"); + + var iteratorMethod = items[@symbolIterator]; + if (iteratorMethod != null) { + if (typeof iteratorMethod !== "function") + throw new @TypeError("Array.from requires that the property of the first argument, items[Symbol.iterator], when exists, be a function"); + + // TODO: Need isConstructor(thisObj) instead of typeof "function" check. + var result = (typeof thisObj === "function") ? @Object(new thisObj()) : []; + + var k = 0; + var iterator = iteratorMethod.@call(items); + + // Since for-of loop once more looks up the @@iterator property of a given iterable, + // it could be observable if the user defines a getter for @@iterator. + // To avoid this situation, we define a wrapper object that @@iterator just returns a given iterator. + var wrapper = { + [@symbolIterator]() { + return iterator; + } + }; + + for (var value of wrapper) { + if (mapFn) + @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k)); + else + @putByValDirect(result, k, value); + k += 1; + } + + result.length = k; + return result; + } + + var arrayLike = @Object(items); + var arrayLikeLength = @toLength(arrayLike.length); + + // TODO: Need isConstructor(thisObj) instead of typeof "function" check. + var result = (typeof thisObj === "function") ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength); + + var k = 0; + while (k < arrayLikeLength) { + var value = arrayLike[k]; + if (mapFn) + @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k)); + else + @putByValDirect(result, k, value); + k += 1; + } + + result.length = arrayLikeLength; + return result; +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Separate.js new file mode 100644 index 000000000..9e8c1b449 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Separate.js @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +function of(/* items... */) +{ + "use strict"; + + var length = arguments.length; + // TODO: Need isConstructor(this) instead of typeof "function" check. + var array = typeof this === 'function' ? new this(length) : new @Array(length); + for (var k = 0; k < length; ++k) + @putByValDirect(array, k, arguments[k]); + array.length = length; + return array; +} + +function from(items /*, mapFn, thisArg */) +{ + "use strict"; + + var thisObj = this; + + var mapFn = arguments.length > 1 ? arguments[1] : undefined; + + var thisArg; + + if (mapFn !== undefined) { + if (typeof mapFn !== "function") + throw new @TypeError("Array.from requires that the second argument, when provided, be a function"); + + if (arguments.length > 2) + thisArg = arguments[2]; + } + + if (items == null) + throw new @TypeError("Array.from requires an array-like object - not null or undefined"); + + var iteratorMethod = items[@symbolIterator]; + if (iteratorMethod != null) { + if (typeof iteratorMethod !== "function") + throw new @TypeError("Array.from requires that the property of the first argument, items[Symbol.iterator], when exists, be a function"); + + // TODO: Need isConstructor(thisObj) instead of typeof "function" check. + var result = (typeof thisObj === "function") ? @Object(new thisObj()) : []; + + var k = 0; + var iterator = iteratorMethod.@call(items); + + // Since for-of loop once more looks up the @@iterator property of a given iterable, + // it could be observable if the user defines a getter for @@iterator. + // To avoid this situation, we define a wrapper object that @@iterator just returns a given iterator. + var wrapper = { + [@symbolIterator]() { + return iterator; + } + }; + + for (var value of wrapper) { + if (mapFn) + @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k)); + else + @putByValDirect(result, k, value); + k += 1; + } + + result.length = k; + return result; + } + + var arrayLike = @Object(items); + var arrayLikeLength = @toLength(arrayLike.length); + + // TODO: Need isConstructor(thisObj) instead of typeof "function" check. + var result = (typeof thisObj === "function") ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength); + + var k = 0; + while (k < arrayLikeLength) { + var value = arrayLike[k]; + if (mapFn) + @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k)); + else + @putByValDirect(result, k, value); + k += 1; + } + + result.length = arrayLikeLength; + return result; +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-InternalClashingNames-Combined.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-InternalClashingNames-Combined.js new file mode 100644 index 000000000..0a436cf10 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-InternalClashingNames-Combined.js @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY CANON INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CANON INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// @internal + +function isReadableStreamLocked(stream) +{ + "use strict"; + + return !!stream.@reader; +} + +// Testing clashing names (emulating function with same names in different files) +function isReadableStreamLocked(stream) +{ + "use strict"; + + return !!stream.@reader; +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-ArbitraryConditionalGuard-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-ArbitraryConditionalGuard-Separate.js new file mode 100644 index 000000000..c808b3c7f --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-ArbitraryConditionalGuard-Separate.js @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// @conditional=ENABLE(STREAMS_API) || USE(CF) + +function isReadableStreamLocked(stream) +{ + "use strict"; + + return !!stream.@reader; +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateFlagAnnotation-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateFlagAnnotation-Separate.js new file mode 100644 index 000000000..73e7c71b9 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateFlagAnnotation-Separate.js @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// @internal +// @internal diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateKeyValueAnnotation-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateKeyValueAnnotation-Separate.js new file mode 100644 index 000000000..6d6fe604c --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateKeyValueAnnotation-Separate.js @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// @conditional=ENABLE(STREAMS_API) +// @conditional=USE(CF) + +function isReadableStreamLocked(stream) +{ + "use strict"; + + return !!stream.@reader; +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js new file mode 100644 index 000000000..2acec589d --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// @conditional=ENABLE(STREAMS_API) + +function isReadableStreamLocked(stream) +{ + "use strict"; + + return !!stream.@reader; +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js new file mode 100644 index 000000000..80d53cd1a --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// @conditional=ENABLE(STREAMS_API) +// @internal + +function isReadableStreamLocked(stream) +{ + "use strict"; + + return !!stream.@reader; +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js new file mode 100644 index 000000000..9647f2bdd --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +function isReadableStreamLocked(stream) +{ + "use strict"; + + return !!stream.@reader; +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-xmlCasingTest-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-xmlCasingTest-Separate.js new file mode 100644 index 000000000..550c89e02 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-xmlCasingTest-Separate.js @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// @conditional=ENABLE(STREAMS_API) +// @internal + +function xmlCasingTest(stream) +{ + "use strict"; + + return !!stream.@reader; +} + + +function cssCasingTest(stream, reason) +{ + "use strict"; + + if (stream.@state === @readableStreamClosed) + return Promise.resolve(); + if (stream.@state === @readableStreamErrored) + return Promise.reject(stream.@storedError); + stream.@queue = []; + @finishClosingReadableStream(stream); + return @promiseInvokeOrNoop(stream.@underlyingSource, "cancel", [reason]).then(function() { }); +} + + +function urlCasingTest(object, key, args) +{ + "use strict"; + + try { + var method = object[key]; + if (typeof method === "undefined") + return Promise.resolve(); + var result = method.@apply(object, args); + return Promise.resolve(result); + } + catch(error) { + return Promise.reject(error); + } +} diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result new file mode 100644 index 000000000..dbd3e12ca --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result @@ -0,0 +1,163 @@ +### Begin File: JSCBuiltins.h +/* + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef JSCBuiltins_h +#define JSCBuiltins_h + +namespace JSC { +class FunctionExecutable; +class VM; + +enum class ConstructAbility : unsigned; +} + +namespace JSC { + +/* Builtin.Promise */ +extern const char* s_builtinPromiseRejectPromiseCode; +extern const int s_builtinPromiseRejectPromiseCodeLength; +extern const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility; +extern const char* s_builtinPromiseFulfillPromiseCode; +extern const int s_builtinPromiseFulfillPromiseCodeLength; +extern const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility; + +#define JSC_FOREACH_BUILTINPROMISE_BUILTIN_DATA(macro) \ + macro(rejectPromise, builtinPromiseRejectPromise, 2) \ + macro(fulfillPromise, builtinPromiseFulfillPromise, 2) \ + +#define JSC_FOREACH_BUILTIN_CODE(macro) \ + macro(builtinPromiseRejectPromiseCode, rejectPromise, s_builtinPromiseRejectPromiseCodeLength) \ + macro(builtinPromiseFulfillPromiseCode, fulfillPromise, s_builtinPromiseFulfillPromiseCodeLength) \ + +#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \ + macro(fulfillPromise) \ + macro(rejectPromise) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +} // namespace JSC + +#endif // JSCBuiltins_h + +### End File: JSCBuiltins.h + +### Begin File: JSCBuiltins.cpp +/* + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "JSCBuiltins.h" + +#include "BuiltinExecutables.h" +#include "Executable.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPromiseRejectPromiseCodeLength = 413; +const char* s_builtinPromiseRejectPromiseCode = + "(function (promise, reason)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var reactions = promise.@promiseRejectReactions;\n" \ + " promise.@promiseResult = reason;\n" \ + " promise.@promiseFulfillReactions = undefined;\n" \ + " promise.@promiseRejectReactions = undefined;\n" \ + " promise.@promiseState = @promiseRejected;\n" \ + "\n" \ + " @InspectorInstrumentation.promiseRejected(promise, reason, reactions);\n" \ + "\n" \ + " @triggerPromiseReactions(reactions, reason);\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPromiseFulfillPromiseCodeLength = 412; +const char* s_builtinPromiseFulfillPromiseCode = + "(function (promise, value)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var reactions = promise.@promiseFulfillReactions;\n" \ + " promise.@promiseResult = value;\n" \ + " promise.@promiseFulfillReactions = undefined;\n" \ + " promise.@promiseRejectReactions = undefined;\n" \ + " promise.@promiseState = @promiseFulfilled;\n" \ + "\n" \ + " @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);\n" \ + "\n" \ + " @triggerPromiseReactions(reactions, value);\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); } +JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace JSC +### End File: JSCBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result new file mode 100644 index 000000000..1b1d5e1fb --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result @@ -0,0 +1,165 @@ +### Begin File: BuiltinPromiseBuiltins.h +/* + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef BuiltinPromiseBuiltins_h +#define BuiltinPromiseBuiltins_h + + + +namespace JSC { +class FunctionExecutable; +} + +namespace JSC { + +/* Builtin.Promise */ +extern const char* s_builtinPromiseRejectPromiseCode; +extern const int s_builtinPromiseRejectPromiseCodeLength; +extern const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility; +extern const char* s_builtinPromiseFulfillPromiseCode; +extern const int s_builtinPromiseFulfillPromiseCodeLength; +extern const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility; + +#define JSC_FOREACH_BUILTIN_PROMISE_BUILTIN_DATA(macro) \ + macro(rejectPromise, builtinPromiseRejectPromise, 2) \ + macro(fulfillPromise, builtinPromiseFulfillPromise, 2) \ + +#define JSC_BUILTIN_BUILTIN_PROMISE_REJECTPROMISE 1 +#define JSC_BUILTIN_BUILTIN_PROMISE_FULFILLPROMISE 1 + +#define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(macro) \ + macro(builtinPromiseRejectPromiseCode, rejectPromise, s_builtinPromiseRejectPromiseCodeLength) \ + macro(builtinPromiseFulfillPromiseCode, fulfillPromise, s_builtinPromiseFulfillPromiseCodeLength) \ + +#define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_FUNCTION_NAME(macro) \ + macro(fulfillPromise) \ + macro(rejectPromise) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +} // namespace JSC + +#endif // BuiltinPromiseBuiltins_h + +### End File: BuiltinPromiseBuiltins.h + +### Begin File: BuiltinPromiseBuiltins.cpp +/* + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "BuiltinPromiseBuiltins.h" + +#include "BuiltinExecutables.h" +#include "Executable.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPromiseRejectPromiseCodeLength = 413; +const char* s_builtinPromiseRejectPromiseCode = + "(function (promise, reason)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var reactions = promise.@promiseRejectReactions;\n" \ + " promise.@promiseResult = reason;\n" \ + " promise.@promiseFulfillReactions = undefined;\n" \ + " promise.@promiseRejectReactions = undefined;\n" \ + " promise.@promiseState = @promiseRejected;\n" \ + "\n" \ + " @InspectorInstrumentation.promiseRejected(promise, reason, reactions);\n" \ + "\n" \ + " @triggerPromiseReactions(reactions, reason);\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPromiseFulfillPromiseCodeLength = 412; +const char* s_builtinPromiseFulfillPromiseCode = + "(function (promise, value)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var reactions = promise.@promiseFulfillReactions;\n" \ + " promise.@promiseResult = value;\n" \ + " promise.@promiseFulfillReactions = undefined;\n" \ + " promise.@promiseRejectReactions = undefined;\n" \ + " promise.@promiseState = @promiseFulfilled;\n" \ + "\n" \ + " @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);\n" \ + "\n" \ + " @triggerPromiseReactions(reactions, value);\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); } +JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace JSC +### End File: BuiltinPromiseBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result new file mode 100644 index 000000000..2bb4cbce7 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result @@ -0,0 +1,187 @@ +### Begin File: JSCBuiltins.h +/* + * Copyright (c) 2014, 2015 Apple Inc. All rights reserved. + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef JSCBuiltins_h +#define JSCBuiltins_h + +namespace JSC { +class FunctionExecutable; +class VM; + +enum class ConstructAbility : unsigned; +} + +namespace JSC { + +/* Builtin.prototype */ +extern const char* s_builtinPrototypeEveryCode; +extern const int s_builtinPrototypeEveryCodeLength; +extern const JSC::ConstructAbility s_builtinPrototypeEveryCodeConstructAbility; +extern const char* s_builtinPrototypeForEachCode; +extern const int s_builtinPrototypeForEachCodeLength; +extern const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility; + +#define JSC_FOREACH_BUILTINPROTOTYPE_BUILTIN_DATA(macro) \ + macro(every, builtinPrototypeEvery, 1) \ + macro(forEach, builtinPrototypeForEach, 1) \ + +#define JSC_FOREACH_BUILTIN_CODE(macro) \ + macro(builtinPrototypeEveryCode, every, s_builtinPrototypeEveryCodeLength) \ + macro(builtinPrototypeForEachCode, forEach, s_builtinPrototypeForEachCodeLength) \ + +#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \ + macro(every) \ + macro(forEach) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +} // namespace JSC + +#endif // JSCBuiltins_h + +### End File: JSCBuiltins.h + +### Begin File: JSCBuiltins.cpp +/* + * Copyright (c) 2014, 2015 Apple Inc. All rights reserved. + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "JSCBuiltins.h" + +#include "BuiltinExecutables.h" +#include "Executable.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinPrototypeEveryCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPrototypeEveryCodeLength = 762; +const char* s_builtinPrototypeEveryCode = + "(function (callback )\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " if (this === null)\n" \ + " throw new @TypeError(\"Array.prototype.every requires that |this| not be null\");\n" \ + " \n" \ + " if (this === undefined)\n" \ + " throw new @TypeError(\"Array.prototype.every requires that |this| not be undefined\");\n" \ + " \n" \ + " var array = @Object(this);\n" \ + " var length = @toLength(array.length);\n" \ + "\n" \ + " if (typeof callback !== \"function\")\n" \ + " throw new @TypeError(\"Array.prototype.every callback must be a function\");\n" \ + " \n" \ + " var thisArg = arguments.length > 1 ? arguments[1] : undefined;\n" \ + " \n" \ + " for (var i = 0; i < length; i++) {\n" \ + " if (!(i in array))\n" \ + " continue;\n" \ + " if (!callback.@call(thisArg, array[i], i, array))\n" \ + " return false;\n" \ + " }\n" \ + " \n" \ + " return true;\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPrototypeForEachCodeLength = 694; +const char* s_builtinPrototypeForEachCode = + "(function (callback )\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " if (this === null)\n" \ + " throw new @TypeError(\"Array.prototype.forEach requires that |this| not be null\");\n" \ + " \n" \ + " if (this === undefined)\n" \ + " throw new @TypeError(\"Array.prototype.forEach requires that |this| not be undefined\");\n" \ + " \n" \ + " var array = @Object(this);\n" \ + " var length = @toLength(array.length);\n" \ + "\n" \ + " if (typeof callback !== \"function\")\n" \ + " throw new @TypeError(\"Array.prototype.forEach callback must be a function\");\n" \ + " \n" \ + " var thisArg = arguments.length > 1 ? arguments[1] : undefined;\n" \ + " \n" \ + " for (var i = 0; i < length; i++) {\n" \ + " if (i in array)\n" \ + " callback.@call(thisArg, array[i], i, array);\n" \ + " }\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); } +JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace JSC +### End File: JSCBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result new file mode 100644 index 000000000..315e00e8b --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result @@ -0,0 +1,189 @@ +### Begin File: BuiltinPrototypeBuiltins.h +/* + * Copyright (c) 2014, 2015 Apple Inc. All rights reserved. + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef BuiltinPrototypeBuiltins_h +#define BuiltinPrototypeBuiltins_h + + + +namespace JSC { +class FunctionExecutable; +} + +namespace JSC { + +/* Builtin.prototype */ +extern const char* s_builtinPrototypeEveryCode; +extern const int s_builtinPrototypeEveryCodeLength; +extern const JSC::ConstructAbility s_builtinPrototypeEveryCodeConstructAbility; +extern const char* s_builtinPrototypeForEachCode; +extern const int s_builtinPrototypeForEachCodeLength; +extern const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility; + +#define JSC_FOREACH_BUILTIN_PROTOTYPE_BUILTIN_DATA(macro) \ + macro(every, builtinPrototypeEvery, 1) \ + macro(forEach, builtinPrototypeForEach, 1) \ + +#define JSC_BUILTIN_BUILTIN_PROTOTYPE_EVERY 1 +#define JSC_BUILTIN_BUILTIN_PROTOTYPE_FOREACH 1 + +#define JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_CODE(macro) \ + macro(builtinPrototypeEveryCode, every, s_builtinPrototypeEveryCodeLength) \ + macro(builtinPrototypeForEachCode, forEach, s_builtinPrototypeForEachCodeLength) \ + +#define JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_FUNCTION_NAME(macro) \ + macro(every) \ + macro(forEach) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +} // namespace JSC + +#endif // BuiltinPrototypeBuiltins_h + +### End File: BuiltinPrototypeBuiltins.h + +### Begin File: BuiltinPrototypeBuiltins.cpp +/* + * Copyright (c) 2014, 2015 Apple Inc. All rights reserved. + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "BuiltinPrototypeBuiltins.h" + +#include "BuiltinExecutables.h" +#include "Executable.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinPrototypeEveryCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPrototypeEveryCodeLength = 762; +const char* s_builtinPrototypeEveryCode = + "(function (callback )\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " if (this === null)\n" \ + " throw new @TypeError(\"Array.prototype.every requires that |this| not be null\");\n" \ + " \n" \ + " if (this === undefined)\n" \ + " throw new @TypeError(\"Array.prototype.every requires that |this| not be undefined\");\n" \ + " \n" \ + " var array = @Object(this);\n" \ + " var length = @toLength(array.length);\n" \ + "\n" \ + " if (typeof callback !== \"function\")\n" \ + " throw new @TypeError(\"Array.prototype.every callback must be a function\");\n" \ + " \n" \ + " var thisArg = arguments.length > 1 ? arguments[1] : undefined;\n" \ + " \n" \ + " for (var i = 0; i < length; i++) {\n" \ + " if (!(i in array))\n" \ + " continue;\n" \ + " if (!callback.@call(thisArg, array[i], i, array))\n" \ + " return false;\n" \ + " }\n" \ + " \n" \ + " return true;\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPrototypeForEachCodeLength = 694; +const char* s_builtinPrototypeForEachCode = + "(function (callback )\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " if (this === null)\n" \ + " throw new @TypeError(\"Array.prototype.forEach requires that |this| not be null\");\n" \ + " \n" \ + " if (this === undefined)\n" \ + " throw new @TypeError(\"Array.prototype.forEach requires that |this| not be undefined\");\n" \ + " \n" \ + " var array = @Object(this);\n" \ + " var length = @toLength(array.length);\n" \ + "\n" \ + " if (typeof callback !== \"function\")\n" \ + " throw new @TypeError(\"Array.prototype.forEach callback must be a function\");\n" \ + " \n" \ + " var thisArg = arguments.length > 1 ? arguments[1] : undefined;\n" \ + " \n" \ + " for (var i = 0; i < length; i++) {\n" \ + " if (i in array)\n" \ + " callback.@call(thisArg, array[i], i, array);\n" \ + " }\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); } +JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace JSC +### End File: BuiltinPrototypeBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result new file mode 100644 index 000000000..0391de28d --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result @@ -0,0 +1,219 @@ +### Begin File: JSCBuiltins.h +/* + * Copyright (c) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef JSCBuiltins_h +#define JSCBuiltins_h + +namespace JSC { +class FunctionExecutable; +class VM; + +enum class ConstructAbility : unsigned; +} + +namespace JSC { + +/* BuiltinConstructor */ +extern const char* s_builtinConstructorOfCode; +extern const int s_builtinConstructorOfCodeLength; +extern const JSC::ConstructAbility s_builtinConstructorOfCodeConstructAbility; +extern const char* s_builtinConstructorFromCode; +extern const int s_builtinConstructorFromCodeLength; +extern const JSC::ConstructAbility s_builtinConstructorFromCodeConstructAbility; + +#define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_DATA(macro) \ + macro(of, builtinConstructorOf, 0) \ + macro(from, builtinConstructorFrom, 1) \ + +#define JSC_FOREACH_BUILTIN_CODE(macro) \ + macro(builtinConstructorOfCode, of, s_builtinConstructorOfCodeLength) \ + macro(builtinConstructorFromCode, from, s_builtinConstructorFromCodeLength) \ + +#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \ + macro(from) \ + macro(of) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +} // namespace JSC + +#endif // JSCBuiltins_h + +### End File: JSCBuiltins.h + +### Begin File: JSCBuiltins.cpp +/* + * Copyright (c) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "JSCBuiltins.h" + +#include "BuiltinExecutables.h" +#include "Executable.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinConstructorOfCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinConstructorOfCodeLength = 294; +const char* s_builtinConstructorOfCode = + "(function ()\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var length = arguments.length;\n" \ + " //\n" \ + " var array = typeof this === 'function' ? new this(length) : new @Array(length);\n" \ + " for (var k = 0; k < length; ++k)\n" \ + " @putByValDirect(array, k, arguments[k]);\n" \ + " array.length = length;\n" \ + " return array;\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_builtinConstructorFromCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinConstructorFromCodeLength = 2046; +const char* s_builtinConstructorFromCode = + "(function (items )\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var thisObj = this;\n" \ + "\n" \ + " var mapFn = arguments.length > 1 ? arguments[1] : undefined;\n" \ + "\n" \ + " var thisArg;\n" \ + "\n" \ + " if (mapFn !== undefined) {\n" \ + " if (typeof mapFn !== \"function\")\n" \ + " throw new @TypeError(\"Array.from requires that the second argument, when provided, be a function\");\n" \ + "\n" \ + " if (arguments.length > 2)\n" \ + " thisArg = arguments[2];\n" \ + " }\n" \ + "\n" \ + " if (items == null)\n" \ + " throw new @TypeError(\"Array.from requires an array-like object - not null or undefined\");\n" \ + "\n" \ + " var iteratorMethod = items[@symbolIterator];\n" \ + " if (iteratorMethod != null) {\n" \ + " if (typeof iteratorMethod !== \"function\")\n" \ + " throw new @TypeError(\"Array.from requires that the property of the first argument, items[Symbol.iterator], when exists, be a function\");\n" \ + "\n" \ + " //\n" \ + " var result = (typeof thisObj === \"function\") ? @Object(new thisObj()) : [];\n" \ + "\n" \ + " var k = 0;\n" \ + " var iterator = iteratorMethod.@call(items);\n" \ + "\n" \ + " //\n" \ + " //\n" \ + " //\n" \ + " var wrapper = {\n" \ + " [@symbolIterator]() {\n" \ + " return iterator;\n" \ + " }\n" \ + " };\n" \ + "\n" \ + " for (var value of wrapper) {\n" \ + " if (mapFn)\n" \ + " @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));\n" \ + " else\n" \ + " @putByValDirect(result, k, value);\n" \ + " k += 1;\n" \ + " }\n" \ + "\n" \ + " result.length = k;\n" \ + " return result;\n" \ + " }\n" \ + "\n" \ + " var arrayLike = @Object(items);\n" \ + " var arrayLikeLength = @toLength(arrayLike.length);\n" \ + "\n" \ + " //\n" \ + " var result = (typeof thisObj === \"function\") ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength);\n" \ + "\n" \ + " var k = 0;\n" \ + " while (k < arrayLikeLength) {\n" \ + " var value = arrayLike[k];\n" \ + " if (mapFn)\n" \ + " @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));\n" \ + " else\n" \ + " @putByValDirect(result, k, value);\n" \ + " k += 1;\n" \ + " }\n" \ + "\n" \ + " result.length = arrayLikeLength;\n" \ + " return result;\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); } +JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace JSC +### End File: JSCBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result new file mode 100644 index 000000000..2d26e4934 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result @@ -0,0 +1,221 @@ +### Begin File: BuiltinConstructorBuiltins.h +/* + * Copyright (c) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef BuiltinConstructorBuiltins_h +#define BuiltinConstructorBuiltins_h + + + +namespace JSC { +class FunctionExecutable; +} + +namespace JSC { + +/* BuiltinConstructor */ +extern const char* s_builtinConstructorOfCode; +extern const int s_builtinConstructorOfCodeLength; +extern const JSC::ConstructAbility s_builtinConstructorOfCodeConstructAbility; +extern const char* s_builtinConstructorFromCode; +extern const int s_builtinConstructorFromCodeLength; +extern const JSC::ConstructAbility s_builtinConstructorFromCodeConstructAbility; + +#define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_DATA(macro) \ + macro(of, builtinConstructorOf, 0) \ + macro(from, builtinConstructorFrom, 1) \ + +#define JSC_BUILTIN_BUILTINCONSTRUCTOR_OF 1 +#define JSC_BUILTIN_BUILTINCONSTRUCTOR_FROM 1 + +#define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_CODE(macro) \ + macro(builtinConstructorOfCode, of, s_builtinConstructorOfCodeLength) \ + macro(builtinConstructorFromCode, from, s_builtinConstructorFromCodeLength) \ + +#define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_FUNCTION_NAME(macro) \ + macro(from) \ + macro(of) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +} // namespace JSC + +#endif // BuiltinConstructorBuiltins_h + +### End File: BuiltinConstructorBuiltins.h + +### Begin File: BuiltinConstructorBuiltins.cpp +/* + * Copyright (c) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "BuiltinConstructorBuiltins.h" + +#include "BuiltinExecutables.h" +#include "Executable.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinConstructorOfCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinConstructorOfCodeLength = 294; +const char* s_builtinConstructorOfCode = + "(function ()\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var length = arguments.length;\n" \ + " //\n" \ + " var array = typeof this === 'function' ? new this(length) : new @Array(length);\n" \ + " for (var k = 0; k < length; ++k)\n" \ + " @putByValDirect(array, k, arguments[k]);\n" \ + " array.length = length;\n" \ + " return array;\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_builtinConstructorFromCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinConstructorFromCodeLength = 2046; +const char* s_builtinConstructorFromCode = + "(function (items )\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var thisObj = this;\n" \ + "\n" \ + " var mapFn = arguments.length > 1 ? arguments[1] : undefined;\n" \ + "\n" \ + " var thisArg;\n" \ + "\n" \ + " if (mapFn !== undefined) {\n" \ + " if (typeof mapFn !== \"function\")\n" \ + " throw new @TypeError(\"Array.from requires that the second argument, when provided, be a function\");\n" \ + "\n" \ + " if (arguments.length > 2)\n" \ + " thisArg = arguments[2];\n" \ + " }\n" \ + "\n" \ + " if (items == null)\n" \ + " throw new @TypeError(\"Array.from requires an array-like object - not null or undefined\");\n" \ + "\n" \ + " var iteratorMethod = items[@symbolIterator];\n" \ + " if (iteratorMethod != null) {\n" \ + " if (typeof iteratorMethod !== \"function\")\n" \ + " throw new @TypeError(\"Array.from requires that the property of the first argument, items[Symbol.iterator], when exists, be a function\");\n" \ + "\n" \ + " //\n" \ + " var result = (typeof thisObj === \"function\") ? @Object(new thisObj()) : [];\n" \ + "\n" \ + " var k = 0;\n" \ + " var iterator = iteratorMethod.@call(items);\n" \ + "\n" \ + " //\n" \ + " //\n" \ + " //\n" \ + " var wrapper = {\n" \ + " [@symbolIterator]() {\n" \ + " return iterator;\n" \ + " }\n" \ + " };\n" \ + "\n" \ + " for (var value of wrapper) {\n" \ + " if (mapFn)\n" \ + " @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));\n" \ + " else\n" \ + " @putByValDirect(result, k, value);\n" \ + " k += 1;\n" \ + " }\n" \ + "\n" \ + " result.length = k;\n" \ + " return result;\n" \ + " }\n" \ + "\n" \ + " var arrayLike = @Object(items);\n" \ + " var arrayLikeLength = @toLength(arrayLike.length);\n" \ + "\n" \ + " //\n" \ + " var result = (typeof thisObj === \"function\") ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength);\n" \ + "\n" \ + " var k = 0;\n" \ + " while (k < arrayLikeLength) {\n" \ + " var value = arrayLike[k];\n" \ + " if (mapFn)\n" \ + " @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));\n" \ + " else\n" \ + " @putByValDirect(result, k, value);\n" \ + " k += 1;\n" \ + " }\n" \ + "\n" \ + " result.length = arrayLikeLength;\n" \ + " return result;\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); } +JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace JSC +### End File: BuiltinConstructorBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-error b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-error new file mode 100644 index 000000000..eb147c40b --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-error @@ -0,0 +1 @@ +ERROR: There are several internal functions with the same name. Private identifiers may clash. diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result new file mode 100644 index 000000000..d569ac528 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result @@ -0,0 +1,146 @@ +### Begin File: JSCBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef JSCBuiltins_h +#define JSCBuiltins_h + +namespace JSC { +class FunctionExecutable; +class VM; + +enum class ConstructAbility : unsigned; +} + +namespace JSC { + +/* InternalClashingNames */ +extern const char* s_internalClashingNamesIsReadableStreamLockedCode; +extern const int s_internalClashingNamesIsReadableStreamLockedCodeLength; +extern const JSC::ConstructAbility s_internalClashingNamesIsReadableStreamLockedCodeConstructAbility; +extern const char* s_internalClashingNamesIsReadableStreamLockedCode; +extern const int s_internalClashingNamesIsReadableStreamLockedCodeLength; +extern const JSC::ConstructAbility s_internalClashingNamesIsReadableStreamLockedCodeConstructAbility; + +#define JSC_FOREACH_INTERNALCLASHINGNAMES_BUILTIN_DATA(macro) \ + macro(isReadableStreamLocked, internalClashingNamesIsReadableStreamLocked, 1) \ + macro(isReadableStreamLocked, internalClashingNamesIsReadableStreamLocked, 1) \ + +#define JSC_FOREACH_BUILTIN_CODE(macro) \ + macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, s_internalClashingNamesIsReadableStreamLockedCodeLength) \ + macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, s_internalClashingNamesIsReadableStreamLockedCodeLength) \ + +#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \ + macro(isReadableStreamLocked) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +} // namespace JSC + +#endif // JSCBuiltins_h + +### End File: JSCBuiltins.h + +### Begin File: JSCBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "JSCBuiltins.h" + +#include "BuiltinExecutables.h" +#include "Executable.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_internalClashingNamesIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_internalClashingNamesIsReadableStreamLockedCodeLength = 71; +const char* s_internalClashingNamesIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " return !!stream.@reader;\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_internalClashingNamesIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_internalClashingNamesIsReadableStreamLockedCodeLength = 71; +const char* s_internalClashingNamesIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " return !!stream.@reader;\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); } +JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace JSC +### End File: JSCBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Operations.Promise-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Operations.Promise-Combined.js-result new file mode 100644 index 000000000..c1451111c --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Operations.Promise-Combined.js-result @@ -0,0 +1,415 @@ +### Begin File: JSCBuiltins.h +/* + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef JSCBuiltins_h +#define JSCBuiltins_h + +namespace JSC { +class FunctionExecutable; +class VM; + +enum class ConstructAbility : unsigned; +} + +namespace JSC { + +/* Operations.Promise */ +extern const char* s_operationsPromiseIsPromiseCode; +extern const int s_operationsPromiseIsPromiseCodeLength; +extern const JSC::ConstructAbility s_operationsPromiseIsPromiseCodeConstructAbility; +extern const char* s_operationsPromiseNewPromiseReactionCode; +extern const int s_operationsPromiseNewPromiseReactionCodeLength; +extern const JSC::ConstructAbility s_operationsPromiseNewPromiseReactionCodeConstructAbility; +extern const char* s_operationsPromiseNewPromiseCapabilityCode; +extern const int s_operationsPromiseNewPromiseCapabilityCodeLength; +extern const JSC::ConstructAbility s_operationsPromiseNewPromiseCapabilityCodeConstructAbility; +extern const char* s_operationsPromiseTriggerPromiseReactionsCode; +extern const int s_operationsPromiseTriggerPromiseReactionsCodeLength; +extern const JSC::ConstructAbility s_operationsPromiseTriggerPromiseReactionsCodeConstructAbility; +extern const char* s_operationsPromiseRejectPromiseCode; +extern const int s_operationsPromiseRejectPromiseCodeLength; +extern const JSC::ConstructAbility s_operationsPromiseRejectPromiseCodeConstructAbility; +extern const char* s_operationsPromiseFulfillPromiseCode; +extern const int s_operationsPromiseFulfillPromiseCodeLength; +extern const JSC::ConstructAbility s_operationsPromiseFulfillPromiseCodeConstructAbility; +extern const char* s_operationsPromiseCreateResolvingFunctionsCode; +extern const int s_operationsPromiseCreateResolvingFunctionsCodeLength; +extern const JSC::ConstructAbility s_operationsPromiseCreateResolvingFunctionsCodeConstructAbility; +extern const char* s_operationsPromisePromiseReactionJobCode; +extern const int s_operationsPromisePromiseReactionJobCodeLength; +extern const JSC::ConstructAbility s_operationsPromisePromiseReactionJobCodeConstructAbility; +extern const char* s_operationsPromisePromiseResolveThenableJobCode; +extern const int s_operationsPromisePromiseResolveThenableJobCodeLength; +extern const JSC::ConstructAbility s_operationsPromisePromiseResolveThenableJobCodeConstructAbility; +extern const char* s_operationsPromiseInitializePromiseCode; +extern const int s_operationsPromiseInitializePromiseCodeLength; +extern const JSC::ConstructAbility s_operationsPromiseInitializePromiseCodeConstructAbility; + +#define JSC_FOREACH_OPERATIONSPROMISE_BUILTIN_DATA(macro) \ + macro(isPromise, operationsPromiseIsPromise, 1) \ + macro(newPromiseReaction, operationsPromiseNewPromiseReaction, 2) \ + macro(newPromiseCapability, operationsPromiseNewPromiseCapability, 1) \ + macro(triggerPromiseReactions, operationsPromiseTriggerPromiseReactions, 2) \ + macro(rejectPromise, operationsPromiseRejectPromise, 2) \ + macro(fulfillPromise, operationsPromiseFulfillPromise, 2) \ + macro(createResolvingFunctions, operationsPromiseCreateResolvingFunctions, 1) \ + macro(promiseReactionJob, operationsPromisePromiseReactionJob, 2) \ + macro(promiseResolveThenableJob, operationsPromisePromiseResolveThenableJob, 3) \ + macro(initializePromise, operationsPromiseInitializePromise, 1) \ + +#define JSC_BUILTIN_OPERATIONSPROMISE_ISPROMISE 1 +#define JSC_BUILTIN_OPERATIONSPROMISE_NEWPROMISEREACTION 1 +#define JSC_BUILTIN_OPERATIONSPROMISE_NEWPROMISECAPABILITY 1 +#define JSC_BUILTIN_OPERATIONSPROMISE_TRIGGERPROMISEREACTIONS 1 +#define JSC_BUILTIN_OPERATIONSPROMISE_REJECTPROMISE 1 +#define JSC_BUILTIN_OPERATIONSPROMISE_FULFILLPROMISE 1 +#define JSC_BUILTIN_OPERATIONSPROMISE_CREATERESOLVINGFUNCTIONS 1 +#define JSC_BUILTIN_OPERATIONSPROMISE_PROMISEREACTIONJOB 1 +#define JSC_BUILTIN_OPERATIONSPROMISE_PROMISERESOLVETHENABLEJOB 1 +#define JSC_BUILTIN_OPERATIONSPROMISE_INITIALIZEPROMISE 1 + +#define JSC_FOREACH_BUILTIN_CODE(macro) \ + macro(operationsPromiseIsPromiseCode, isPromise, s_operationsPromiseIsPromiseCodeLength) \ + macro(operationsPromiseNewPromiseReactionCode, newPromiseReaction, s_operationsPromiseNewPromiseReactionCodeLength) \ + macro(operationsPromiseNewPromiseCapabilityCode, newPromiseCapability, s_operationsPromiseNewPromiseCapabilityCodeLength) \ + macro(operationsPromiseTriggerPromiseReactionsCode, triggerPromiseReactions, s_operationsPromiseTriggerPromiseReactionsCodeLength) \ + macro(operationsPromiseRejectPromiseCode, rejectPromise, s_operationsPromiseRejectPromiseCodeLength) \ + macro(operationsPromiseFulfillPromiseCode, fulfillPromise, s_operationsPromiseFulfillPromiseCodeLength) \ + macro(operationsPromiseCreateResolvingFunctionsCode, createResolvingFunctions, s_operationsPromiseCreateResolvingFunctionsCodeLength) \ + macro(operationsPromisePromiseReactionJobCode, promiseReactionJob, s_operationsPromisePromiseReactionJobCodeLength) \ + macro(operationsPromisePromiseResolveThenableJobCode, promiseResolveThenableJob, s_operationsPromisePromiseResolveThenableJobCodeLength) \ + macro(operationsPromiseInitializePromiseCode, initializePromise, s_operationsPromiseInitializePromiseCodeLength) \ + +#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \ + macro(createResolvingFunctions) \ + macro(fulfillPromise) \ + macro(initializePromise) \ + macro(isPromise) \ + macro(newPromiseCapability) \ + macro(newPromiseReaction) \ + macro(promiseReactionJob) \ + macro(promiseResolveThenableJob) \ + macro(rejectPromise) \ + macro(triggerPromiseReactions) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +#define JSC_BUILTIN_EXISTS(object, func) defined JSC_BUILTIN_ ## object ## _ ## func + +} // namespace JSC + +#endif // JSCBuiltins_h + +### End File: JSCBuiltins.h + +### Begin File: JSCBuiltins.cpp +/* + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "JSCBuiltins.h" + +#include "BuiltinExecutables.h" +#include "Executable.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_operationsPromiseIsPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_operationsPromiseIsPromiseCodeLength = 158; +const char* s_operationsPromiseIsPromiseCode = + "(function (promise)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " return @isObject(promise) && !!promise.@promiseState;\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_operationsPromiseNewPromiseReactionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_operationsPromiseNewPromiseReactionCodeLength = 220; +const char* s_operationsPromiseNewPromiseReactionCode = + "(function (capability, handler)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " return {\n" \ + " @capabilities: capability,\n" \ + " @handler: handler\n" \ + " };\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_operationsPromiseNewPromiseCapabilityCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_operationsPromiseNewPromiseCapabilityCodeLength = 1427; +const char* s_operationsPromiseNewPromiseCapabilityCode = + "(function (constructor)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " //\n" \ + " if (typeof constructor !== \"function\")\n" \ + " throw new @TypeError(\"promise capability requires a constructor function\");\n" \ + "\n" \ + " var promiseCapability = {\n" \ + " @promise: undefined,\n" \ + " @resolve: undefined,\n" \ + " @reject: undefined\n" \ + " };\n" \ + "\n" \ + " function executor(resolve, reject)\n" \ + " {\n" \ + " if (promiseCapability.@resolve !== undefined)\n" \ + " throw new @TypeError(\"resolve function is already set\");\n" \ + " if (promiseCapability.@reject !== undefined)\n" \ + " throw new @TypeError(\"reject function is already set\");\n" \ + "\n" \ + " promiseCapability.@resolve = resolve;\n" \ + " promiseCapability.@reject = reject;\n" \ + " }\n" \ + "\n" \ + " var promise = new constructor(executor);\n" \ + "\n" \ + " if (typeof promiseCapability.@resolve !== \"function\")\n" \ + " throw new @TypeError(\"executor did not take a resolve function\");\n" \ + "\n" \ + " if (typeof promiseCapability.@reject !== \"function\")\n" \ + " throw new @TypeError(\"executor did not take a reject function\");\n" \ + "\n" \ + " promiseCapability.@promise = promise;\n" \ + "\n" \ + " return promiseCapability;\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_operationsPromiseTriggerPromiseReactionsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_operationsPromiseTriggerPromiseReactionsCodeLength = 269; +const char* s_operationsPromiseTriggerPromiseReactionsCode = + "(function (reactions, argument)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " for (var index = 0, length = reactions.length; index < length; ++index)\n" \ + " @enqueueJob(@promiseReactionJob, [reactions[index], argument]);\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_operationsPromiseRejectPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_operationsPromiseRejectPromiseCodeLength = 541; +const char* s_operationsPromiseRejectPromiseCode = + "(function (promise, reason)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var reactions = promise.@promiseRejectReactions;\n" \ + " promise.@promiseResult = reason;\n" \ + " promise.@promiseFulfillReactions = undefined;\n" \ + " promise.@promiseRejectReactions = undefined;\n" \ + " promise.@promiseState = @promiseRejected;\n" \ + "\n" \ + " @InspectorInstrumentation.promiseRejected(promise, reason, reactions);\n" \ + "\n" \ + " @triggerPromiseReactions(reactions, reason);\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_operationsPromiseFulfillPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_operationsPromiseFulfillPromiseCodeLength = 540; +const char* s_operationsPromiseFulfillPromiseCode = + "(function (promise, value)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var reactions = promise.@promiseFulfillReactions;\n" \ + " promise.@promiseResult = value;\n" \ + " promise.@promiseFulfillReactions = undefined;\n" \ + " promise.@promiseRejectReactions = undefined;\n" \ + " promise.@promiseState = @promiseFulfilled;\n" \ + "\n" \ + " @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);\n" \ + "\n" \ + " @triggerPromiseReactions(reactions, value);\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_operationsPromiseCreateResolvingFunctionsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_operationsPromiseCreateResolvingFunctionsCodeLength = 1468; +const char* s_operationsPromiseCreateResolvingFunctionsCode = + "(function (promise)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var alreadyResolved = false;\n" \ + "\n" \ + " var resolve = function (resolution) {\n" \ + " if (alreadyResolved)\n" \ + " return undefined;\n" \ + " alreadyResolved = true;\n" \ + "\n" \ + " if (resolution === promise)\n" \ + " return @rejectPromise(promise, new @TypeError(\"Resolve a promise with itself\"));\n" \ + "\n" \ + " if (!@isObject(resolution))\n" \ + " return @fulfillPromise(promise, resolution);\n" \ + "\n" \ + " var then;\n" \ + " try {\n" \ + " then = resolution.then;\n" \ + " } catch (error) {\n" \ + " return @rejectPromise(promise, error);\n" \ + " }\n" \ + "\n" \ + " if (typeof then !== 'function')\n" \ + " return @fulfillPromise(promise, resolution);\n" \ + "\n" \ + " @enqueueJob(@promiseResolveThenableJob, [promise, resolution, then]);\n" \ + "\n" \ + " return undefined;\n" \ + " };\n" \ + "\n" \ + " var reject = function (reason) {\n" \ + " if (alreadyResolved)\n" \ + " return undefined;\n" \ + " alreadyResolved = true;\n" \ + "\n" \ + " return @rejectPromise(promise, reason);\n" \ + " };\n" \ + "\n" \ + " return {\n" \ + " @resolve: resolve,\n" \ + " @reject: reject\n" \ + " };\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_operationsPromisePromiseReactionJobCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_operationsPromisePromiseReactionJobCodeLength = 493; +const char* s_operationsPromisePromiseReactionJobCode = + "(function (reaction, argument)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var promiseCapability = reaction.@capabilities;\n" \ + "\n" \ + " var result;\n" \ + " try {\n" \ + " result = reaction.@handler.@call(undefined, argument);\n" \ + " } catch (error) {\n" \ + " return promiseCapability.@reject.@call(undefined, error);\n" \ + " }\n" \ + "\n" \ + " return promiseCapability.@resolve.@call(undefined, result);\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_operationsPromisePromiseResolveThenableJobCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_operationsPromisePromiseResolveThenableJobCodeLength = 453; +const char* s_operationsPromisePromiseResolveThenableJobCode = + "(function (promiseToResolve, thenable, then)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " var resolvingFunctions = @createResolvingFunctions(promiseToResolve);\n" \ + "\n" \ + " try {\n" \ + " return then.@call(thenable, resolvingFunctions.@resolve, resolvingFunctions.@reject);\n" \ + " } catch (error) {\n" \ + " return resolvingFunctions.@reject.@call(undefined, error);\n" \ + " }\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_operationsPromiseInitializePromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_operationsPromiseInitializePromiseCodeLength = 731; +const char* s_operationsPromiseInitializePromiseCode = + "(function (executor)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " if (typeof executor !== 'function')\n" \ + " throw new @TypeError(\"Promise constructor takes a function argument\");\n" \ + "\n" \ + " this.@promiseState = @promisePending;\n" \ + " this.@promiseFulfillReactions = [];\n" \ + " this.@promiseRejectReactions = [];\n" \ + "\n" \ + " var resolvingFunctions = @createResolvingFunctions(this);\n" \ + " try {\n" \ + " executor(resolvingFunctions.@resolve, resolvingFunctions.@reject);\n" \ + " } catch (error) {\n" \ + " return resolvingFunctions.@reject.@call(undefined, error);\n" \ + " }\n" \ + "\n" \ + " return this;\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); } +JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace JSC +### End File: JSCBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result new file mode 100644 index 000000000..5b61d2f82 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result @@ -0,0 +1,198 @@ +### Begin File: ArbitraryConditionalGuardBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef ArbitraryConditionalGuardBuiltins_h +#define ArbitraryConditionalGuardBuiltins_h + +#if ENABLE(STREAMS_API) || USE(CF) + +#include <builtins/BuiltinUtils.h> +#include <bytecode/UnlinkedFunctionExecutable.h> +#include <runtime/Identifier.h> +#include <runtime/JSFunction.h> + +namespace JSC { +class FunctionExecutable; +} + +namespace WebCore { + +/* ArbitraryConditionalGuard */ +extern const char* s_arbitraryConditionalGuardIsReadableStreamLockedCode; +extern const int s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength; +extern const JSC::ConstructAbility s_arbitraryConditionalGuardIsReadableStreamLockedCodeConstructAbility; + +#define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_DATA(macro) \ + macro(isReadableStreamLocked, arbitraryConditionalGuardIsReadableStreamLocked, 1) \ + +#define WEBCORE_BUILTIN_ARBITRARYCONDITIONALGUARD_ISREADABLESTREAMLOCKED 1 + +#define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(macro) \ + macro(arbitraryConditionalGuardIsReadableStreamLockedCode, isReadableStreamLocked, s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength) \ + +#define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(macro) \ + macro(isReadableStreamLocked) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +class ArbitraryConditionalGuardBuiltinsWrapper : private JSC::WeakHandleOwner { +public: + explicit ArbitraryConditionalGuardBuiltinsWrapper(JSC::VM* vm) + : m_vm(*vm) + WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) +#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length))) + WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) +#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS + { + } + +#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \ + JSC::UnlinkedFunctionExecutable* name##Executable(); \ + const JSC::SourceCode& name##Source() const { return m_##name##Source; } + WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) +#undef EXPOSE_BUILTIN_EXECUTABLES + + WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) + + void exportNames(); + +private: + JSC::VM& m_vm; + + WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) + +#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \ + JSC::SourceCode m_##name##Source;\ + JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; + WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS + +}; + +#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \ +inline JSC::UnlinkedFunctionExecutable* ArbitraryConditionalGuardBuiltinsWrapper::name##Executable() \ +{\ + if (!m_##name##Executable)\ + m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ + return m_##name##Executable.get();\ +} +WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) +#undef DEFINE_BUILTIN_EXECUTABLES + +inline void ArbitraryConditionalGuardBuiltinsWrapper::exportNames() +{ +#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); + WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) +#undef EXPORT_FUNCTION_NAME +} + +} // namespace WebCore + +#endif // ENABLE(STREAMS_API) || USE(CF) + +#endif // ArbitraryConditionalGuardBuiltins_h + +### End File: ArbitraryConditionalGuardBuiltins.h + +### Begin File: ArbitraryConditionalGuardBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "ArbitraryConditionalGuardBuiltins.h" + +#if ENABLE(STREAMS_API) || USE(CF) + +#include "WebCoreJSClientData.h" +#include <runtime/Executable.h> +#include <runtime/JSCJSValueInlines.h> +#include <runtime/JSCellInlines.h> +#include <runtime/StructureInlines.h> +#include <runtime/VM.h> + +namespace WebCore { + +const JSC::ConstructAbility s_arbitraryConditionalGuardIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength = 71; +const char* s_arbitraryConditionalGuardIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " return !!stream.@reader;\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ + return clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Source()); \ +} +WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace WebCore + +#endif // ENABLE(STREAMS_API) || USE(CF) + +### End File: ArbitraryConditionalGuardBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateFlagAnnotation-Separate.js-error b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateFlagAnnotation-Separate.js-error new file mode 100644 index 000000000..b15152e63 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateFlagAnnotation-Separate.js-error @@ -0,0 +1 @@ +ERROR: Duplicate annotation found: internal diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateKeyValueAnnotation-Separate.js-error b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateKeyValueAnnotation-Separate.js-error new file mode 100644 index 000000000..f1b429e27 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateKeyValueAnnotation-Separate.js-error @@ -0,0 +1 @@ +ERROR: Duplicate annotation found: conditional diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result new file mode 100644 index 000000000..5b1544cb5 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result @@ -0,0 +1,198 @@ +### Begin File: GuardedBuiltinBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef GuardedBuiltinBuiltins_h +#define GuardedBuiltinBuiltins_h + +#if ENABLE(STREAMS_API) + +#include <builtins/BuiltinUtils.h> +#include <bytecode/UnlinkedFunctionExecutable.h> +#include <runtime/Identifier.h> +#include <runtime/JSFunction.h> + +namespace JSC { +class FunctionExecutable; +} + +namespace WebCore { + +/* GuardedBuiltin */ +extern const char* s_guardedBuiltinIsReadableStreamLockedCode; +extern const int s_guardedBuiltinIsReadableStreamLockedCodeLength; +extern const JSC::ConstructAbility s_guardedBuiltinIsReadableStreamLockedCodeConstructAbility; + +#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_DATA(macro) \ + macro(isReadableStreamLocked, guardedBuiltinIsReadableStreamLocked, 1) \ + +#define WEBCORE_BUILTIN_GUARDEDBUILTIN_ISREADABLESTREAMLOCKED 1 + +#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(macro) \ + macro(guardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_guardedBuiltinIsReadableStreamLockedCodeLength) \ + +#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \ + macro(isReadableStreamLocked) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +class GuardedBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner { +public: + explicit GuardedBuiltinBuiltinsWrapper(JSC::VM* vm) + : m_vm(*vm) + WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) +#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length))) + WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) +#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS + { + } + +#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \ + JSC::UnlinkedFunctionExecutable* name##Executable(); \ + const JSC::SourceCode& name##Source() const { return m_##name##Source; } + WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) +#undef EXPOSE_BUILTIN_EXECUTABLES + + WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) + + void exportNames(); + +private: + JSC::VM& m_vm; + + WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) + +#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \ + JSC::SourceCode m_##name##Source;\ + JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; + WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS + +}; + +#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \ +inline JSC::UnlinkedFunctionExecutable* GuardedBuiltinBuiltinsWrapper::name##Executable() \ +{\ + if (!m_##name##Executable)\ + m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ + return m_##name##Executable.get();\ +} +WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) +#undef DEFINE_BUILTIN_EXECUTABLES + +inline void GuardedBuiltinBuiltinsWrapper::exportNames() +{ +#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); + WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) +#undef EXPORT_FUNCTION_NAME +} + +} // namespace WebCore + +#endif // ENABLE(STREAMS_API) + +#endif // GuardedBuiltinBuiltins_h + +### End File: GuardedBuiltinBuiltins.h + +### Begin File: GuardedBuiltinBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "GuardedBuiltinBuiltins.h" + +#if ENABLE(STREAMS_API) + +#include "WebCoreJSClientData.h" +#include <runtime/Executable.h> +#include <runtime/JSCJSValueInlines.h> +#include <runtime/JSCellInlines.h> +#include <runtime/StructureInlines.h> +#include <runtime/VM.h> + +namespace WebCore { + +const JSC::ConstructAbility s_guardedBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_guardedBuiltinIsReadableStreamLockedCodeLength = 71; +const char* s_guardedBuiltinIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " return !!stream.@reader;\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ + return clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Source()); \ +} +WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace WebCore + +#endif // ENABLE(STREAMS_API) + +### End File: GuardedBuiltinBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result new file mode 100644 index 000000000..53b5552e2 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result @@ -0,0 +1,230 @@ +### Begin File: GuardedInternalBuiltinBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef GuardedInternalBuiltinBuiltins_h +#define GuardedInternalBuiltinBuiltins_h + +#if ENABLE(STREAMS_API) + +#include <builtins/BuiltinUtils.h> +#include <bytecode/UnlinkedFunctionExecutable.h> +#include <runtime/Identifier.h> +#include <runtime/JSFunction.h> + +namespace JSC { +class FunctionExecutable; +} + +namespace WebCore { + +/* GuardedInternalBuiltin */ +extern const char* s_guardedInternalBuiltinIsReadableStreamLockedCode; +extern const int s_guardedInternalBuiltinIsReadableStreamLockedCodeLength; +extern const JSC::ConstructAbility s_guardedInternalBuiltinIsReadableStreamLockedCodeConstructAbility; + +#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_DATA(macro) \ + macro(isReadableStreamLocked, guardedInternalBuiltinIsReadableStreamLocked, 1) \ + +#define WEBCORE_BUILTIN_GUARDEDINTERNALBUILTIN_ISREADABLESTREAMLOCKED 1 + +#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(macro) \ + macro(guardedInternalBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_guardedInternalBuiltinIsReadableStreamLockedCodeLength) \ + +#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(macro) \ + macro(isReadableStreamLocked) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +class GuardedInternalBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner { +public: + explicit GuardedInternalBuiltinBuiltinsWrapper(JSC::VM* vm) + : m_vm(*vm) + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) +#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length))) + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) +#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS + { + } + +#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \ + JSC::UnlinkedFunctionExecutable* name##Executable(); \ + const JSC::SourceCode& name##Source() const { return m_##name##Source; } + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) +#undef EXPOSE_BUILTIN_EXECUTABLES + + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) + + void exportNames(); + +private: + JSC::VM& m_vm; + + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) + +#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \ + JSC::SourceCode m_##name##Source;\ + JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS + +}; + +#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \ +inline JSC::UnlinkedFunctionExecutable* GuardedInternalBuiltinBuiltinsWrapper::name##Executable() \ +{\ + if (!m_##name##Executable)\ + m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ + return m_##name##Executable.get();\ +} +WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) +#undef DEFINE_BUILTIN_EXECUTABLES + +inline void GuardedInternalBuiltinBuiltinsWrapper::exportNames() +{ +#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) +#undef EXPORT_FUNCTION_NAME +} + +class GuardedInternalBuiltinBuiltinFunctions { +public: + explicit GuardedInternalBuiltinBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } + + void init(JSC::JSGlobalObject&); + void visit(JSC::SlotVisitor&); + +public: + JSC::VM& m_vm; + +#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ + JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function; + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS +}; + +inline void GuardedInternalBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) +{ +#define EXPORT_FUNCTION(codeName, functionName, length)\ + m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject)); + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION) +#undef EXPORT_FUNCTION +} + +inline void GuardedInternalBuiltinBuiltinFunctions::visit(JSC::SlotVisitor& visitor) +{ +#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function); + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) +#undef VISIT_FUNCTION +} + + +} // namespace WebCore + +#endif // ENABLE(STREAMS_API) + +#endif // GuardedInternalBuiltinBuiltins_h + +### End File: GuardedInternalBuiltinBuiltins.h + +### Begin File: GuardedInternalBuiltinBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "GuardedInternalBuiltinBuiltins.h" + +#if ENABLE(STREAMS_API) + +#include "WebCoreJSClientData.h" +#include <runtime/Executable.h> +#include <runtime/JSCJSValueInlines.h> +#include <runtime/JSCellInlines.h> +#include <runtime/StructureInlines.h> +#include <runtime/VM.h> + +namespace WebCore { + +const JSC::ConstructAbility s_guardedInternalBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_guardedInternalBuiltinIsReadableStreamLockedCodeLength = 71; +const char* s_guardedInternalBuiltinIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " return !!stream.@reader;\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ + return clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Source()); \ +} +WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace WebCore + +#endif // ENABLE(STREAMS_API) + +### End File: GuardedInternalBuiltinBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result new file mode 100644 index 000000000..7c96b9f14 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result @@ -0,0 +1,189 @@ +### Begin File: UnguardedBuiltinBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef UnguardedBuiltinBuiltins_h +#define UnguardedBuiltinBuiltins_h + +#include <builtins/BuiltinUtils.h> +#include <bytecode/UnlinkedFunctionExecutable.h> +#include <runtime/Identifier.h> +#include <runtime/JSFunction.h> + +namespace JSC { +class FunctionExecutable; +} + +namespace WebCore { + +/* UnguardedBuiltin */ +extern const char* s_unguardedBuiltinIsReadableStreamLockedCode; +extern const int s_unguardedBuiltinIsReadableStreamLockedCodeLength; +extern const JSC::ConstructAbility s_unguardedBuiltinIsReadableStreamLockedCodeConstructAbility; + +#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_DATA(macro) \ + macro(isReadableStreamLocked, unguardedBuiltinIsReadableStreamLocked, 1) \ + +#define WEBCORE_BUILTIN_UNGUARDEDBUILTIN_ISREADABLESTREAMLOCKED 1 + +#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(macro) \ + macro(unguardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_unguardedBuiltinIsReadableStreamLockedCodeLength) \ + +#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \ + macro(isReadableStreamLocked) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +class UnguardedBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner { +public: + explicit UnguardedBuiltinBuiltinsWrapper(JSC::VM* vm) + : m_vm(*vm) + WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) +#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length))) + WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) +#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS + { + } + +#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \ + JSC::UnlinkedFunctionExecutable* name##Executable(); \ + const JSC::SourceCode& name##Source() const { return m_##name##Source; } + WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) +#undef EXPOSE_BUILTIN_EXECUTABLES + + WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) + + void exportNames(); + +private: + JSC::VM& m_vm; + + WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) + +#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \ + JSC::SourceCode m_##name##Source;\ + JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; + WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS + +}; + +#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \ +inline JSC::UnlinkedFunctionExecutable* UnguardedBuiltinBuiltinsWrapper::name##Executable() \ +{\ + if (!m_##name##Executable)\ + m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ + return m_##name##Executable.get();\ +} +WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) +#undef DEFINE_BUILTIN_EXECUTABLES + +inline void UnguardedBuiltinBuiltinsWrapper::exportNames() +{ +#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); + WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) +#undef EXPORT_FUNCTION_NAME +} + +} // namespace WebCore + +#endif // UnguardedBuiltinBuiltins_h + +### End File: UnguardedBuiltinBuiltins.h + +### Begin File: UnguardedBuiltinBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "UnguardedBuiltinBuiltins.h" + +#include "WebCoreJSClientData.h" +#include <runtime/Executable.h> +#include <runtime/JSCJSValueInlines.h> +#include <runtime/JSCellInlines.h> +#include <runtime/StructureInlines.h> +#include <runtime/VM.h> + +namespace WebCore { + +const JSC::ConstructAbility s_unguardedBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_unguardedBuiltinIsReadableStreamLockedCodeLength = 71; +const char* s_unguardedBuiltinIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " return !!stream.@reader;\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ + return clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Source()); \ +} +WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace WebCore +### End File: UnguardedBuiltinBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result new file mode 100644 index 000000000..726b281a9 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result @@ -0,0 +1,281 @@ +### Begin File: xmlCasingTestBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#ifndef xmlCasingTestBuiltins_h +#define xmlCasingTestBuiltins_h + +#if ENABLE(STREAMS_API) + +#include <builtins/BuiltinUtils.h> +#include <bytecode/UnlinkedFunctionExecutable.h> +#include <runtime/Identifier.h> +#include <runtime/JSFunction.h> + +namespace JSC { +class FunctionExecutable; +} + +namespace WebCore { + +/* xmlCasingTest */ +extern const char* s_xmlCasingTestXMLCasingTestCode; +extern const int s_xmlCasingTestXMLCasingTestCodeLength; +extern const JSC::ConstructAbility s_xmlCasingTestXMLCasingTestCodeConstructAbility; +extern const char* s_xmlCasingTestCssCasingTestCode; +extern const int s_xmlCasingTestCssCasingTestCodeLength; +extern const JSC::ConstructAbility s_xmlCasingTestCssCasingTestCodeConstructAbility; +extern const char* s_xmlCasingTestUrlCasingTestCode; +extern const int s_xmlCasingTestUrlCasingTestCodeLength; +extern const JSC::ConstructAbility s_xmlCasingTestUrlCasingTestCodeConstructAbility; + +#define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_DATA(macro) \ + macro(xmlCasingTest, xmlCasingTestXMLCasingTest, 1) \ + macro(cssCasingTest, xmlCasingTestCssCasingTest, 2) \ + macro(urlCasingTest, xmlCasingTestUrlCasingTest, 3) \ + +#define WEBCORE_BUILTIN_XMLCASINGTEST_XMLCASINGTEST 1 +#define WEBCORE_BUILTIN_XMLCASINGTEST_CSSCASINGTEST 1 +#define WEBCORE_BUILTIN_XMLCASINGTEST_URLCASINGTEST 1 + +#define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(macro) \ + macro(xmlCasingTestXMLCasingTestCode, xmlCasingTest, s_xmlCasingTestXMLCasingTestCodeLength) \ + macro(xmlCasingTestCssCasingTestCode, cssCasingTest, s_xmlCasingTestCssCasingTestCodeLength) \ + macro(xmlCasingTestUrlCasingTestCode, urlCasingTest, s_xmlCasingTestUrlCasingTestCodeLength) \ + +#define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(macro) \ + macro(cssCasingTest) \ + macro(urlCasingTest) \ + macro(xmlCasingTest) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +class xmlCasingTestBuiltinsWrapper : private JSC::WeakHandleOwner { +public: + explicit xmlCasingTestBuiltinsWrapper(JSC::VM* vm) + : m_vm(*vm) + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) +#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length))) + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) +#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS + { + } + +#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \ + JSC::UnlinkedFunctionExecutable* name##Executable(); \ + const JSC::SourceCode& name##Source() const { return m_##name##Source; } + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) +#undef EXPOSE_BUILTIN_EXECUTABLES + + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) + + void exportNames(); + +private: + JSC::VM& m_vm; + + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) + +#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \ + JSC::SourceCode m_##name##Source;\ + JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS + +}; + +#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \ +inline JSC::UnlinkedFunctionExecutable* xmlCasingTestBuiltinsWrapper::name##Executable() \ +{\ + if (!m_##name##Executable)\ + m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ + return m_##name##Executable.get();\ +} +WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) +#undef DEFINE_BUILTIN_EXECUTABLES + +inline void xmlCasingTestBuiltinsWrapper::exportNames() +{ +#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) +#undef EXPORT_FUNCTION_NAME +} + +class xmlCasingTestBuiltinFunctions { +public: + explicit xmlCasingTestBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } + + void init(JSC::JSGlobalObject&); + void visit(JSC::SlotVisitor&); + +public: + JSC::VM& m_vm; + +#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ + JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function; + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS +}; + +inline void xmlCasingTestBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) +{ +#define EXPORT_FUNCTION(codeName, functionName, length)\ + m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject)); + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(EXPORT_FUNCTION) +#undef EXPORT_FUNCTION +} + +inline void xmlCasingTestBuiltinFunctions::visit(JSC::SlotVisitor& visitor) +{ +#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function); + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) +#undef VISIT_FUNCTION +} + + +} // namespace WebCore + +#endif // ENABLE(STREAMS_API) + +#endif // xmlCasingTestBuiltins_h + +### End File: xmlCasingTestBuiltins.h + +### Begin File: xmlCasingTestBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "xmlCasingTestBuiltins.h" + +#if ENABLE(STREAMS_API) + +#include "WebCoreJSClientData.h" +#include <runtime/Executable.h> +#include <runtime/JSCJSValueInlines.h> +#include <runtime/JSCellInlines.h> +#include <runtime/StructureInlines.h> +#include <runtime/VM.h> + +namespace WebCore { + +const JSC::ConstructAbility s_xmlCasingTestXMLCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_xmlCasingTestXMLCasingTestCodeLength = 71; +const char* s_xmlCasingTestXMLCasingTestCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " return !!stream.@reader;\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_xmlCasingTestCssCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_xmlCasingTestCssCasingTestCodeLength = 402; +const char* s_xmlCasingTestCssCasingTestCode = + "(function (stream, reason)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " if (stream.@state === @readableStreamClosed)\n" \ + " return Promise.resolve();\n" \ + " if (stream.@state === @readableStreamErrored)\n" \ + " return Promise.reject(stream.@storedError);\n" \ + " stream.@queue = [];\n" \ + " @finishClosingReadableStream(stream);\n" \ + " return @promiseInvokeOrNoop(stream.@underlyingSource, \"cancel\", [reason]).then(function() { });\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_xmlCasingTestUrlCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_xmlCasingTestUrlCasingTestCodeLength = 338; +const char* s_xmlCasingTestUrlCasingTestCode = + "(function (object, key, args)\n" \ + "{\n" \ + " \"use strict\";\n" \ + "\n" \ + " try {\n" \ + " var method = object[key];\n" \ + " if (typeof method === \"undefined\")\n" \ + " return Promise.resolve();\n" \ + " var result = method.@apply(object, args);\n" \ + " return Promise.resolve(result);\n" \ + " }\n" \ + " catch(error) {\n" \ + " return Promise.reject(error);\n" \ + " }\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ + return clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Source()); \ +} +WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace WebCore + +#endif // ENABLE(STREAMS_API) + +### End File: xmlCasingTestBuiltins.cpp |