diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/Scripts/tests/builtins | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/Scripts/tests/builtins')
32 files changed, 3721 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-AnotherGuardedInternalBuiltin-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-AnotherGuardedInternalBuiltin-Separate.js new file mode 100644 index 000000000..c5fae3fe2 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-AnotherGuardedInternalBuiltin-Separate.js @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2016 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. + */ + +// @conditional=ENABLE(FETCH_API) +// @internal + +function letsFetch() +{ + "use strict"; + + return @fetchRequest(new @Request("yes")); +} 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..e95e0c2d5 --- /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(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_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..9bb21d603 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result @@ -0,0 +1,161 @@ +### Begin File: JSCBuiltins.h +/* + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * Copyright (c) 2016 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 + +#pragma once + +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 JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \ + +#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 +### End File: JSCBuiltins.h + +### Begin File: JSCBuiltins.cpp +/* + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * Copyright (c) 2016 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 "HeapInlines.h" +#include "Intrinsic.h" +#include "JSCellInlines.h" +#include "UnlinkedFunctionExecutable.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPromiseRejectPromiseCodeLength = 410; +static const JSC::Intrinsic s_builtinPromiseRejectPromiseCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinPromiseRejectPromiseCode = + "(function (promise, reason)\n" \ + "{\n" \ + " \"use strict\";\n" \ + " var reactions = promise.@promiseRejectReactions;\n" \ + " promise.@promiseResult = reason;\n" \ + " promise.@promiseFulfillReactions = undefined;\n" \ + " promise.@promiseRejectReactions = undefined;\n" \ + " promise.@promiseState = @promiseRejected;\n" \ + " @InspectorInstrumentation.promiseRejected(promise, reason, reactions);\n" \ + " @triggerPromiseReactions(reactions, reason);\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPromiseFulfillPromiseCodeLength = 409; +static const JSC::Intrinsic s_builtinPromiseFulfillPromiseCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinPromiseFulfillPromiseCode = + "(function (promise, value)\n" \ + "{\n" \ + " \"use strict\";\n" \ + " var reactions = promise.@promiseFulfillReactions;\n" \ + " promise.@promiseResult = value;\n" \ + " promise.@promiseFulfillReactions = undefined;\n" \ + " promise.@promiseRejectReactions = undefined;\n" \ + " promise.@promiseState = @promiseFulfilled;\n" \ + " @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);\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(), std::nullopt, s_##codeName##Intrinsic); } +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..87fdaee38 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result @@ -0,0 +1,160 @@ +### Begin File: BuiltinPromiseBuiltins.h +/* + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * Copyright (c) 2016 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 + +#pragma once + + + +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 +### End File: BuiltinPromiseBuiltins.h + +### Begin File: BuiltinPromiseBuiltins.cpp +/* + * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. + * Copyright (c) 2016 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 "BuiltinPromiseBuiltins.h" + +#include "BuiltinExecutables.h" +#include "HeapInlines.h" +#include "Intrinsic.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPromiseRejectPromiseCodeLength = 410; +static const JSC::Intrinsic s_builtinPromiseRejectPromiseCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinPromiseRejectPromiseCode = + "(function (promise, reason)\n" \ + "{\n" \ + " \"use strict\";\n" \ + " var reactions = promise.@promiseRejectReactions;\n" \ + " promise.@promiseResult = reason;\n" \ + " promise.@promiseFulfillReactions = undefined;\n" \ + " promise.@promiseRejectReactions = undefined;\n" \ + " promise.@promiseState = @promiseRejected;\n" \ + " @InspectorInstrumentation.promiseRejected(promise, reason, reactions);\n" \ + " @triggerPromiseReactions(reactions, reason);\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPromiseFulfillPromiseCodeLength = 409; +static const JSC::Intrinsic s_builtinPromiseFulfillPromiseCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinPromiseFulfillPromiseCode = + "(function (promise, value)\n" \ + "{\n" \ + " \"use strict\";\n" \ + " var reactions = promise.@promiseFulfillReactions;\n" \ + " promise.@promiseResult = value;\n" \ + " promise.@promiseFulfillReactions = undefined;\n" \ + " promise.@promiseRejectReactions = undefined;\n" \ + " promise.@promiseState = @promiseFulfilled;\n" \ + " @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);\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(), std::nullopt, s_##codeName##Intrinsic); } +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..6bf696fdd --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result @@ -0,0 +1,185 @@ +### Begin File: JSCBuiltins.h +/* + * Copyright (c) 2014, 2015, 2016 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 + +#pragma once + +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 JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \ + +#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 +### End File: JSCBuiltins.h + +### Begin File: JSCBuiltins.cpp +/* + * Copyright (c) 2014, 2015, 2016 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 "HeapInlines.h" +#include "Intrinsic.h" +#include "JSCellInlines.h" +#include "UnlinkedFunctionExecutable.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinPrototypeEveryCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPrototypeEveryCodeLength = 760; +static const JSC::Intrinsic s_builtinPrototypeEveryCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinPrototypeEveryCode = + "(function (callback )\n" \ + "{\n" \ + " \"use strict\";\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" \ + " 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 = 692; +static const JSC::Intrinsic s_builtinPrototypeForEachCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinPrototypeForEachCode = + "(function (callback )\n" \ + "{\n" \ + " \"use strict\";\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" \ + " 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(), std::nullopt, s_##codeName##Intrinsic); } +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..d0c8f26ef --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result @@ -0,0 +1,184 @@ +### Begin File: BuiltinPrototypeBuiltins.h +/* + * Copyright (c) 2014, 2015, 2016 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 + +#pragma once + + + +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 +### End File: BuiltinPrototypeBuiltins.h + +### Begin File: BuiltinPrototypeBuiltins.cpp +/* + * Copyright (c) 2014, 2015, 2016 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 "HeapInlines.h" +#include "Intrinsic.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinPrototypeEveryCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinPrototypeEveryCodeLength = 760; +static const JSC::Intrinsic s_builtinPrototypeEveryCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinPrototypeEveryCode = + "(function (callback )\n" \ + "{\n" \ + " \"use strict\";\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" \ + " 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 = 692; +static const JSC::Intrinsic s_builtinPrototypeForEachCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinPrototypeForEachCode = + "(function (callback )\n" \ + "{\n" \ + " \"use strict\";\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" \ + " 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(), std::nullopt, s_##codeName##Intrinsic); } +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..023a8298c --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result @@ -0,0 +1,198 @@ +### Begin File: JSCBuiltins.h +/* + * Copyright (c) 2015, 2016 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 + +#pragma once + +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 JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \ + +#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 +### End File: JSCBuiltins.h + +### Begin File: JSCBuiltins.cpp +/* + * Copyright (c) 2015, 2016 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 "HeapInlines.h" +#include "Intrinsic.h" +#include "JSCellInlines.h" +#include "UnlinkedFunctionExecutable.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinConstructorOfCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinConstructorOfCodeLength = 286; +static const JSC::Intrinsic s_builtinConstructorOfCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinConstructorOfCode = + "(function ()\n" \ + "{\n" \ + " \"use strict\";\n" \ + " var length = arguments.length;\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 = 1979; +static const JSC::Intrinsic s_builtinConstructorFromCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinConstructorFromCode = + "(function (items )\n" \ + "{\n" \ + " \"use strict\";\n" \ + " var thisObj = this;\n" \ + " var mapFn = arguments.length > 1 ? arguments[1] : undefined;\n" \ + " var thisArg;\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" \ + " if (arguments.length > 2)\n" \ + " thisArg = arguments[2];\n" \ + " }\n" \ + " if (items == null)\n" \ + " throw new @TypeError(\"Array.from requires an array-like object - not null or undefined\");\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" \ + " var result = (typeof thisObj === \"function\") ? @Object(new thisObj()) : [];\n" \ + " var k = 0;\n" \ + " var iterator = iteratorMethod.@call(items);\n" \ + " var wrapper = {\n" \ + " [@symbolIterator]() {\n" \ + " return iterator;\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" \ + " result.length = k;\n" \ + " return result;\n" \ + " }\n" \ + " var arrayLike = @Object(items);\n" \ + " var arrayLikeLength = @toLength(arrayLike.length);\n" \ + " var result = (typeof thisObj === \"function\") ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength);\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" \ + " 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(), std::nullopt, s_##codeName##Intrinsic); } +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..8000b6963 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result @@ -0,0 +1,197 @@ +### Begin File: BuiltinConstructorBuiltins.h +/* + * Copyright (c) 2015, 2016 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 + +#pragma once + + + +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 +### End File: BuiltinConstructorBuiltins.h + +### Begin File: BuiltinConstructorBuiltins.cpp +/* + * Copyright (c) 2015, 2016 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 "HeapInlines.h" +#include "Intrinsic.h" +#include "JSCellInlines.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_builtinConstructorOfCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_builtinConstructorOfCodeLength = 286; +static const JSC::Intrinsic s_builtinConstructorOfCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinConstructorOfCode = + "(function ()\n" \ + "{\n" \ + " \"use strict\";\n" \ + " var length = arguments.length;\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 = 1979; +static const JSC::Intrinsic s_builtinConstructorFromCodeIntrinsic = JSC::NoIntrinsic; +const char* s_builtinConstructorFromCode = + "(function (items )\n" \ + "{\n" \ + " \"use strict\";\n" \ + " var thisObj = this;\n" \ + " var mapFn = arguments.length > 1 ? arguments[1] : undefined;\n" \ + " var thisArg;\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" \ + " if (arguments.length > 2)\n" \ + " thisArg = arguments[2];\n" \ + " }\n" \ + " if (items == null)\n" \ + " throw new @TypeError(\"Array.from requires an array-like object - not null or undefined\");\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" \ + " var result = (typeof thisObj === \"function\") ? @Object(new thisObj()) : [];\n" \ + " var k = 0;\n" \ + " var iterator = iteratorMethod.@call(items);\n" \ + " var wrapper = {\n" \ + " [@symbolIterator]() {\n" \ + " return iterator;\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" \ + " result.length = k;\n" \ + " return result;\n" \ + " }\n" \ + " var arrayLike = @Object(items);\n" \ + " var arrayLikeLength = @toLength(arrayLike.length);\n" \ + " var result = (typeof thisObj === \"function\") ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength);\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" \ + " 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(), std::nullopt, s_##codeName##Intrinsic); } +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..8cbb539be --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result @@ -0,0 +1,148 @@ +### Begin File: JSCBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 + +#pragma once + +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 JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \ + +#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 +### End File: JSCBuiltins.h + +### Begin File: JSCBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 "HeapInlines.h" +#include "Intrinsic.h" +#include "JSCellInlines.h" +#include "UnlinkedFunctionExecutable.h" +#include "VM.h" + +namespace JSC { + +const JSC::ConstructAbility s_internalClashingNamesIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_internalClashingNamesIsReadableStreamLockedCodeLength = 70; +static const JSC::Intrinsic s_internalClashingNamesIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; +const char* s_internalClashingNamesIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\n" \ + " return !!stream.@reader;\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_internalClashingNamesIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_internalClashingNamesIsReadableStreamLockedCodeLength = 70; +static const JSC::Intrinsic s_internalClashingNamesIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; +const char* s_internalClashingNamesIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\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(), std::nullopt, s_##codeName##Intrinsic); } +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-AnotherGuardedInternalBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result new file mode 100644 index 000000000..4ccc65c08 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result @@ -0,0 +1,227 @@ +### Begin File: AnotherGuardedInternalBuiltinBuiltins.h +/* + * Copyright (c) 2016 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 + +#pragma once + +#if ENABLE(FETCH_API) + +#include <builtins/BuiltinUtils.h> +#include <bytecode/UnlinkedFunctionExecutable.h> +#include <runtime/Identifier.h> +#include <runtime/JSFunction.h> + +namespace JSC { +class FunctionExecutable; +} + +namespace WebCore { + +/* AnotherGuardedInternalBuiltin */ +extern const char* s_anotherGuardedInternalBuiltinLetsFetchCode; +extern const int s_anotherGuardedInternalBuiltinLetsFetchCodeLength; +extern const JSC::ConstructAbility s_anotherGuardedInternalBuiltinLetsFetchCodeConstructAbility; + +#define WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_DATA(macro) \ + macro(letsFetch, anotherGuardedInternalBuiltinLetsFetch, 0) \ + +#define WEBCORE_BUILTIN_ANOTHERGUARDEDINTERNALBUILTIN_LETSFETCH 1 + +#define WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(macro) \ + macro(anotherGuardedInternalBuiltinLetsFetchCode, letsFetch, s_anotherGuardedInternalBuiltinLetsFetchCodeLength) \ + +#define WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(macro) \ + macro(letsFetch) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +class AnotherGuardedInternalBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner { +public: + explicit AnotherGuardedInternalBuiltinBuiltinsWrapper(JSC::VM* vm) + : m_vm(*vm) + WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_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_ANOTHERGUARDEDINTERNALBUILTIN_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_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) +#undef EXPOSE_BUILTIN_EXECUTABLES + + WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) + + void exportNames(); + +private: + JSC::VM& m_vm; + + WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_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_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS + +}; + +#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \ +inline JSC::UnlinkedFunctionExecutable* AnotherGuardedInternalBuiltinBuiltinsWrapper::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_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) +#undef DEFINE_BUILTIN_EXECUTABLES + +inline void AnotherGuardedInternalBuiltinBuiltinsWrapper::exportNames() +{ +#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); + WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) +#undef EXPORT_FUNCTION_NAME +} + +class AnotherGuardedInternalBuiltinBuiltinFunctions { +public: + explicit AnotherGuardedInternalBuiltinBuiltinFunctions(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_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS +}; + +inline void AnotherGuardedInternalBuiltinBuiltinFunctions::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_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION) +#undef EXPORT_FUNCTION +} + +inline void AnotherGuardedInternalBuiltinBuiltinFunctions::visit(JSC::SlotVisitor& visitor) +{ +#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); + WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) +#undef VISIT_FUNCTION +} + + +} // namespace WebCore + +#endif // ENABLE(FETCH_API) +### End File: AnotherGuardedInternalBuiltinBuiltins.h + +### Begin File: AnotherGuardedInternalBuiltinBuiltins.cpp +/* + * Copyright (c) 2016 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 "AnotherGuardedInternalBuiltinBuiltins.h" + +#if ENABLE(FETCH_API) + +#include "WebCoreJSClientData.h" +#include <heap/HeapInlines.h> +#include <runtime/Intrinsic.h> +#include <runtime/JSCJSValueInlines.h> +#include <runtime/JSCellInlines.h> +#include <runtime/StructureInlines.h> +#include <runtime/VM.h> + +namespace WebCore { + +const JSC::ConstructAbility s_anotherGuardedInternalBuiltinLetsFetchCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_anotherGuardedInternalBuiltinLetsFetchCodeLength = 82; +static const JSC::Intrinsic s_anotherGuardedInternalBuiltinLetsFetchCodeIntrinsic = JSC::NoIntrinsic; +const char* s_anotherGuardedInternalBuiltinLetsFetchCode = + "(function ()\n" \ + "{\n" \ + " \"use strict\";\n" \ + " return @fetchRequest(new @Request(\"yes\"));\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().anotherGuardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ +} +WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace WebCore + +#endif // ENABLE(FETCH_API) + +### End File: AnotherGuardedInternalBuiltinBuiltins.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..e626d670c --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result @@ -0,0 +1,197 @@ +### Begin File: ArbitraryConditionalGuardBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 + +#pragma once + +#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) +### End File: ArbitraryConditionalGuardBuiltins.h + +### Begin File: ArbitraryConditionalGuardBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 "ArbitraryConditionalGuardBuiltins.h" + +#if ENABLE(STREAMS_API) || USE(CF) + +#include "WebCoreJSClientData.h" +#include <heap/HeapInlines.h> +#include <runtime/Intrinsic.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 = 70; +static const JSC::Intrinsic s_arbitraryConditionalGuardIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; +const char* s_arbitraryConditionalGuardIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\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(), std::nullopt, s_##codeName##Intrinsic); \ +} +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..0747487c0 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result @@ -0,0 +1,197 @@ +### Begin File: GuardedBuiltinBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 + +#pragma once + +#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) +### End File: GuardedBuiltinBuiltins.h + +### Begin File: GuardedBuiltinBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 "GuardedBuiltinBuiltins.h" + +#if ENABLE(STREAMS_API) + +#include "WebCoreJSClientData.h" +#include <heap/HeapInlines.h> +#include <runtime/Intrinsic.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 = 70; +static const JSC::Intrinsic s_guardedBuiltinIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; +const char* s_guardedBuiltinIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\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(), std::nullopt, s_##codeName##Intrinsic); \ +} +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..9d83dee7c --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result @@ -0,0 +1,229 @@ +### Begin File: GuardedInternalBuiltinBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 + +#pragma once + +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_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(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) +### End File: GuardedInternalBuiltinBuiltins.h + +### Begin File: GuardedInternalBuiltinBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 "GuardedInternalBuiltinBuiltins.h" + +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + +#include "WebCoreJSClientData.h" +#include <heap/HeapInlines.h> +#include <runtime/Intrinsic.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 = 70; +static const JSC::Intrinsic s_guardedInternalBuiltinIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; +const char* s_guardedInternalBuiltinIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\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(), std::nullopt, s_##codeName##Intrinsic); \ +} +WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace WebCore + +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_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..0352b8cc7 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result @@ -0,0 +1,188 @@ +### Begin File: UnguardedBuiltinBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 + +#pragma once + +#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 +### End File: UnguardedBuiltinBuiltins.h + +### Begin File: UnguardedBuiltinBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 "UnguardedBuiltinBuiltins.h" + +#include "WebCoreJSClientData.h" +#include <heap/HeapInlines.h> +#include <runtime/Intrinsic.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 = 70; +static const JSC::Intrinsic s_unguardedBuiltinIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; +const char* s_unguardedBuiltinIsReadableStreamLockedCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\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(), std::nullopt, s_##codeName##Intrinsic); \ +} +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..7846ee870 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result @@ -0,0 +1,280 @@ +### Begin File: xmlCasingTestBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 + +#pragma once + +#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) +### End File: xmlCasingTestBuiltins.h + +### Begin File: xmlCasingTestBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 "xmlCasingTestBuiltins.h" + +#if ENABLE(STREAMS_API) + +#include "WebCoreJSClientData.h" +#include <heap/HeapInlines.h> +#include <runtime/Intrinsic.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 = 70; +static const JSC::Intrinsic s_xmlCasingTestXMLCasingTestCodeIntrinsic = JSC::NoIntrinsic; +const char* s_xmlCasingTestXMLCasingTestCode = + "(function (stream)\n" \ + "{\n" \ + " \"use strict\";\n" \ + " return !!stream.@reader;\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_xmlCasingTestCssCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const int s_xmlCasingTestCssCasingTestCodeLength = 401; +static const JSC::Intrinsic s_xmlCasingTestCssCasingTestCodeIntrinsic = JSC::NoIntrinsic; +const char* s_xmlCasingTestCssCasingTestCode = + "(function (stream, reason)\n" \ + "{\n" \ + " \"use strict\";\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 = 337; +static const JSC::Intrinsic s_xmlCasingTestUrlCasingTestCodeIntrinsic = JSC::NoIntrinsic; +const char* s_xmlCasingTestUrlCasingTestCode = + "(function (object, key, args)\n" \ + "{\n" \ + " \"use strict\";\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(), std::nullopt, s_##codeName##Intrinsic); \ +} +WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace WebCore + +#endif // ENABLE(STREAMS_API) + +### End File: xmlCasingTestBuiltins.cpp diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCoreJSBuiltins.h-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCoreJSBuiltins.h-result new file mode 100644 index 000000000..dab424432 --- /dev/null +++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCoreJSBuiltins.h-result @@ -0,0 +1,351 @@ +### Begin File: WebCoreJSBuiltins.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 + +#pragma once + +#include "AnotherGuardedInternalBuiltinBuiltins.h" +#include "ArbitraryConditionalGuardBuiltins.h" +#include "GuardedBuiltinBuiltins.h" +#include "GuardedInternalBuiltinBuiltins.h" +#include "UnguardedBuiltinBuiltins.h" +#include "xmlCasingTestBuiltins.h" +#include <runtime/VM.h> + +namespace WebCore { + +class JSBuiltinFunctions { +public: + explicit JSBuiltinFunctions(JSC::VM& vm) + : m_vm(vm) +#if ENABLE(FETCH_API) + , m_anotherGuardedInternalBuiltinBuiltins(&m_vm) +#endif // ENABLE(FETCH_API) +#if ENABLE(STREAMS_API) || USE(CF) + , m_arbitraryConditionalGuardBuiltins(&m_vm) +#endif // ENABLE(STREAMS_API) || USE(CF) +#if ENABLE(STREAMS_API) + , m_guardedBuiltinBuiltins(&m_vm) +#endif // ENABLE(STREAMS_API) +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + , m_guardedInternalBuiltinBuiltins(&m_vm) +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + , m_unguardedBuiltinBuiltins(&m_vm) +#if ENABLE(STREAMS_API) + , m_xmlCasingTestBuiltins(&m_vm) +#endif // ENABLE(STREAMS_API) + { +#if ENABLE(FETCH_API) + m_anotherGuardedInternalBuiltinBuiltins.exportNames(); +#endif // ENABLE(FETCH_API) +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + m_guardedInternalBuiltinBuiltins.exportNames(); +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) +#if ENABLE(STREAMS_API) + m_xmlCasingTestBuiltins.exportNames(); +#endif // ENABLE(STREAMS_API) + } + +#if ENABLE(FETCH_API) + AnotherGuardedInternalBuiltinBuiltinsWrapper& anotherGuardedInternalBuiltinBuiltins() { return m_anotherGuardedInternalBuiltinBuiltins; } +#endif // ENABLE(FETCH_API) +#if ENABLE(STREAMS_API) || USE(CF) + ArbitraryConditionalGuardBuiltinsWrapper& arbitraryConditionalGuardBuiltins() { return m_arbitraryConditionalGuardBuiltins; } +#endif // ENABLE(STREAMS_API) || USE(CF) +#if ENABLE(STREAMS_API) + GuardedBuiltinBuiltinsWrapper& guardedBuiltinBuiltins() { return m_guardedBuiltinBuiltins; } +#endif // ENABLE(STREAMS_API) +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + GuardedInternalBuiltinBuiltinsWrapper& guardedInternalBuiltinBuiltins() { return m_guardedInternalBuiltinBuiltins; } +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + UnguardedBuiltinBuiltinsWrapper& unguardedBuiltinBuiltins() { return m_unguardedBuiltinBuiltins; } +#if ENABLE(STREAMS_API) + XMLCasingTestBuiltinsWrapper& xmlCasingTestBuiltins() { return m_xmlCasingTestBuiltins; } +#endif // ENABLE(STREAMS_API) + +private: + JSC::VM& m_vm; +#if ENABLE(FETCH_API) + AnotherGuardedInternalBuiltinBuiltinsWrapper m_anotherGuardedInternalBuiltinBuiltins; +#endif // ENABLE(FETCH_API) +#if ENABLE(STREAMS_API) || USE(CF) + ArbitraryConditionalGuardBuiltinsWrapper m_arbitraryConditionalGuardBuiltins; +#endif // ENABLE(STREAMS_API) || USE(CF) +#if ENABLE(STREAMS_API) + GuardedBuiltinBuiltinsWrapper m_guardedBuiltinBuiltins; +#endif // ENABLE(STREAMS_API) +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + GuardedInternalBuiltinBuiltinsWrapper m_guardedInternalBuiltinBuiltins; +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + UnguardedBuiltinBuiltinsWrapper m_unguardedBuiltinBuiltins; +#if ENABLE(STREAMS_API) + XMLCasingTestBuiltinsWrapper m_xmlCasingTestBuiltins; +#endif // ENABLE(STREAMS_API) +}; + +} // namespace WebCore +### End File: WebCoreJSBuiltins.h + +### Begin File: WebCoreJSBuiltins.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 "AnotherGuardedInternalBuiltinBuiltins.cpp" +#include "ArbitraryConditionalGuardBuiltins.cpp" +#include "GuardedBuiltinBuiltins.cpp" +#include "GuardedInternalBuiltinBuiltins.cpp" +#include "UnguardedBuiltinBuiltins.cpp" +#include "xmlCasingTestBuiltins.cpp" +### End File: WebCoreJSBuiltins.cpp + +### Begin File: WebCoreJSBuiltinInternals.h +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 + +#pragma once + +#include "AnotherGuardedInternalBuiltinBuiltins.h" +#include "GuardedInternalBuiltinBuiltins.h" +#include "xmlCasingTestBuiltins.h" +#include <heap/WeakInlines.h> +#include <runtime/VM.h> + +namespace WebCore { + +class JSDOMGlobalObject; + +class JSBuiltinInternalFunctions { +public: + explicit JSBuiltinInternalFunctions(JSC::VM&); + + void visit(JSC::SlotVisitor&); + void initialize(JSDOMGlobalObject&); + +#if ENABLE(FETCH_API) + AnotherGuardedInternalBuiltinBuiltinFunctions& anotherGuardedInternalBuiltin() { return m_anotherGuardedInternalBuiltin; } +#endif // ENABLE(FETCH_API) +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + GuardedInternalBuiltinBuiltinFunctions& guardedInternalBuiltin() { return m_guardedInternalBuiltin; } +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) +#if ENABLE(STREAMS_API) + XMLCasingTestBuiltinFunctions& xmlCasingTest() { return m_xmlCasingTest; } +#endif // ENABLE(STREAMS_API) + +private: +#if ENABLE(FETCH_API) || ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) || ENABLE(STREAMS_API) + JSC::VM& m_vm; +#endif // ENABLE(FETCH_API) || ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) || ENABLE(STREAMS_API) +#if ENABLE(FETCH_API) + AnotherGuardedInternalBuiltinBuiltinFunctions m_anotherGuardedInternalBuiltin; +#endif // ENABLE(FETCH_API) +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + GuardedInternalBuiltinBuiltinFunctions m_guardedInternalBuiltin; +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) +#if ENABLE(STREAMS_API) + XMLCasingTestBuiltinFunctions m_xmlCasingTest; +#endif // ENABLE(STREAMS_API) +}; + +} // namespace WebCore +### End File: WebCoreJSBuiltinInternals.h + +### Begin File: WebCoreJSBuiltinInternals.cpp +/* + * Copyright (c) 2015 Canon Inc. All rights reserved. + * Copyright (c) 2016 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 "WebCoreJSBuiltinInternals.h" + +#include "JSDOMGlobalObject.h" +#include "WebCoreJSClientData.h" +#include <heap/HeapInlines.h> +#include <heap/SlotVisitorInlines.h> +#include <runtime/JSCJSValueInlines.h> +#include <runtime/StructureInlines.h> + +namespace WebCore { + +JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) +#if ENABLE(FETCH_API) || ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) || ENABLE(STREAMS_API) + : m_vm(vm) +#endif // ENABLE(FETCH_API) || ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) || ENABLE(STREAMS_API) +#if ENABLE(FETCH_API) + , m_anotherGuardedInternalBuiltin(m_vm) +#endif // ENABLE(FETCH_API) +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + , m_guardedInternalBuiltin(m_vm) +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) +#if ENABLE(STREAMS_API) + , m_xmlCasingTest(m_vm) +#endif // ENABLE(STREAMS_API) +{ + UNUSED_PARAM(vm); +} + +void JSBuiltinInternalFunctions::visit(JSC::SlotVisitor& visitor) +{ +#if ENABLE(FETCH_API) + m_anotherGuardedInternalBuiltin.visit(visitor); +#endif // ENABLE(FETCH_API) +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + m_guardedInternalBuiltin.visit(visitor); +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) +#if ENABLE(STREAMS_API) + m_xmlCasingTest.visit(visitor); +#endif // ENABLE(STREAMS_API) + UNUSED_PARAM(visitor); +} + +void JSBuiltinInternalFunctions::initialize(JSDOMGlobalObject& globalObject) +{ + UNUSED_PARAM(globalObject); +#if ENABLE(FETCH_API) + m_anotherGuardedInternalBuiltin.init(globalObject); +#endif // ENABLE(FETCH_API) +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) + m_guardedInternalBuiltin.init(globalObject); +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) +#if ENABLE(STREAMS_API) + m_xmlCasingTest.init(globalObject); +#endif // ENABLE(STREAMS_API) + +#if ENABLE(FETCH_API) || ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) || ENABLE(STREAMS_API) + JSVMClientData& clientData = *static_cast<JSVMClientData*>(m_vm.clientData); + JSDOMGlobalObject::GlobalPropertyInfo staticGlobals[] = { +#if ENABLE(FETCH_API) +#define DECLARE_GLOBAL_STATIC(name) \ + JSDOMGlobalObject::GlobalPropertyInfo( \ + clientData.builtinFunctions().anotherGuardedInternalBuiltinBuiltins().name##PrivateName(), anotherGuardedInternalBuiltin().m_##name##Function.get() , JSC::DontDelete | JSC::ReadOnly), + WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC) +#undef DECLARE_GLOBAL_STATIC +#endif // ENABLE(FETCH_API) +#if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) +#define DECLARE_GLOBAL_STATIC(name) \ + JSDOMGlobalObject::GlobalPropertyInfo( \ + clientData.builtinFunctions().guardedInternalBuiltinBuiltins().name##PrivateName(), guardedInternalBuiltin().m_##name##Function.get() , JSC::DontDelete | JSC::ReadOnly), + WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC) +#undef DECLARE_GLOBAL_STATIC +#endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) +#if ENABLE(STREAMS_API) +#define DECLARE_GLOBAL_STATIC(name) \ + JSDOMGlobalObject::GlobalPropertyInfo( \ + clientData.builtinFunctions().xmlCasingTestBuiltins().name##PrivateName(), xmlCasingTest().m_##name##Function.get() , JSC::DontDelete | JSC::ReadOnly), + WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC) +#undef DECLARE_GLOBAL_STATIC +#endif // ENABLE(STREAMS_API) + }; + globalObject.addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals)); + UNUSED_PARAM(clientData); +#endif // ENABLE(FETCH_API) || ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API) || ENABLE(STREAMS_API) +} + +} // namespace WebCore +### End File: WebCoreJSBuiltinInternals.cpp |