summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/Scripts
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
commit881da28418d380042aa95a97f0cbd42560a64f7c (patch)
treea794dff3274695e99c651902dde93d934ea7a5af /Source/JavaScriptCore/Scripts
parent7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff)
parent0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff)
downloadqtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
Diffstat (limited to 'Source/JavaScriptCore/Scripts')
-rw-r--r--Source/JavaScriptCore/Scripts/UpdateContents.py48
-rw-r--r--Source/JavaScriptCore/Scripts/builtins/__init__.py3
-rw-r--r--Source/JavaScriptCore/Scripts/builtins/builtins.py11
-rw-r--r--Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py152
-rw-r--r--Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_implementation.py91
-rw-r--r--Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py199
-rw-r--r--Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_implementation.py106
-rw-r--r--Source/JavaScriptCore/Scripts/builtins/builtins_generator.py169
-rwxr-xr-xSource/JavaScriptCore/Scripts/builtins/builtins_model.py274
-rw-r--r--Source/JavaScriptCore/Scripts/builtins/builtins_templates.py216
-rw-r--r--Source/JavaScriptCore/Scripts/cssmin.py44
-rwxr-xr-xSource/JavaScriptCore/Scripts/generate-combined-inspector-json.py69
-rw-r--r--Source/JavaScriptCore/Scripts/generate-js-builtins.py161
-rwxr-xr-xSource/JavaScriptCore/Scripts/inline-and-minify-stylesheets-and-scripts.py81
-rw-r--r--Source/JavaScriptCore/Scripts/jsmin.py238
-rw-r--r--Source/JavaScriptCore/Scripts/lazywriter.py58
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Combined.js54
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Separate.js54
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js78
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js78
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Combined.js110
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Separate.js110
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-InternalClashingNames-Combined.js41
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/WebCore-ArbitraryConditionalGuard-Separate.js33
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateFlagAnnotation-Separate.js27
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateKeyValueAnnotation-Separate.js34
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js33
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js34
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js31
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/WebCore-xmlCasingTest-Separate.js65
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result163
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result165
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result187
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result189
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result219
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result221
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-error1
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result146
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Operations.Promise-Combined.js-result415
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result198
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateFlagAnnotation-Separate.js-error1
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateKeyValueAnnotation-Separate.js-error1
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result198
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result230
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result189
-rw-r--r--Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result281
-rw-r--r--Source/JavaScriptCore/Scripts/xxd.pl45
47 files changed, 5551 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/Scripts/UpdateContents.py b/Source/JavaScriptCore/Scripts/UpdateContents.py
new file mode 100644
index 000000000..776d46fb4
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/UpdateContents.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+
+# 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.
+# 3. Neither the name of Apple, Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+
+import sys
+import os
+
+assert(len(sys.argv) == 3)
+
+comp = sys.argv[1]
+filename = sys.argv[2]
+
+t = False
+
+if os.path.isfile(filename):
+ f = open(filename, 'r')
+ comparator = f.read()
+ f.close()
+ t = True
+
+if (not t or comp != comparator):
+ f = open(filename, 'w')
+ f.write(comp)
+ f.close()
diff --git a/Source/JavaScriptCore/Scripts/builtins/__init__.py b/Source/JavaScriptCore/Scripts/builtins/__init__.py
new file mode 100644
index 000000000..fdfcba981
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/builtins/__init__.py
@@ -0,0 +1,3 @@
+# Required for Python to search this directory for module files
+
+from builtins import *
diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins.py b/Source/JavaScriptCore/Scripts/builtins/builtins.py
new file mode 100644
index 000000000..9349eeef6
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/builtins/builtins.py
@@ -0,0 +1,11 @@
+# This file is used to simulate the builtins/ directory when generate-js-builtins.py
+# is run from JavaScriptCore framework's private headers directory, which is flattened.
+
+from builtins_model import *
+from builtins_templates import *
+
+from builtins_generator import *
+from builtins_generate_combined_header import *
+from builtins_generate_combined_implementation import *
+from builtins_generate_separate_header import *
+from builtins_generate_separate_implementation import *
diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py b/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py
new file mode 100644
index 000000000..891bd3cb4
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py
@@ -0,0 +1,152 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. 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.
+
+
+import logging
+import re
+import string
+from string import Template
+
+from builtins_generator import BuiltinsGenerator
+from builtins_templates import BuiltinsGeneratorTemplates as Templates
+
+log = logging.getLogger('global')
+
+
+class BuiltinsCombinedHeaderGenerator(BuiltinsGenerator):
+ def __init__(self, model):
+ BuiltinsGenerator.__init__(self, model)
+
+ def output_filename(self):
+ return "%sBuiltins.h" % self.model().framework.setting('namespace')
+
+ def generate_output(self):
+ args = {
+ 'namespace': self.model().framework.setting('namespace'),
+ 'headerGuard': self.output_filename().replace('.', '_'),
+ 'macroPrefix': self.model().framework.setting('macro_prefix'),
+ }
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(Templates.DoNotEditWarning).substitute(args))
+ sections.append(Template(Templates.HeaderIncludeGuardTop).substitute(args))
+ sections.append(self.generate_forward_declarations())
+ sections.append(Template(Templates.NamespaceTop).substitute(args))
+ for object in self.model().objects:
+ sections.append(self.generate_section_for_object(object))
+ sections.append(self.generate_section_for_code_table_macro())
+ sections.append(self.generate_section_for_code_name_macro())
+ sections.append(Template(Templates.CombinedHeaderStaticMacros).substitute(args))
+ sections.append(Template(Templates.NamespaceBottom).substitute(args))
+ sections.append(Template(Templates.HeaderIncludeGuardBottom).substitute(args))
+
+ return "\n\n".join(sections)
+
+ def generate_forward_declarations(self):
+ return """namespace JSC {
+class FunctionExecutable;
+class VM;
+
+enum class ConstructAbility : unsigned;
+}"""
+
+ def generate_section_for_object(self, object):
+ lines = []
+ lines.append('/* %s */' % object.object_name)
+ lines.extend(self.generate_externs_for_object(object))
+ lines.append("")
+ lines.extend(self.generate_macros_for_object(object))
+ return '\n'.join(lines)
+
+ def generate_externs_for_object(self, object):
+ lines = []
+
+ for function in object.functions:
+ function_args = {
+ 'codeName': BuiltinsGenerator.mangledNameForFunction(function) + 'Code',
+ }
+
+ lines.append("""extern const char* s_%(codeName)s;
+extern const int s_%(codeName)sLength;
+extern const JSC::ConstructAbility s_%(codeName)sConstructAbility;""" % function_args)
+
+ return lines
+
+ def generate_macros_for_object(self, object):
+ args = {
+ 'macroPrefix': self.model().framework.setting('macro_prefix'),
+ 'objectMacro': object.object_name.replace('.', '').upper(),
+ }
+
+ lines = []
+ lines.append("#define %(macroPrefix)s_FOREACH_%(objectMacro)s_BUILTIN_DATA(macro) \\" % args)
+ for function in object.functions:
+ function_args = {
+ 'funcName': function.function_name,
+ 'mangledName': BuiltinsGenerator.mangledNameForFunction(function),
+ 'paramCount': len(function.parameters),
+ }
+
+ lines.append(" macro(%(funcName)s, %(mangledName)s, %(paramCount)d) \\" % function_args)
+ return lines
+
+ def generate_section_for_code_table_macro(self):
+ args = {
+ 'macroPrefix': self.model().framework.setting('macro_prefix'),
+ }
+
+ lines = []
+ lines.append("#define %(macroPrefix)s_FOREACH_BUILTIN_CODE(macro) \\" % args)
+ for function in self.model().all_functions():
+ function_args = {
+ 'funcName': function.function_name,
+ 'codeName': BuiltinsGenerator.mangledNameForFunction(function) + 'Code',
+ }
+
+ lines.append(" macro(%(codeName)s, %(funcName)s, s_%(codeName)sLength) \\" % function_args)
+ return '\n'.join(lines)
+
+ def generate_section_for_code_name_macro(self):
+ args = {
+ 'macroPrefix': self.model().framework.setting('macro_prefix'),
+ }
+
+ internal_function_names = [function.function_name for function in self.model().all_internal_functions()]
+ if len(internal_function_names) != len(set(internal_function_names)):
+ log.error("There are several internal functions with the same name. Private identifiers may clash.")
+
+ lines = []
+ lines.append("#define %(macroPrefix)s_FOREACH_BUILTIN_FUNCTION_NAME(macro) \\" % args)
+ unique_names = list(set([function.function_name for function in self.model().all_functions()]))
+ unique_names.sort()
+ for function_name in unique_names:
+ function_args = {
+ 'funcName': function_name,
+ }
+
+ lines.append(" macro(%(funcName)s) \\" % function_args)
+ return '\n'.join(lines)
diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_implementation.py b/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_implementation.py
new file mode 100644
index 000000000..094434b64
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_implementation.py
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. 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.
+
+
+import logging
+import re
+import string
+from string import Template
+
+from builtins_generator import BuiltinsGenerator
+from builtins_model import Framework, Frameworks
+from builtins_templates import BuiltinsGeneratorTemplates as Templates
+
+log = logging.getLogger('global')
+
+
+class BuiltinsCombinedImplementationGenerator(BuiltinsGenerator):
+ def __init__(self, model):
+ BuiltinsGenerator.__init__(self, model)
+
+ def output_filename(self):
+ return "%sBuiltins.cpp" % self.model().framework.setting('namespace')
+
+ def generate_output(self):
+ args = {
+ 'namespace': self.model().framework.setting('namespace'),
+ 'macroPrefix': self.model().framework.setting('macro_prefix'),
+ }
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(Templates.DoNotEditWarning).substitute(args))
+ sections.append(self.generate_primary_header_includes())
+ sections.append(self.generate_secondary_header_includes())
+ sections.append(Template(Templates.NamespaceTop).substitute(args))
+ for function in self.model().all_functions():
+ sections.append(self.generate_embedded_code_string_section_for_function(function))
+ if self.model().framework is Frameworks.JavaScriptCore:
+ sections.append(Template(Templates.CombinedJSCImplementationStaticMacros).substitute(args))
+ elif self.model().framework is Frameworks.WebCore:
+ sections.append(Template(Templates.CombinedWebCoreImplementationStaticMacros).substitute(args))
+ sections.append(Template(Templates.NamespaceBottom).substitute(args))
+
+ return "\n\n".join(sections)
+
+ def generate_secondary_header_includes(self):
+ header_includes = [
+ (["JavaScriptCore"],
+ ("JavaScriptCore", "builtins/BuiltinExecutables.h"),
+ ),
+ (["JavaScriptCore", "WebCore"],
+ ("JavaScriptCore", "runtime/Executable.h"),
+ ),
+ (["JavaScriptCore", "WebCore"],
+ ("JavaScriptCore", "runtime/JSCellInlines.h"),
+ ),
+ (["WebCore"],
+ ("JavaScriptCore", "runtime/StructureInlines.h"),
+ ),
+ (["WebCore"],
+ ("JavaScriptCore", "runtime/JSCJSValueInlines.h"),
+ ),
+ (["JavaScriptCore", "WebCore"],
+ ("JavaScriptCore", "runtime/VM.h"),
+ ),
+ ]
+
+ return '\n'.join(self.generate_includes_from_entries(header_includes))
diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py b/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py
new file mode 100644
index 000000000..b72a94bfe
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py
@@ -0,0 +1,199 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. 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.
+
+
+import logging
+import re
+import string
+from string import Template
+
+from builtins_generator import BuiltinsGenerator
+from builtins_model import Frameworks
+from builtins_templates import BuiltinsGeneratorTemplates as Templates
+
+log = logging.getLogger('global')
+
+
+class BuiltinsSeparateHeaderGenerator(BuiltinsGenerator):
+ def __init__(self, model, object):
+ BuiltinsGenerator.__init__(self, model)
+ self.object = object
+
+ def output_filename(self):
+ return "%sBuiltins.h" % BuiltinsGenerator.mangledNameForObject(self.object)
+
+ def macro_prefix(self):
+ return self.model().framework.setting('macro_prefix')
+
+ def generate_output(self):
+ args = {
+ 'namespace': self.model().framework.setting('namespace'),
+ 'headerGuard': self.output_filename().replace('.', '_'),
+ 'macroPrefix': self.macro_prefix(),
+ 'objectName': self.object.object_name,
+ 'objectMacro': self.object.object_name.upper(),
+ }
+
+ conditional_guard = self.object.annotations.get('conditional')
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(Templates.DoNotEditWarning).substitute(args))
+ sections.append(Template(Templates.HeaderIncludeGuardTop).substitute(args))
+ if conditional_guard is not None:
+ sections.append("#if %s" % conditional_guard)
+ sections.append(self.generate_secondary_header_includes())
+ sections.append(self.generate_forward_declarations())
+ sections.append(Template(Templates.NamespaceTop).substitute(args))
+ sections.append(self.generate_section_for_object(self.object))
+ sections.append(self.generate_section_for_code_table_macro())
+ sections.append(self.generate_section_for_code_name_macro())
+ sections.append(Template(Templates.SeparateHeaderStaticMacros).substitute(args))
+ if self.model().framework is Frameworks.WebCore:
+ sections.append(Template(Templates.SeparateHeaderWrapperBoilerplate).substitute(args))
+ if self.object.annotations.get('internal'):
+ sections.append(Template(Templates.SeparateHeaderInternalFunctionsBoilerplate).substitute(args))
+ sections.append(Template(Templates.NamespaceBottom).substitute(args))
+ if conditional_guard is not None:
+ sections.append("#endif // %s" % conditional_guard)
+ sections.append(Template(Templates.HeaderIncludeGuardBottom).substitute(args))
+
+ return "\n\n".join(sections)
+
+ def generate_forward_declarations(self):
+ return """namespace JSC {
+class FunctionExecutable;
+}"""
+
+ def generate_secondary_header_includes(self):
+ header_includes = [
+ (["WebCore"],
+ ("JavaScriptCore", "bytecode/UnlinkedFunctionExecutable.h"),
+ ),
+
+ (["WebCore"],
+ ("JavaScriptCore", "builtins/BuiltinUtils.h"),
+ ),
+
+ (["WebCore"],
+ ("JavaScriptCore", "runtime/Identifier.h"),
+ ),
+
+ (["WebCore"],
+ ("JavaScriptCore", "runtime/JSFunction.h"),
+ ),
+ ]
+
+ return '\n'.join(self.generate_includes_from_entries(header_includes))
+
+ def generate_section_for_object(self, object):
+ lines = []
+ lines.append('/* %s */' % object.object_name)
+ lines.extend(self.generate_externs_for_object(object))
+ lines.append("")
+ lines.extend(self.generate_macros_for_object(object))
+ lines.append("")
+ lines.extend(self.generate_defines_for_object(object))
+ return '\n'.join(lines)
+
+ def generate_externs_for_object(self, object):
+ lines = []
+
+ for function in object.functions:
+ function_args = {
+ 'codeName': BuiltinsGenerator.mangledNameForFunction(function) + 'Code',
+ }
+
+ lines.append("""extern const char* s_%(codeName)s;
+extern const int s_%(codeName)sLength;
+extern const JSC::ConstructAbility s_%(codeName)sConstructAbility;""" % function_args)
+
+ return lines
+
+ def generate_macros_for_object(self, object):
+ args = {
+ 'macroPrefix': self.macro_prefix(),
+ 'objectMacro': object.object_name.replace('.', '_').upper(),
+ }
+
+ lines = []
+ lines.append("#define %(macroPrefix)s_FOREACH_%(objectMacro)s_BUILTIN_DATA(macro) \\" % args)
+ for function in object.functions:
+ function_args = {
+ 'funcName': function.function_name,
+ 'mangledName': BuiltinsGenerator.mangledNameForFunction(function),
+ 'paramCount': len(function.parameters),
+ }
+
+ lines.append(" macro(%(funcName)s, %(mangledName)s, %(paramCount)d) \\" % function_args)
+ return lines
+
+ def generate_defines_for_object(self, object):
+ lines = []
+ for function in object.functions:
+ args = {
+ 'macroPrefix': self.macro_prefix(),
+ 'objectMacro': object.object_name.replace('.', '_').upper(),
+ 'functionMacro': function.function_name.upper(),
+ }
+ lines.append("#define %(macroPrefix)s_BUILTIN_%(objectMacro)s_%(functionMacro)s 1" % args)
+
+ return lines
+
+ def generate_section_for_code_table_macro(self):
+ args = {
+ 'macroPrefix': self.model().framework.setting('macro_prefix'),
+ 'objectMacro': self.object.object_name.upper(),
+ }
+
+ lines = []
+ lines.append("#define %(macroPrefix)s_FOREACH_%(objectMacro)s_BUILTIN_CODE(macro) \\" % args)
+ for function in self.object.functions:
+ function_args = {
+ 'funcName': function.function_name,
+ 'codeName': BuiltinsGenerator.mangledNameForFunction(function) + 'Code',
+ }
+
+ lines.append(" macro(%(codeName)s, %(funcName)s, s_%(codeName)sLength) \\" % function_args)
+ return '\n'.join(lines)
+
+ def generate_section_for_code_name_macro(self):
+ args = {
+ 'macroPrefix': self.macro_prefix(),
+ 'objectMacro': self.object.object_name.upper(),
+ }
+
+ lines = []
+ lines.append("#define %(macroPrefix)s_FOREACH_%(objectMacro)s_BUILTIN_FUNCTION_NAME(macro) \\" % args)
+ unique_names = list(set([function.function_name for function in self.object.functions]))
+ unique_names.sort()
+ for function_name in unique_names:
+ function_args = {
+ 'funcName': function_name,
+ }
+
+ lines.append(" macro(%(funcName)s) \\" % function_args)
+ return '\n'.join(lines)
diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_implementation.py b/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_implementation.py
new file mode 100644
index 000000000..0443975da
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_implementation.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. 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.
+
+
+import logging
+import re
+import string
+from string import Template
+
+from builtins_generator import BuiltinsGenerator, WK_lcfirst
+from builtins_model import Framework, Frameworks
+from builtins_templates import BuiltinsGeneratorTemplates as Templates
+
+log = logging.getLogger('global')
+
+
+class BuiltinsSeparateImplementationGenerator(BuiltinsGenerator):
+ def __init__(self, model, object):
+ BuiltinsGenerator.__init__(self, model)
+ self.object = object
+
+ def output_filename(self):
+ return "%sBuiltins.cpp" % BuiltinsGenerator.mangledNameForObject(self.object)
+
+ def macro_prefix(self):
+ return self.model().framework.setting('macro_prefix')
+
+ def generate_output(self):
+ args = {
+ 'namespace': self.model().framework.setting('namespace'),
+ 'macroPrefix': self.macro_prefix(),
+ 'objectMacro': self.object.object_name.upper(),
+ 'objectNameLC': WK_lcfirst(self.object.object_name),
+ }
+
+ conditional_guard = self.object.annotations.get('conditional')
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(Templates.DoNotEditWarning).substitute(args))
+ sections.append(self.generate_primary_header_includes())
+ if conditional_guard is not None:
+ sections.append("#if %s" % conditional_guard)
+ sections.append(self.generate_secondary_header_includes())
+ sections.append(Template(Templates.NamespaceTop).substitute(args))
+ for function in self.object.functions:
+ sections.append(self.generate_embedded_code_string_section_for_function(function))
+ if self.model().framework is Frameworks.JavaScriptCore:
+ sections.append(Template(Templates.SeparateJSCImplementationStaticMacros).substitute(args))
+ elif self.model().framework is Frameworks.WebCore:
+ sections.append(Template(Templates.SeparateWebCoreImplementationStaticMacros).substitute(args))
+ sections.append(Template(Templates.NamespaceBottom).substitute(args))
+ if conditional_guard is not None:
+ sections.append("#endif // %s\n" % conditional_guard)
+
+ return "\n\n".join(sections)
+
+ def generate_secondary_header_includes(self):
+ header_includes = [
+ (["JavaScriptCore"],
+ ("JavaScriptCore", "builtins/BuiltinExecutables.h"),
+ ),
+ (["JavaScriptCore", "WebCore"],
+ ("JavaScriptCore", "runtime/Executable.h"),
+ ),
+ (["JavaScriptCore", "WebCore"],
+ ("JavaScriptCore", "runtime/JSCellInlines.h"),
+ ),
+ (["WebCore"],
+ ("JavaScriptCore", "runtime/StructureInlines.h"),
+ ),
+ (["WebCore"],
+ ("JavaScriptCore", "runtime/JSCJSValueInlines.h"),
+ ),
+ (["JavaScriptCore", "WebCore"],
+ ("JavaScriptCore", "runtime/VM.h"),
+ ),
+ (["WebCore"],
+ ("WebCore", "bindings/js/WebCoreJSClientData.h"),
+ ),
+ ]
+
+ return '\n'.join(self.generate_includes_from_entries(header_includes))
diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_generator.py b/Source/JavaScriptCore/Scripts/builtins/builtins_generator.py
new file mode 100644
index 000000000..21ac4c1d9
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/builtins/builtins_generator.py
@@ -0,0 +1,169 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. 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.
+
+import logging
+import os.path
+import re
+from string import Template
+import json
+
+from builtins_model import BuiltinFunction, BuiltinObject
+from builtins_templates import BuiltinsGeneratorTemplates as Templates
+
+log = logging.getLogger('global')
+
+# These match WK_lcfirst and WK_ucfirst defined in CodeGenerator.pm.
+def WK_lcfirst(str):
+ str = str[:1].lower() + str[1:]
+ str = str.replace('hTML', 'html')
+ str = str.replace('uRL', 'url')
+ str = str.replace('jS', 'js')
+ str = str.replace('xML', 'xml')
+ str = str.replace('xSLT', 'xslt')
+ str = str.replace('cSS', 'css')
+ str = str.replace('rTC', 'rtc')
+ return str
+
+def WK_ucfirst(str):
+ str = str[:1].upper() + str[1:]
+ str = str.replace('Xml', 'XML')
+ str = str.replace('Svg', 'SVG')
+ return str
+
+class BuiltinsGenerator:
+ def __init__(self, model):
+ self._model = model
+
+ def model(self):
+ return self._model
+
+ # These methods are overridden by subclasses.
+
+ def generate_output(self):
+ pass
+
+ def output_filename(self):
+ pass
+
+
+ # Shared code generation methods.
+ def generate_license(self):
+ raw_license = Template(Templates.LicenseText).substitute(None)
+ copyrights = self._model.copyrights()
+ copyrights.sort()
+
+ license_block = []
+ license_block.append("/*")
+ for copyright in copyrights:
+ license_block.append(" * Copyright (c) %s" % copyright)
+ if len(copyrights) > 0:
+ license_block.append(" * ")
+
+ for line in raw_license.split('\n'):
+ license_block.append(" * " + line)
+
+ license_block.append(" */")
+
+ return '\n'.join(license_block)
+
+ def generate_includes_from_entries(self, entries):
+ includes = set()
+ for entry in entries:
+ (allowed_framework_names, data) = entry
+ (framework_name, header_path) = data
+
+ if self.model().framework.name not in allowed_framework_names:
+ continue
+ if self.model().framework.name != framework_name:
+ includes.add("#include <%s>" % header_path)
+ else:
+ includes.add("#include \"%s\"" % os.path.basename(header_path))
+
+ return sorted(list(includes))
+
+ def generate_primary_header_includes(self):
+ name, _ = os.path.splitext(self.output_filename())
+ return '\n'.join([
+ "#include \"config.h\"",
+ "#include \"%s.h\"" % name,
+ ])
+
+ def generate_embedded_code_string_section_for_function(self, function):
+ text = function.function_source
+ # Wrap it in parens to avoid adding to global scope.
+ text = "(function " + text[text.index("("):] + ")"
+ embeddedSourceLength = len(text) + 1 # For extra \n.
+ # Lazy way to escape quotes, I think?
+ textLines = json.dumps(text)[1:-1].split("\\n")
+ # This looks scary because we need the JS source itself to have newlines.
+ embeddedSource = '\n'.join([' "%s\\n" \\' % line for line in textLines])
+
+ constructAbility = "CannotConstruct"
+ if function.is_constructor:
+ constructAbility = "CanConstruct"
+
+ args = {
+ 'codeName': BuiltinsGenerator.mangledNameForFunction(function) + 'Code',
+ 'embeddedSource': embeddedSource,
+ 'embeddedSourceLength': embeddedSourceLength,
+ 'canConstruct': constructAbility
+ }
+
+ lines = []
+ lines.append("const JSC::ConstructAbility s_%(codeName)sConstructAbility = JSC::ConstructAbility::%(canConstruct)s;" % args);
+ lines.append("const int s_%(codeName)sLength = %(embeddedSourceLength)d;" % args);
+ lines.append("const char* s_%(codeName)s =\n%(embeddedSource)s\n;" % args);
+ return '\n'.join(lines)
+
+ # Helper methods.
+
+ @staticmethod
+ def mangledNameForObject(object):
+ if not isinstance(object, BuiltinObject):
+ raise Exception("Invalid argument passed to mangledNameForObject()")
+
+ def toCamel(match):
+ str = match.group(0)
+ return str[1].upper()
+ return re.sub(r'\.[a-z]', toCamel, object.object_name, flags=re.IGNORECASE)
+
+
+ @staticmethod
+ def mangledNameForFunction(function):
+ if not isinstance(function, BuiltinFunction):
+ raise Exception("Invalid argument passed to mangledNameForFunction()")
+
+ function_name = WK_ucfirst(function.function_name)
+
+ def toCamel(match):
+ str = match.group(0)
+ return str[1].upper()
+ function_name = re.sub(r'\.[a-z]', toCamel, function_name, flags=re.IGNORECASE)
+ if function.is_constructor:
+ function_name = function_name + "Constructor"
+
+ object_name = BuiltinsGenerator.mangledNameForObject(function.object)
+ return WK_lcfirst(object_name + function_name)
diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_model.py b/Source/JavaScriptCore/Scripts/builtins/builtins_model.py
new file mode 100755
index 000000000..cdd5f9003
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/builtins/builtins_model.py
@@ -0,0 +1,274 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2015 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+import logging
+import re
+import os
+
+log = logging.getLogger('global')
+
+_FRAMEWORK_CONFIG_MAP = {
+ "JavaScriptCore": {
+ "macro_prefix": "JSC",
+ "namespace": "JSC",
+ },
+ "WebCore": {
+ "macro_prefix": "WEBCORE",
+ "namespace": "WebCore",
+ },
+}
+
+functionHeadRegExp = re.compile(r"(?:function|constructor)\s+\w+\s*\(.*?\)", re.MULTILINE | re.S)
+functionNameRegExp = re.compile(r"(?:function|constructor)\s+(\w+)\s*\(", re.MULTILINE | re.S)
+functionIsConstructorRegExp = re.compile(r"^constructor", re.MULTILINE | re.S)
+functionParameterFinder = re.compile(r"^(?:function|constructor)\s+(?:\w+)\s*\(((?:\s*\w+)?\s*(?:\s*,\s*\w+)*)?\s*\)", re.MULTILINE | re.S)
+
+multilineCommentRegExp = re.compile(r"\/\*.*?\*\/", re.MULTILINE | re.S)
+singleLineCommentRegExp = re.compile(r"\/\/.*?\n", re.MULTILINE | re.S)
+keyValueAnnotationCommentRegExp = re.compile(r"^\/\/ @(\w+)=([^=]+?)\n", re.MULTILINE | re.S)
+flagAnnotationCommentRegExp = re.compile(r"^\/\/ @(\w+)[^=]*?\n", re.MULTILINE | re.S)
+lineWithOnlySingleLineCommentRegExp = re.compile(r"^\s*\/\/\n", re.MULTILINE | re.S)
+lineWithTrailingSingleLineCommentRegExp = re.compile(r"\s*\/\/\n", re.MULTILINE | re.S)
+multipleEmptyLinesRegExp = re.compile(r"\n{2,}", re.MULTILINE | re.S)
+
+class ParseException(Exception):
+ pass
+
+
+class Framework:
+ def __init__(self, name):
+ self._settings = _FRAMEWORK_CONFIG_MAP[name]
+ self.name = name
+
+ def setting(self, key, default=''):
+ return self._settings.get(key, default)
+
+ @staticmethod
+ def fromString(frameworkString):
+ if frameworkString == "JavaScriptCore":
+ return Frameworks.JavaScriptCore
+
+ if frameworkString == "WebCore":
+ return Frameworks.WebCore
+
+ raise ParseException("Unknown framework: %s" % frameworkString)
+
+
+class Frameworks:
+ JavaScriptCore = Framework("JavaScriptCore")
+ WebCore = Framework("WebCore")
+
+
+class BuiltinObject:
+ def __init__(self, object_name, annotations, functions):
+ self.object_name = object_name
+ self.annotations = annotations
+ self.functions = functions
+ self.collection = None # Set by the owning BuiltinsCollection
+
+ for function in self.functions:
+ function.object = self
+
+
+class BuiltinFunction:
+ def __init__(self, function_name, function_source, is_constructor, parameters):
+ self.function_name = function_name
+ self.function_source = function_source
+ self.is_constructor = is_constructor
+ self.parameters = parameters
+ self.object = None # Set by the owning BuiltinObject
+
+ @staticmethod
+ def fromString(function_string):
+ function_source = multilineCommentRegExp.sub("", function_string)
+ if os.getenv("CONFIGURATION", "Debug").startswith("Debug"):
+ function_source = lineWithOnlySingleLineCommentRegExp.sub("", function_source)
+ function_source = lineWithTrailingSingleLineCommentRegExp.sub("\n", function_source)
+ function_source = multipleEmptyLinesRegExp.sub("\n", function_source)
+
+ function_name = functionNameRegExp.findall(function_source)[0]
+ is_constructor = functionIsConstructorRegExp.match(function_source) != None
+ parameters = [s.strip() for s in functionParameterFinder.findall(function_source)[0].split(',')]
+ if len(parameters[0]) == 0:
+ parameters = []
+
+ return BuiltinFunction(function_name, function_source, is_constructor, parameters)
+
+ def __str__(self):
+ interface = "%s(%s)" % (self.function_name, ', '.join(self.parameters))
+ if self.is_constructor:
+ interface = interface + " [Constructor]"
+
+ return interface
+
+
+class BuiltinsCollection:
+ def __init__(self, framework_name):
+ self._copyright_lines = set()
+ self.objects = []
+ self.framework = Framework.fromString(framework_name)
+ log.debug("Created new Builtins collection.")
+
+ def parse_builtins_file(self, filename, text):
+ log.debug("Parsing builtins file: %s" % filename)
+
+ parsed_copyrights = set(self._parse_copyright_lines(text))
+ self._copyright_lines = self._copyright_lines.union(parsed_copyrights)
+
+ log.debug("Found copyright lines:")
+ for line in self._copyright_lines:
+ log.debug(line)
+ log.debug("")
+
+ object_annotations = self._parse_annotations(text)
+
+ object_name, ext = os.path.splitext(os.path.basename(filename))
+ log.debug("Parsing object: %s" % object_name)
+
+ parsed_functions = self._parse_functions(text)
+ for function in parsed_functions:
+ function.object = object_name
+
+ log.debug("Parsed functions:")
+ for func in parsed_functions:
+ log.debug(func)
+ log.debug("")
+
+ new_object = BuiltinObject(object_name, object_annotations, parsed_functions)
+ new_object.collection = self
+ self.objects.append(new_object)
+
+ def copyrights(self):
+ owner_to_years = dict()
+ copyrightYearRegExp = re.compile(r"(\d{4})[, ]{0,2}")
+ ownerStartRegExp = re.compile(r"[^\d, ]")
+
+ # Returns deduplicated copyrights keyed on the owner.
+ for line in self._copyright_lines:
+ years = set(copyrightYearRegExp.findall(line))
+ ownerIndex = ownerStartRegExp.search(line).start()
+ owner = line[ownerIndex:]
+ log.debug("Found years: %s and owner: %s" % (years, owner))
+ if owner not in owner_to_years:
+ owner_to_years[owner] = set()
+
+ owner_to_years[owner] = owner_to_years[owner].union(years)
+
+ result = []
+
+ for owner, years in owner_to_years.items():
+ sorted_years = list(years)
+ sorted_years.sort()
+ result.append("%s %s" % (', '.join(sorted_years), owner))
+
+ return result
+
+ def all_functions(self):
+ result = []
+ for object in self.objects:
+ result.extend(object.functions)
+
+ result.sort()
+ return result
+
+ def all_internal_functions(self):
+ result = []
+ for object in [o for o in self.objects if 'internal' in o.annotations]:
+ result.extend(object.functions)
+
+ result.sort()
+ return result
+
+ # Private methods.
+
+ def _parse_copyright_lines(self, text):
+ licenseBlock = multilineCommentRegExp.findall(text)[0]
+ licenseBlock = licenseBlock[:licenseBlock.index("Redistribution")]
+
+ copyrightLines = []
+ for line in licenseBlock.split("\n"):
+ line = line.replace("/*", "")
+ line = line.replace("*/", "")
+ line = line.replace("*", "")
+ line = line.replace("Copyright", "")
+ line = line.replace("copyright", "")
+ line = line.replace("(C)", "")
+ line = line.replace("(c)", "")
+ line = line.strip()
+
+ if len(line) == 0:
+ continue
+
+ copyrightLines.append(line)
+
+ return copyrightLines
+
+ def _parse_annotations(self, text):
+ annotations = {}
+
+ for match in keyValueAnnotationCommentRegExp.finditer(text):
+ (key, value) = match.group(1, 2)
+ log.debug("Found annotation: '%s' => '%s'" % (key, value))
+ if key in annotations:
+ raise ParseException("Duplicate annotation found: %s" % key)
+
+ annotations[key] = value
+
+ for match in flagAnnotationCommentRegExp.finditer(text):
+ key = match.group(1)
+ log.debug("Found annotation: '%s' => 'TRUE'" % key)
+ if key in annotations:
+ raise ParseException("Duplicate annotation found: %s" % key)
+
+ annotations[key] = True
+
+ return annotations
+
+ def _parse_functions(self, text):
+ text = multilineCommentRegExp.sub("/**/", singleLineCommentRegExp.sub("//\n", text))
+
+ matches = [func for func in functionHeadRegExp.finditer(text)]
+ functionBounds = []
+ start = 0
+ end = 0
+ for match in matches:
+ start = match.start()
+ if start < end:
+ continue
+ end = match.end()
+ while text[end] != '{':
+ end = end + 1
+ depth = 1
+ end = end + 1
+ while depth > 0:
+ if text[end] == '{':
+ depth = depth + 1
+ elif text[end] == '}':
+ depth = depth - 1
+ end = end + 1
+ functionBounds.append((start, end))
+
+ functionStrings = [text[start:end].strip() for (start, end) in functionBounds]
+ return map(BuiltinFunction.fromString, functionStrings)
diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_templates.py b/Source/JavaScriptCore/Scripts/builtins/builtins_templates.py
new file mode 100644
index 000000000..67cdd5df7
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/builtins/builtins_templates.py
@@ -0,0 +1,216 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (C) 2015 Canon Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+# Builtins generator templates, which can be filled with string.Template.
+
+
+class BuiltinsGeneratorTemplates:
+
+ LicenseText = (
+ """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.
+""")
+
+ DoNotEditWarning = (
+ """// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py""")
+
+ HeaderIncludeGuardTop = (
+ """#ifndef ${headerGuard}
+#define ${headerGuard}""")
+
+ HeaderIncludeGuardBottom = (
+ """#endif // ${headerGuard}
+""")
+
+ NamespaceTop = (
+ """namespace ${namespace} {""")
+
+ NamespaceBottom = (
+ """} // namespace ${namespace}""")
+
+ CombinedHeaderStaticMacros = (
+ """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+${macroPrefix}_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR""")
+
+ SeparateHeaderStaticMacros = (
+ """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR""")
+
+ CombinedJSCImplementationStaticMacros = (
+ """
+#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()); \
+}
+${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+""")
+
+ SeparateJSCImplementationStaticMacros = (
+ """
+#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()); \
+}
+${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+""")
+
+ CombinedWebCoreImplementationStaticMacros = (
+ """
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
+{\\
+ JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \\
+ return clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Executable()->link(vm, clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Source()); \\
+}
+${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+""")
+
+ SeparateWebCoreImplementationStaticMacros = (
+ """
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
+{\\
+ JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \\
+ return clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Executable()->link(vm, clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Source()); \\
+}
+${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+""")
+
+ SeparateHeaderWrapperBoilerplate = (
+ """class ${objectName}BuiltinsWrapper : private JSC::WeakHandleOwner {
+public:
+ explicit ${objectName}BuiltinsWrapper(JSC::VM* vm)
+ : m_vm(*vm)
+ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
+#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length)))
+ ${macroPrefix}_FOREACH_${objectMacro}_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; }
+ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
+#undef EXPOSE_BUILTIN_EXECUTABLES
+
+ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
+
+ void exportNames();
+
+private:
+ JSC::VM& m_vm;
+
+ ${macroPrefix}_FOREACH_${objectMacro}_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;
+ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+
+};
+
+#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \\
+inline JSC::UnlinkedFunctionExecutable* ${objectName}BuiltinsWrapper::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();\\
+}
+${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
+#undef DEFINE_BUILTIN_EXECUTABLES
+
+inline void ${objectName}BuiltinsWrapper::exportNames()
+{
+#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
+ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
+#undef EXPORT_FUNCTION_NAME
+}""")
+
+ SeparateHeaderInternalFunctionsBoilerplate = (
+ """class ${objectName}BuiltinFunctions {
+public:
+ explicit ${objectName}BuiltinFunctions(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;
+ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+};
+
+inline void ${objectName}BuiltinFunctions::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));
+ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(EXPORT_FUNCTION)
+#undef EXPORT_FUNCTION
+}
+
+inline void ${objectName}BuiltinFunctions::visit(JSC::SlotVisitor& visitor)
+{
+#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
+ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
+#undef VISIT_FUNCTION
+}
+""")
diff --git a/Source/JavaScriptCore/Scripts/cssmin.py b/Source/JavaScriptCore/Scripts/cssmin.py
new file mode 100644
index 000000000..a0640eb28
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/cssmin.py
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+
+# Copyright (C) 2013 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.
+
+import re
+
+def cssminify(css):
+ rules = (
+ (r"\/\*.*?\*\/", ""), # delete comments
+ (r"\n", ""), # delete new lines
+ (r"\s+", " "), # change multiple spaces to one space
+ (r"\s?([;:{},+>])\s?", r"\1"), # delete space where it is not needed
+ (r";}", "}") # change ';}' to '}' because the semicolon is not needed
+ )
+
+ css = css.replace("\r\n", "\n")
+ for rule in rules:
+ css = re.compile(rule[0], re.MULTILINE | re.UNICODE | re.DOTALL).sub(rule[1], css)
+ return css
+
+if __name__ == "__main__":
+ import sys
+ sys.stdout.write(cssminify(sys.stdin.read()))
diff --git a/Source/JavaScriptCore/Scripts/generate-combined-inspector-json.py b/Source/JavaScriptCore/Scripts/generate-combined-inspector-json.py
new file mode 100755
index 000000000..53660318d
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/generate-combined-inspector-json.py
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+
+# Copyright (C) 2013 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.
+
+import glob
+import json
+import os
+import sys
+
+if len(sys.argv) < 2:
+ print("usage: %s [json files or directory of json files ...]" % os.path.basename(sys.argv[0]))
+ sys.exit(1)
+
+files = []
+for arg in sys.argv[1:]:
+ if not os.access(arg, os.F_OK):
+ raise Exception("File \"%s\" not found" % arg)
+ elif os.path.isdir(arg):
+ files.extend(glob.glob(os.path.join(arg, "*.json")))
+ else:
+ files.append(arg)
+files.sort()
+
+# To keep as close to the original JSON formatting as possible, just
+# dump each JSON input file unmodified into an array of "domains".
+# Validate each file is valid JSON and that there is a "domain" key.
+
+first = True
+print("{\"domains\":[")
+for file in files:
+ if first:
+ first = False
+ else:
+ print(",")
+
+ string = open(file).read()
+
+ try:
+ dictionary = json.loads(string)
+ if not "domain" in dictionary:
+ raise Exception("File \"%s\" does not contains a \"domain\" key." % file)
+ except ValueError:
+ sys.stderr.write("File \"%s\" does not contain valid JSON:\n" % file)
+ raise
+
+ print(string.rstrip())
+print("]}")
+
diff --git a/Source/JavaScriptCore/Scripts/generate-js-builtins.py b/Source/JavaScriptCore/Scripts/generate-js-builtins.py
new file mode 100644
index 000000000..554a72ccc
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/generate-js-builtins.py
@@ -0,0 +1,161 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. 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.
+
+# This script generates C++ bindings for JavaScript builtins.
+# Generators for individual files are located in the builtins/ directory.
+
+import fnmatch
+import logging
+import optparse
+import os
+
+logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.ERROR)
+log = logging.getLogger('global')
+
+from lazywriter import LazyFileWriter
+
+import builtins
+from builtins import *
+
+
+def generate_bindings_for_builtins_files(builtins_files=[],
+ output_path=None,
+ concatenate_output=False,
+ combined_output=False,
+ framework_name="",
+ force_output=False):
+
+ generators = []
+
+ model = BuiltinsCollection(framework_name=framework_name)
+
+ for filepath in builtins_files:
+ with open(filepath, "r") as file:
+ file_text = file.read()
+ file_name = os.path.basename(filepath)
+
+ # If this is a test file, then rewrite the filename to remove the
+ # test running options encoded into the filename.
+ if file_name.startswith(framework_name):
+ (_, object_name, _) = file_name.split('-')
+ file_name = object_name + '.js'
+ model.parse_builtins_file(file_name, file_text)
+
+ if combined_output:
+ log.debug("Using generator style: combined files for all builtins.")
+ generators.append(BuiltinsCombinedHeaderGenerator(model))
+ generators.append(BuiltinsCombinedImplementationGenerator(model))
+ else:
+ log.debug("Using generator style: single files for each builtin.")
+ for object in model.objects:
+ generators.append(BuiltinsSeparateHeaderGenerator(model, object))
+ generators.append(BuiltinsSeparateImplementationGenerator(model, object))
+
+ log.debug("")
+ log.debug("Generating bindings for builtins.")
+
+ test_result_file_contents = []
+
+ for generator in generators:
+ output_filepath = os.path.join(output_path, generator.output_filename())
+ log.debug("Generating output file: %s" % generator.output_filename())
+ output = generator.generate_output()
+
+ log.debug("---")
+ log.debug("\n" + output)
+ log.debug("---")
+ if concatenate_output:
+ test_result_file_contents.append('### Begin File: %s' % generator.output_filename())
+ test_result_file_contents.append(output)
+ test_result_file_contents.append('### End File: %s' % generator.output_filename())
+ test_result_file_contents.append('')
+ else:
+ log.debug("Writing file: %s" % output_filepath)
+ output_file = LazyFileWriter(output_filepath, force_output)
+ output_file.write(output)
+ output_file.close()
+
+ if concatenate_output:
+ filename = os.path.join(os.path.basename(builtins_files[0]) + '-result')
+ output_filepath = os.path.join(output_path, filename)
+ log.debug("Writing file: %s" % output_filepath)
+ output_file = LazyFileWriter(output_filepath, force_output)
+ output_file.write('\n'.join(test_result_file_contents))
+ output_file.close()
+
+if __name__ == '__main__':
+ allowed_framework_names = ['JavaScriptCore', 'WebCore']
+ cli_parser = optparse.OptionParser(usage="usage: %prog [options] Builtin1.js [, Builtin2.js, ...]")
+ cli_parser.add_option("-i", "--input-directory", help="If specified, generates builtins from all JavaScript files in the specified directory in addition to specific files passed as arguments.")
+ cli_parser.add_option("-o", "--output-directory", help="Directory where generated files should be written.")
+ cli_parser.add_option("--framework", type="choice", choices=allowed_framework_names, help="Destination framework for generated files.")
+ cli_parser.add_option("--force", action="store_true", help="Force output of generated scripts, even if nothing changed.")
+ cli_parser.add_option("--combined", action="store_true", help="Produce one .h/.cpp file instead of producing one per builtin object.")
+ cli_parser.add_option("-v", "--debug", action="store_true", help="Log extra output for debugging the generator itself.")
+ cli_parser.add_option("-t", "--test", action="store_true", help="Enable test mode.")
+
+ arg_options, arg_values = cli_parser.parse_args()
+ if len(arg_values) is 0 and not arg_options.input_directory:
+ raise ParseException("At least one input file or directory expected.")
+
+ if not arg_options.output_directory:
+ raise ParseException("Missing output directory.")
+
+ if arg_options.debug:
+ log.setLevel(logging.DEBUG)
+
+ input_filepaths = arg_values[:]
+ if arg_options.input_directory:
+ for filepath in os.listdir(arg_options.input_directory):
+ input_filepaths.append(os.path.join(arg_options.input_directory, filepath))
+
+ input_filepaths = filter(lambda name: fnmatch.fnmatch(name, '*.js'), input_filepaths)
+
+ options = {
+ 'output_path': arg_options.output_directory,
+ 'framework_name': arg_options.framework,
+ 'combined_output': arg_options.combined,
+ 'force_output': arg_options.force,
+ 'concatenate_output': arg_options.test,
+ }
+
+ log.debug("Generating code for builtins.")
+ log.debug("Parsed options:")
+ for option, value in options.items():
+ log.debug(" %s: %s" % (option, value))
+ log.debug("")
+ log.debug("Input files:")
+ for filepath in input_filepaths:
+ log.debug(" %s" % filepath)
+ log.debug("")
+
+ try:
+ generate_bindings_for_builtins_files(builtins_files=input_filepaths, **options)
+ except ParseException as e:
+ if arg_options.test:
+ log.error(e.message)
+ else:
+ raise # Force the build to fail.
diff --git a/Source/JavaScriptCore/Scripts/inline-and-minify-stylesheets-and-scripts.py b/Source/JavaScriptCore/Scripts/inline-and-minify-stylesheets-and-scripts.py
new file mode 100755
index 000000000..89200c84e
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/inline-and-minify-stylesheets-and-scripts.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2013 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.
+
+# This script inlines and minifies external stylesheets and scripts.
+# - <link href="..." rel="stylesheet"> => <style>...</style>
+# - <script src="..."> => <script>...</script>
+
+import cssmin
+import jsmin
+import os.path
+import re
+import sys
+
+
+def main(argv):
+
+ if len(argv) < 2:
+ print('usage: %s inputFile outputFile' % argv[0])
+ return 1
+
+ inputFileName = argv[1]
+ outputFileName = argv[2]
+ importsDir = os.path.dirname(inputFileName)
+
+ inputFile = open(inputFileName, 'r')
+ inputContent = inputFile.read()
+ inputFile.close()
+
+ def inline(match, minifier, prefix, postfix):
+ importFileName = match.group(1)
+ fullPath = os.path.join(importsDir, importFileName)
+ if not os.access(fullPath, os.F_OK):
+ raise Exception('File %s referenced in %s not found' % (importFileName, inputFileName))
+ importFile = open(fullPath, 'r')
+ importContent = minifier(importFile.read())
+ importFile.close()
+ return '%s%s%s' % (prefix, importContent, postfix)
+
+ def inlineStylesheet(match):
+ return inline(match, cssmin.cssminify, "<style>", "</style>")
+
+ def inlineScript(match):
+ return inline(match, jsmin.jsmin, "<script>", "</script>")
+
+ outputContent = re.sub(r'<link rel="stylesheet" href=[\'"]([^\'"]+)[\'"]>', inlineStylesheet, inputContent)
+ outputContent = re.sub(r'<script src=[\'"]([^\'"]+)[\'"]></script>', inlineScript, outputContent)
+
+ outputFile = open(outputFileName, 'w')
+ outputFile.write(outputContent)
+ outputFile.close()
+
+ # Touch output file directory to make sure that Xcode will copy
+ # modified resource files.
+ if sys.platform == 'darwin':
+ outputDirName = os.path.dirname(outputFileName)
+ os.utime(outputDirName, None)
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/Source/JavaScriptCore/Scripts/jsmin.py b/Source/JavaScriptCore/Scripts/jsmin.py
new file mode 100644
index 000000000..372418b4d
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/jsmin.py
@@ -0,0 +1,238 @@
+# This code is original from jsmin by Douglas Crockford, it was translated to
+# Python by Baruch Even. It was rewritten by Dave St.Germain for speed.
+#
+# The MIT License (MIT)
+#
+# Copyright (c) 2013 Dave St.Germain
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+
+import sys
+is_3 = sys.version_info >= (3, 0)
+if is_3:
+ import io
+else:
+ import StringIO
+ try:
+ import cStringIO
+ except ImportError:
+ cStringIO = None
+
+
+__all__ = ['jsmin', 'JavascriptMinify']
+__version__ = '2.0.9'
+
+
+def jsmin(js):
+ """
+ returns a minified version of the javascript string
+ """
+ if not is_3:
+ if cStringIO and not isinstance(js, unicode):
+ # strings can use cStringIO for a 3x performance
+ # improvement, but unicode (in python2) cannot
+ klass = cStringIO.StringIO
+ else:
+ klass = StringIO.StringIO
+ else:
+ klass = io.StringIO
+ ins = klass(js)
+ outs = klass()
+ JavascriptMinify(ins, outs).minify()
+ return outs.getvalue()
+
+
+class JavascriptMinify(object):
+ """
+ Minify an input stream of javascript, writing
+ to an output stream
+ """
+
+ def __init__(self, instream=None, outstream=None):
+ self.ins = instream
+ self.outs = outstream
+
+ def minify(self, instream=None, outstream=None):
+ if instream and outstream:
+ self.ins, self.outs = instream, outstream
+
+ self.is_return = False
+ self.return_buf = ''
+
+ def write(char):
+ # all of this is to support literal regular expressions.
+ # sigh
+ if char in 'return':
+ self.return_buf += char
+ self.is_return = self.return_buf == 'return'
+ self.outs.write(char)
+ if self.is_return:
+ self.return_buf = ''
+
+ read = self.ins.read
+
+ space_strings = "abcdefghijklmnopqrstuvwxyz"\
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$\\"
+ starters, enders = '{[(+-', '}])+-"\''
+ newlinestart_strings = starters + space_strings
+ newlineend_strings = enders + space_strings
+ do_newline = False
+ do_space = False
+ escape_slash_count = 0
+ doing_single_comment = False
+ previous_before_comment = ''
+ doing_multi_comment = False
+ in_re = False
+ in_quote = ''
+ quote_buf = []
+
+ previous = read(1)
+ if previous == '\\':
+ escape_slash_count += 1
+ next1 = read(1)
+ if previous == '/':
+ if next1 == '/':
+ doing_single_comment = True
+ elif next1 == '*':
+ doing_multi_comment = True
+ previous = next1
+ next1 = read(1)
+ else:
+ write(previous)
+ elif not previous:
+ return
+ elif previous >= '!':
+ if previous in "'\"":
+ in_quote = previous
+ write(previous)
+ previous_non_space = previous
+ else:
+ previous_non_space = ' '
+ if not next1:
+ return
+
+ while 1:
+ next2 = read(1)
+ if not next2:
+ last = next1.strip()
+ if not (doing_single_comment or doing_multi_comment)\
+ and last not in ('', '/'):
+ if in_quote:
+ write(''.join(quote_buf))
+ write(last)
+ break
+ if doing_multi_comment:
+ if next1 == '*' and next2 == '/':
+ doing_multi_comment = False
+ next2 = read(1)
+ elif doing_single_comment:
+ if next1 in '\r\n':
+ doing_single_comment = False
+ while next2 in '\r\n':
+ next2 = read(1)
+ if not next2:
+ break
+ if previous_before_comment in ')}]':
+ do_newline = True
+ elif previous_before_comment in space_strings:
+ write('\n')
+ elif in_quote:
+ quote_buf.append(next1)
+
+ if next1 == in_quote:
+ numslashes = 0
+ for c in reversed(quote_buf[:-1]):
+ if c != '\\':
+ break
+ else:
+ numslashes += 1
+ if numslashes % 2 == 0:
+ in_quote = ''
+ write(''.join(quote_buf))
+ elif next1 in '\r\n':
+ if previous_non_space in newlineend_strings \
+ or previous_non_space > '~':
+ while 1:
+ if next2 < '!':
+ next2 = read(1)
+ if not next2:
+ break
+ else:
+ if next2 in newlinestart_strings \
+ or next2 > '~' or next2 == '/':
+ do_newline = True
+ break
+ elif next1 < '!' and not in_re:
+ if (previous_non_space in space_strings \
+ or previous_non_space > '~') \
+ and (next2 in space_strings or next2 > '~'):
+ do_space = True
+ elif previous_non_space in '-+' and next2 == previous_non_space:
+ # protect against + ++ or - -- sequences
+ do_space = True
+ elif self.is_return and next2 == '/':
+ # returning a regex...
+ write(' ')
+ elif next1 == '/':
+ if do_space:
+ write(' ')
+ if in_re:
+ if previous != '\\' or (not escape_slash_count % 2) or next2 in 'gimy':
+ in_re = False
+ write('/')
+ elif next2 == '/':
+ doing_single_comment = True
+ previous_before_comment = previous_non_space
+ elif next2 == '*':
+ doing_multi_comment = True
+ previous = next1
+ next1 = next2
+ next2 = read(1)
+ else:
+ in_re = previous_non_space in '(,=:[?!&|' or self.is_return # literal regular expression
+ write('/')
+ else:
+ if do_space:
+ do_space = False
+ write(' ')
+ if do_newline:
+ write('\n')
+ do_newline = False
+
+ write(next1)
+ if not in_re and next1 in "'\"`":
+ in_quote = next1
+ quote_buf = []
+
+ previous = next1
+ next1 = next2
+
+ if previous >= '!':
+ previous_non_space = previous
+
+ if previous == '\\':
+ escape_slash_count += 1
+ else:
+ escape_slash_count = 0
+
+if __name__ == '__main__':
+ minifier = JavascriptMinify(sys.stdin, sys.stdout)
+ minifier.minify()
+ sys.stdout.write('\n')
diff --git a/Source/JavaScriptCore/Scripts/lazywriter.py b/Source/JavaScriptCore/Scripts/lazywriter.py
new file mode 100644
index 000000000..f93a2c697
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/lazywriter.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2009 Google 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.
+
+# A writer that only updates file if it actually changed.
+
+
+class LazyFileWriter:
+ def __init__(self, filepath, force_output):
+ self._filepath = filepath
+ self._output = ""
+ self.force_output = force_output
+
+ def write(self, text):
+ self._output += text
+
+ def close(self):
+ text_changed = True
+ self._output = self._output.rstrip() + "\n"
+
+ try:
+ if self.force_output:
+ raise
+
+ read_file = open(self._filepath, "r")
+ old_text = read_file.read()
+ read_file.close()
+ text_changed = old_text != self._output
+ except:
+ # Ignore, just overwrite by default
+ pass
+
+ if text_changed or self.force_output:
+ out_file = open(self._filepath, "w")
+ out_file.write(self._output)
+ out_file.close()
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Combined.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Combined.js
new file mode 100644
index 000000000..b45d81ceb
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Combined.js
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function rejectPromise(promise, reason)
+{
+ "use strict";
+
+ var reactions = promise.@promiseRejectReactions;
+ promise.@promiseResult = reason;
+ promise.@promiseFulfillReactions = undefined;
+ promise.@promiseRejectReactions = undefined;
+ promise.@promiseState = @promiseRejected;
+
+ @InspectorInstrumentation.promiseRejected(promise, reason, reactions);
+
+ @triggerPromiseReactions(reactions, reason);
+}
+
+function fulfillPromise(promise, value)
+{
+ "use strict";
+
+ var reactions = promise.@promiseFulfillReactions;
+ promise.@promiseResult = value;
+ promise.@promiseFulfillReactions = undefined;
+ promise.@promiseRejectReactions = undefined;
+ promise.@promiseState = @promiseFulfilled;
+
+ @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);
+
+ @triggerPromiseReactions(reactions, value);
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Separate.js
new file mode 100644
index 000000000..b45d81ceb
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Separate.js
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function rejectPromise(promise, reason)
+{
+ "use strict";
+
+ var reactions = promise.@promiseRejectReactions;
+ promise.@promiseResult = reason;
+ promise.@promiseFulfillReactions = undefined;
+ promise.@promiseRejectReactions = undefined;
+ promise.@promiseState = @promiseRejected;
+
+ @InspectorInstrumentation.promiseRejected(promise, reason, reactions);
+
+ @triggerPromiseReactions(reactions, reason);
+}
+
+function fulfillPromise(promise, value)
+{
+ "use strict";
+
+ var reactions = promise.@promiseFulfillReactions;
+ promise.@promiseResult = value;
+ promise.@promiseFulfillReactions = undefined;
+ promise.@promiseRejectReactions = undefined;
+ promise.@promiseState = @promiseFulfilled;
+
+ @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);
+
+ @triggerPromiseReactions(reactions, value);
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js
new file mode 100644
index 000000000..5448b9832
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+function every(callback /*, thisArg */)
+{
+ "use strict";
+
+ if (this === null)
+ throw new @TypeError("Array.prototype.every requires that |this| not be null");
+
+ if (this === undefined)
+ throw new @TypeError("Array.prototype.every requires that |this| not be undefined");
+
+ var array = @Object(this);
+ var length = @toLength(array.length);
+
+ if (typeof callback !== "function")
+ throw new @TypeError("Array.prototype.every callback must be a function");
+
+ var thisArg = arguments.length > 1 ? arguments[1] : undefined;
+
+ for (var i = 0; i < length; i++) {
+ if (!(i in array))
+ continue;
+ if (!callback.@call(thisArg, array[i], i, array))
+ return false;
+ }
+
+ return true;
+}
+
+function forEach(callback /*, thisArg */)
+{
+ "use strict";
+
+ if (this === null)
+ throw new @TypeError("Array.prototype.forEach requires that |this| not be null");
+
+ if (this === undefined)
+ throw new @TypeError("Array.prototype.forEach requires that |this| not be undefined");
+
+ var array = @Object(this);
+ var length = @toLength(array.length);
+
+ if (typeof callback !== "function")
+ throw new @TypeError("Array.prototype.forEach callback must be a function");
+
+ var thisArg = arguments.length > 1 ? arguments[1] : undefined;
+
+ for (var i = 0; i < length; i++) {
+ if (i in array)
+ callback.@call(thisArg, array[i], i, array);
+ }
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js
new file mode 100644
index 000000000..5448b9832
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+function every(callback /*, thisArg */)
+{
+ "use strict";
+
+ if (this === null)
+ throw new @TypeError("Array.prototype.every requires that |this| not be null");
+
+ if (this === undefined)
+ throw new @TypeError("Array.prototype.every requires that |this| not be undefined");
+
+ var array = @Object(this);
+ var length = @toLength(array.length);
+
+ if (typeof callback !== "function")
+ throw new @TypeError("Array.prototype.every callback must be a function");
+
+ var thisArg = arguments.length > 1 ? arguments[1] : undefined;
+
+ for (var i = 0; i < length; i++) {
+ if (!(i in array))
+ continue;
+ if (!callback.@call(thisArg, array[i], i, array))
+ return false;
+ }
+
+ return true;
+}
+
+function forEach(callback /*, thisArg */)
+{
+ "use strict";
+
+ if (this === null)
+ throw new @TypeError("Array.prototype.forEach requires that |this| not be null");
+
+ if (this === undefined)
+ throw new @TypeError("Array.prototype.forEach requires that |this| not be undefined");
+
+ var array = @Object(this);
+ var length = @toLength(array.length);
+
+ if (typeof callback !== "function")
+ throw new @TypeError("Array.prototype.forEach callback must be a function");
+
+ var thisArg = arguments.length > 1 ? arguments[1] : undefined;
+
+ for (var i = 0; i < length; i++) {
+ if (i in array)
+ callback.@call(thisArg, array[i], i, array);
+ }
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Combined.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Combined.js
new file mode 100644
index 000000000..9e8c1b449
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Combined.js
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function of(/* items... */)
+{
+ "use strict";
+
+ var length = arguments.length;
+ // TODO: Need isConstructor(this) instead of typeof "function" check.
+ var array = typeof this === 'function' ? new this(length) : new @Array(length);
+ for (var k = 0; k < length; ++k)
+ @putByValDirect(array, k, arguments[k]);
+ array.length = length;
+ return array;
+}
+
+function from(items /*, mapFn, thisArg */)
+{
+ "use strict";
+
+ var thisObj = this;
+
+ var mapFn = arguments.length > 1 ? arguments[1] : undefined;
+
+ var thisArg;
+
+ if (mapFn !== undefined) {
+ if (typeof mapFn !== "function")
+ throw new @TypeError("Array.from requires that the second argument, when provided, be a function");
+
+ if (arguments.length > 2)
+ thisArg = arguments[2];
+ }
+
+ if (items == null)
+ throw new @TypeError("Array.from requires an array-like object - not null or undefined");
+
+ var iteratorMethod = items[@symbolIterator];
+ if (iteratorMethod != null) {
+ if (typeof iteratorMethod !== "function")
+ throw new @TypeError("Array.from requires that the property of the first argument, items[Symbol.iterator], when exists, be a function");
+
+ // TODO: Need isConstructor(thisObj) instead of typeof "function" check.
+ var result = (typeof thisObj === "function") ? @Object(new thisObj()) : [];
+
+ var k = 0;
+ var iterator = iteratorMethod.@call(items);
+
+ // Since for-of loop once more looks up the @@iterator property of a given iterable,
+ // it could be observable if the user defines a getter for @@iterator.
+ // To avoid this situation, we define a wrapper object that @@iterator just returns a given iterator.
+ var wrapper = {
+ [@symbolIterator]() {
+ return iterator;
+ }
+ };
+
+ for (var value of wrapper) {
+ if (mapFn)
+ @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));
+ else
+ @putByValDirect(result, k, value);
+ k += 1;
+ }
+
+ result.length = k;
+ return result;
+ }
+
+ var arrayLike = @Object(items);
+ var arrayLikeLength = @toLength(arrayLike.length);
+
+ // TODO: Need isConstructor(thisObj) instead of typeof "function" check.
+ var result = (typeof thisObj === "function") ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength);
+
+ var k = 0;
+ while (k < arrayLikeLength) {
+ var value = arrayLike[k];
+ if (mapFn)
+ @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));
+ else
+ @putByValDirect(result, k, value);
+ k += 1;
+ }
+
+ result.length = arrayLikeLength;
+ return result;
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Separate.js
new file mode 100644
index 000000000..9e8c1b449
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Separate.js
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function of(/* items... */)
+{
+ "use strict";
+
+ var length = arguments.length;
+ // TODO: Need isConstructor(this) instead of typeof "function" check.
+ var array = typeof this === 'function' ? new this(length) : new @Array(length);
+ for (var k = 0; k < length; ++k)
+ @putByValDirect(array, k, arguments[k]);
+ array.length = length;
+ return array;
+}
+
+function from(items /*, mapFn, thisArg */)
+{
+ "use strict";
+
+ var thisObj = this;
+
+ var mapFn = arguments.length > 1 ? arguments[1] : undefined;
+
+ var thisArg;
+
+ if (mapFn !== undefined) {
+ if (typeof mapFn !== "function")
+ throw new @TypeError("Array.from requires that the second argument, when provided, be a function");
+
+ if (arguments.length > 2)
+ thisArg = arguments[2];
+ }
+
+ if (items == null)
+ throw new @TypeError("Array.from requires an array-like object - not null or undefined");
+
+ var iteratorMethod = items[@symbolIterator];
+ if (iteratorMethod != null) {
+ if (typeof iteratorMethod !== "function")
+ throw new @TypeError("Array.from requires that the property of the first argument, items[Symbol.iterator], when exists, be a function");
+
+ // TODO: Need isConstructor(thisObj) instead of typeof "function" check.
+ var result = (typeof thisObj === "function") ? @Object(new thisObj()) : [];
+
+ var k = 0;
+ var iterator = iteratorMethod.@call(items);
+
+ // Since for-of loop once more looks up the @@iterator property of a given iterable,
+ // it could be observable if the user defines a getter for @@iterator.
+ // To avoid this situation, we define a wrapper object that @@iterator just returns a given iterator.
+ var wrapper = {
+ [@symbolIterator]() {
+ return iterator;
+ }
+ };
+
+ for (var value of wrapper) {
+ if (mapFn)
+ @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));
+ else
+ @putByValDirect(result, k, value);
+ k += 1;
+ }
+
+ result.length = k;
+ return result;
+ }
+
+ var arrayLike = @Object(items);
+ var arrayLikeLength = @toLength(arrayLike.length);
+
+ // TODO: Need isConstructor(thisObj) instead of typeof "function" check.
+ var result = (typeof thisObj === "function") ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength);
+
+ var k = 0;
+ while (k < arrayLikeLength) {
+ var value = arrayLike[k];
+ if (mapFn)
+ @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));
+ else
+ @putByValDirect(result, k, value);
+ k += 1;
+ }
+
+ result.length = arrayLikeLength;
+ return result;
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-InternalClashingNames-Combined.js b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-InternalClashingNames-Combined.js
new file mode 100644
index 000000000..0a436cf10
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-InternalClashingNames-Combined.js
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CANON INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// @internal
+
+function isReadableStreamLocked(stream)
+{
+ "use strict";
+
+ return !!stream.@reader;
+}
+
+// Testing clashing names (emulating function with same names in different files)
+function isReadableStreamLocked(stream)
+{
+ "use strict";
+
+ return !!stream.@reader;
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-ArbitraryConditionalGuard-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-ArbitraryConditionalGuard-Separate.js
new file mode 100644
index 000000000..c808b3c7f
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-ArbitraryConditionalGuard-Separate.js
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// @conditional=ENABLE(STREAMS_API) || USE(CF)
+
+function isReadableStreamLocked(stream)
+{
+ "use strict";
+
+ return !!stream.@reader;
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateFlagAnnotation-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateFlagAnnotation-Separate.js
new file mode 100644
index 000000000..73e7c71b9
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateFlagAnnotation-Separate.js
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// @internal
+// @internal
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateKeyValueAnnotation-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateKeyValueAnnotation-Separate.js
new file mode 100644
index 000000000..6d6fe604c
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateKeyValueAnnotation-Separate.js
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// @conditional=ENABLE(STREAMS_API)
+// @conditional=USE(CF)
+
+function isReadableStreamLocked(stream)
+{
+ "use strict";
+
+ return !!stream.@reader;
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js
new file mode 100644
index 000000000..2acec589d
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// @conditional=ENABLE(STREAMS_API)
+
+function isReadableStreamLocked(stream)
+{
+ "use strict";
+
+ return !!stream.@reader;
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js
new file mode 100644
index 000000000..80d53cd1a
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// @conditional=ENABLE(STREAMS_API)
+// @internal
+
+function isReadableStreamLocked(stream)
+{
+ "use strict";
+
+ return !!stream.@reader;
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js
new file mode 100644
index 000000000..9647f2bdd
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function isReadableStreamLocked(stream)
+{
+ "use strict";
+
+ return !!stream.@reader;
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-xmlCasingTest-Separate.js b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-xmlCasingTest-Separate.js
new file mode 100644
index 000000000..550c89e02
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/WebCore-xmlCasingTest-Separate.js
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// @conditional=ENABLE(STREAMS_API)
+// @internal
+
+function xmlCasingTest(stream)
+{
+ "use strict";
+
+ return !!stream.@reader;
+}
+
+
+function cssCasingTest(stream, reason)
+{
+ "use strict";
+
+ if (stream.@state === @readableStreamClosed)
+ return Promise.resolve();
+ if (stream.@state === @readableStreamErrored)
+ return Promise.reject(stream.@storedError);
+ stream.@queue = [];
+ @finishClosingReadableStream(stream);
+ return @promiseInvokeOrNoop(stream.@underlyingSource, "cancel", [reason]).then(function() { });
+}
+
+
+function urlCasingTest(object, key, args)
+{
+ "use strict";
+
+ try {
+ var method = object[key];
+ if (typeof method === "undefined")
+ return Promise.resolve();
+ var result = method.@apply(object, args);
+ return Promise.resolve(result);
+ }
+ catch(error) {
+ return Promise.reject(error);
+ }
+}
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result
new file mode 100644
index 000000000..dbd3e12ca
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result
@@ -0,0 +1,163 @@
+### Begin File: JSCBuiltins.h
+/*
+ * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef JSCBuiltins_h
+#define JSCBuiltins_h
+
+namespace JSC {
+class FunctionExecutable;
+class VM;
+
+enum class ConstructAbility : unsigned;
+}
+
+namespace JSC {
+
+/* Builtin.Promise */
+extern const char* s_builtinPromiseRejectPromiseCode;
+extern const int s_builtinPromiseRejectPromiseCodeLength;
+extern const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility;
+extern const char* s_builtinPromiseFulfillPromiseCode;
+extern const int s_builtinPromiseFulfillPromiseCodeLength;
+extern const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility;
+
+#define JSC_FOREACH_BUILTINPROMISE_BUILTIN_DATA(macro) \
+ macro(rejectPromise, builtinPromiseRejectPromise, 2) \
+ macro(fulfillPromise, builtinPromiseFulfillPromise, 2) \
+
+#define JSC_FOREACH_BUILTIN_CODE(macro) \
+ macro(builtinPromiseRejectPromiseCode, rejectPromise, s_builtinPromiseRejectPromiseCodeLength) \
+ macro(builtinPromiseFulfillPromiseCode, fulfillPromise, s_builtinPromiseFulfillPromiseCodeLength) \
+
+#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \
+ macro(fulfillPromise) \
+ macro(rejectPromise) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+} // namespace JSC
+
+#endif // JSCBuiltins_h
+
+### End File: JSCBuiltins.h
+
+### Begin File: JSCBuiltins.cpp
+/*
+ * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "JSCBuiltins.h"
+
+#include "BuiltinExecutables.h"
+#include "Executable.h"
+#include "JSCellInlines.h"
+#include "VM.h"
+
+namespace JSC {
+
+const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinPromiseRejectPromiseCodeLength = 413;
+const char* s_builtinPromiseRejectPromiseCode =
+ "(function (promise, reason)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var reactions = promise.@promiseRejectReactions;\n" \
+ " promise.@promiseResult = reason;\n" \
+ " promise.@promiseFulfillReactions = undefined;\n" \
+ " promise.@promiseRejectReactions = undefined;\n" \
+ " promise.@promiseState = @promiseRejected;\n" \
+ "\n" \
+ " @InspectorInstrumentation.promiseRejected(promise, reason, reactions);\n" \
+ "\n" \
+ " @triggerPromiseReactions(reactions, reason);\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinPromiseFulfillPromiseCodeLength = 412;
+const char* s_builtinPromiseFulfillPromiseCode =
+ "(function (promise, value)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var reactions = promise.@promiseFulfillReactions;\n" \
+ " promise.@promiseResult = value;\n" \
+ " promise.@promiseFulfillReactions = undefined;\n" \
+ " promise.@promiseRejectReactions = undefined;\n" \
+ " promise.@promiseState = @promiseFulfilled;\n" \
+ "\n" \
+ " @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);\n" \
+ "\n" \
+ " @triggerPromiseReactions(reactions, value);\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); }
+JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace JSC
+### End File: JSCBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result
new file mode 100644
index 000000000..1b1d5e1fb
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result
@@ -0,0 +1,165 @@
+### Begin File: BuiltinPromiseBuiltins.h
+/*
+ * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef BuiltinPromiseBuiltins_h
+#define BuiltinPromiseBuiltins_h
+
+
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace JSC {
+
+/* Builtin.Promise */
+extern const char* s_builtinPromiseRejectPromiseCode;
+extern const int s_builtinPromiseRejectPromiseCodeLength;
+extern const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility;
+extern const char* s_builtinPromiseFulfillPromiseCode;
+extern const int s_builtinPromiseFulfillPromiseCodeLength;
+extern const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility;
+
+#define JSC_FOREACH_BUILTIN_PROMISE_BUILTIN_DATA(macro) \
+ macro(rejectPromise, builtinPromiseRejectPromise, 2) \
+ macro(fulfillPromise, builtinPromiseFulfillPromise, 2) \
+
+#define JSC_BUILTIN_BUILTIN_PROMISE_REJECTPROMISE 1
+#define JSC_BUILTIN_BUILTIN_PROMISE_FULFILLPROMISE 1
+
+#define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(macro) \
+ macro(builtinPromiseRejectPromiseCode, rejectPromise, s_builtinPromiseRejectPromiseCodeLength) \
+ macro(builtinPromiseFulfillPromiseCode, fulfillPromise, s_builtinPromiseFulfillPromiseCodeLength) \
+
+#define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_FUNCTION_NAME(macro) \
+ macro(fulfillPromise) \
+ macro(rejectPromise) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+} // namespace JSC
+
+#endif // BuiltinPromiseBuiltins_h
+
+### End File: BuiltinPromiseBuiltins.h
+
+### Begin File: BuiltinPromiseBuiltins.cpp
+/*
+ * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "BuiltinPromiseBuiltins.h"
+
+#include "BuiltinExecutables.h"
+#include "Executable.h"
+#include "JSCellInlines.h"
+#include "VM.h"
+
+namespace JSC {
+
+const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinPromiseRejectPromiseCodeLength = 413;
+const char* s_builtinPromiseRejectPromiseCode =
+ "(function (promise, reason)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var reactions = promise.@promiseRejectReactions;\n" \
+ " promise.@promiseResult = reason;\n" \
+ " promise.@promiseFulfillReactions = undefined;\n" \
+ " promise.@promiseRejectReactions = undefined;\n" \
+ " promise.@promiseState = @promiseRejected;\n" \
+ "\n" \
+ " @InspectorInstrumentation.promiseRejected(promise, reason, reactions);\n" \
+ "\n" \
+ " @triggerPromiseReactions(reactions, reason);\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinPromiseFulfillPromiseCodeLength = 412;
+const char* s_builtinPromiseFulfillPromiseCode =
+ "(function (promise, value)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var reactions = promise.@promiseFulfillReactions;\n" \
+ " promise.@promiseResult = value;\n" \
+ " promise.@promiseFulfillReactions = undefined;\n" \
+ " promise.@promiseRejectReactions = undefined;\n" \
+ " promise.@promiseState = @promiseFulfilled;\n" \
+ "\n" \
+ " @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);\n" \
+ "\n" \
+ " @triggerPromiseReactions(reactions, value);\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); }
+JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace JSC
+### End File: BuiltinPromiseBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result
new file mode 100644
index 000000000..2bb4cbce7
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result
@@ -0,0 +1,187 @@
+### Begin File: JSCBuiltins.h
+/*
+ * Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef JSCBuiltins_h
+#define JSCBuiltins_h
+
+namespace JSC {
+class FunctionExecutable;
+class VM;
+
+enum class ConstructAbility : unsigned;
+}
+
+namespace JSC {
+
+/* Builtin.prototype */
+extern const char* s_builtinPrototypeEveryCode;
+extern const int s_builtinPrototypeEveryCodeLength;
+extern const JSC::ConstructAbility s_builtinPrototypeEveryCodeConstructAbility;
+extern const char* s_builtinPrototypeForEachCode;
+extern const int s_builtinPrototypeForEachCodeLength;
+extern const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility;
+
+#define JSC_FOREACH_BUILTINPROTOTYPE_BUILTIN_DATA(macro) \
+ macro(every, builtinPrototypeEvery, 1) \
+ macro(forEach, builtinPrototypeForEach, 1) \
+
+#define JSC_FOREACH_BUILTIN_CODE(macro) \
+ macro(builtinPrototypeEveryCode, every, s_builtinPrototypeEveryCodeLength) \
+ macro(builtinPrototypeForEachCode, forEach, s_builtinPrototypeForEachCodeLength) \
+
+#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \
+ macro(every) \
+ macro(forEach) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+} // namespace JSC
+
+#endif // JSCBuiltins_h
+
+### End File: JSCBuiltins.h
+
+### Begin File: JSCBuiltins.cpp
+/*
+ * Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "JSCBuiltins.h"
+
+#include "BuiltinExecutables.h"
+#include "Executable.h"
+#include "JSCellInlines.h"
+#include "VM.h"
+
+namespace JSC {
+
+const JSC::ConstructAbility s_builtinPrototypeEveryCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinPrototypeEveryCodeLength = 762;
+const char* s_builtinPrototypeEveryCode =
+ "(function (callback )\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " if (this === null)\n" \
+ " throw new @TypeError(\"Array.prototype.every requires that |this| not be null\");\n" \
+ " \n" \
+ " if (this === undefined)\n" \
+ " throw new @TypeError(\"Array.prototype.every requires that |this| not be undefined\");\n" \
+ " \n" \
+ " var array = @Object(this);\n" \
+ " var length = @toLength(array.length);\n" \
+ "\n" \
+ " if (typeof callback !== \"function\")\n" \
+ " throw new @TypeError(\"Array.prototype.every callback must be a function\");\n" \
+ " \n" \
+ " var thisArg = arguments.length > 1 ? arguments[1] : undefined;\n" \
+ " \n" \
+ " for (var i = 0; i < length; i++) {\n" \
+ " if (!(i in array))\n" \
+ " continue;\n" \
+ " if (!callback.@call(thisArg, array[i], i, array))\n" \
+ " return false;\n" \
+ " }\n" \
+ " \n" \
+ " return true;\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinPrototypeForEachCodeLength = 694;
+const char* s_builtinPrototypeForEachCode =
+ "(function (callback )\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " if (this === null)\n" \
+ " throw new @TypeError(\"Array.prototype.forEach requires that |this| not be null\");\n" \
+ " \n" \
+ " if (this === undefined)\n" \
+ " throw new @TypeError(\"Array.prototype.forEach requires that |this| not be undefined\");\n" \
+ " \n" \
+ " var array = @Object(this);\n" \
+ " var length = @toLength(array.length);\n" \
+ "\n" \
+ " if (typeof callback !== \"function\")\n" \
+ " throw new @TypeError(\"Array.prototype.forEach callback must be a function\");\n" \
+ " \n" \
+ " var thisArg = arguments.length > 1 ? arguments[1] : undefined;\n" \
+ " \n" \
+ " for (var i = 0; i < length; i++) {\n" \
+ " if (i in array)\n" \
+ " callback.@call(thisArg, array[i], i, array);\n" \
+ " }\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); }
+JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace JSC
+### End File: JSCBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result
new file mode 100644
index 000000000..315e00e8b
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result
@@ -0,0 +1,189 @@
+### Begin File: BuiltinPrototypeBuiltins.h
+/*
+ * Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef BuiltinPrototypeBuiltins_h
+#define BuiltinPrototypeBuiltins_h
+
+
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace JSC {
+
+/* Builtin.prototype */
+extern const char* s_builtinPrototypeEveryCode;
+extern const int s_builtinPrototypeEveryCodeLength;
+extern const JSC::ConstructAbility s_builtinPrototypeEveryCodeConstructAbility;
+extern const char* s_builtinPrototypeForEachCode;
+extern const int s_builtinPrototypeForEachCodeLength;
+extern const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility;
+
+#define JSC_FOREACH_BUILTIN_PROTOTYPE_BUILTIN_DATA(macro) \
+ macro(every, builtinPrototypeEvery, 1) \
+ macro(forEach, builtinPrototypeForEach, 1) \
+
+#define JSC_BUILTIN_BUILTIN_PROTOTYPE_EVERY 1
+#define JSC_BUILTIN_BUILTIN_PROTOTYPE_FOREACH 1
+
+#define JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_CODE(macro) \
+ macro(builtinPrototypeEveryCode, every, s_builtinPrototypeEveryCodeLength) \
+ macro(builtinPrototypeForEachCode, forEach, s_builtinPrototypeForEachCodeLength) \
+
+#define JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_FUNCTION_NAME(macro) \
+ macro(every) \
+ macro(forEach) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+} // namespace JSC
+
+#endif // BuiltinPrototypeBuiltins_h
+
+### End File: BuiltinPrototypeBuiltins.h
+
+### Begin File: BuiltinPrototypeBuiltins.cpp
+/*
+ * Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "BuiltinPrototypeBuiltins.h"
+
+#include "BuiltinExecutables.h"
+#include "Executable.h"
+#include "JSCellInlines.h"
+#include "VM.h"
+
+namespace JSC {
+
+const JSC::ConstructAbility s_builtinPrototypeEveryCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinPrototypeEveryCodeLength = 762;
+const char* s_builtinPrototypeEveryCode =
+ "(function (callback )\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " if (this === null)\n" \
+ " throw new @TypeError(\"Array.prototype.every requires that |this| not be null\");\n" \
+ " \n" \
+ " if (this === undefined)\n" \
+ " throw new @TypeError(\"Array.prototype.every requires that |this| not be undefined\");\n" \
+ " \n" \
+ " var array = @Object(this);\n" \
+ " var length = @toLength(array.length);\n" \
+ "\n" \
+ " if (typeof callback !== \"function\")\n" \
+ " throw new @TypeError(\"Array.prototype.every callback must be a function\");\n" \
+ " \n" \
+ " var thisArg = arguments.length > 1 ? arguments[1] : undefined;\n" \
+ " \n" \
+ " for (var i = 0; i < length; i++) {\n" \
+ " if (!(i in array))\n" \
+ " continue;\n" \
+ " if (!callback.@call(thisArg, array[i], i, array))\n" \
+ " return false;\n" \
+ " }\n" \
+ " \n" \
+ " return true;\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinPrototypeForEachCodeLength = 694;
+const char* s_builtinPrototypeForEachCode =
+ "(function (callback )\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " if (this === null)\n" \
+ " throw new @TypeError(\"Array.prototype.forEach requires that |this| not be null\");\n" \
+ " \n" \
+ " if (this === undefined)\n" \
+ " throw new @TypeError(\"Array.prototype.forEach requires that |this| not be undefined\");\n" \
+ " \n" \
+ " var array = @Object(this);\n" \
+ " var length = @toLength(array.length);\n" \
+ "\n" \
+ " if (typeof callback !== \"function\")\n" \
+ " throw new @TypeError(\"Array.prototype.forEach callback must be a function\");\n" \
+ " \n" \
+ " var thisArg = arguments.length > 1 ? arguments[1] : undefined;\n" \
+ " \n" \
+ " for (var i = 0; i < length; i++) {\n" \
+ " if (i in array)\n" \
+ " callback.@call(thisArg, array[i], i, array);\n" \
+ " }\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); }
+JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace JSC
+### End File: BuiltinPrototypeBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result
new file mode 100644
index 000000000..0391de28d
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result
@@ -0,0 +1,219 @@
+### Begin File: JSCBuiltins.h
+/*
+ * Copyright (c) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef JSCBuiltins_h
+#define JSCBuiltins_h
+
+namespace JSC {
+class FunctionExecutable;
+class VM;
+
+enum class ConstructAbility : unsigned;
+}
+
+namespace JSC {
+
+/* BuiltinConstructor */
+extern const char* s_builtinConstructorOfCode;
+extern const int s_builtinConstructorOfCodeLength;
+extern const JSC::ConstructAbility s_builtinConstructorOfCodeConstructAbility;
+extern const char* s_builtinConstructorFromCode;
+extern const int s_builtinConstructorFromCodeLength;
+extern const JSC::ConstructAbility s_builtinConstructorFromCodeConstructAbility;
+
+#define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_DATA(macro) \
+ macro(of, builtinConstructorOf, 0) \
+ macro(from, builtinConstructorFrom, 1) \
+
+#define JSC_FOREACH_BUILTIN_CODE(macro) \
+ macro(builtinConstructorOfCode, of, s_builtinConstructorOfCodeLength) \
+ macro(builtinConstructorFromCode, from, s_builtinConstructorFromCodeLength) \
+
+#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \
+ macro(from) \
+ macro(of) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+} // namespace JSC
+
+#endif // JSCBuiltins_h
+
+### End File: JSCBuiltins.h
+
+### Begin File: JSCBuiltins.cpp
+/*
+ * Copyright (c) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "JSCBuiltins.h"
+
+#include "BuiltinExecutables.h"
+#include "Executable.h"
+#include "JSCellInlines.h"
+#include "VM.h"
+
+namespace JSC {
+
+const JSC::ConstructAbility s_builtinConstructorOfCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinConstructorOfCodeLength = 294;
+const char* s_builtinConstructorOfCode =
+ "(function ()\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var length = arguments.length;\n" \
+ " //\n" \
+ " var array = typeof this === 'function' ? new this(length) : new @Array(length);\n" \
+ " for (var k = 0; k < length; ++k)\n" \
+ " @putByValDirect(array, k, arguments[k]);\n" \
+ " array.length = length;\n" \
+ " return array;\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_builtinConstructorFromCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinConstructorFromCodeLength = 2046;
+const char* s_builtinConstructorFromCode =
+ "(function (items )\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var thisObj = this;\n" \
+ "\n" \
+ " var mapFn = arguments.length > 1 ? arguments[1] : undefined;\n" \
+ "\n" \
+ " var thisArg;\n" \
+ "\n" \
+ " if (mapFn !== undefined) {\n" \
+ " if (typeof mapFn !== \"function\")\n" \
+ " throw new @TypeError(\"Array.from requires that the second argument, when provided, be a function\");\n" \
+ "\n" \
+ " if (arguments.length > 2)\n" \
+ " thisArg = arguments[2];\n" \
+ " }\n" \
+ "\n" \
+ " if (items == null)\n" \
+ " throw new @TypeError(\"Array.from requires an array-like object - not null or undefined\");\n" \
+ "\n" \
+ " var iteratorMethod = items[@symbolIterator];\n" \
+ " if (iteratorMethod != null) {\n" \
+ " if (typeof iteratorMethod !== \"function\")\n" \
+ " throw new @TypeError(\"Array.from requires that the property of the first argument, items[Symbol.iterator], when exists, be a function\");\n" \
+ "\n" \
+ " //\n" \
+ " var result = (typeof thisObj === \"function\") ? @Object(new thisObj()) : [];\n" \
+ "\n" \
+ " var k = 0;\n" \
+ " var iterator = iteratorMethod.@call(items);\n" \
+ "\n" \
+ " //\n" \
+ " //\n" \
+ " //\n" \
+ " var wrapper = {\n" \
+ " [@symbolIterator]() {\n" \
+ " return iterator;\n" \
+ " }\n" \
+ " };\n" \
+ "\n" \
+ " for (var value of wrapper) {\n" \
+ " if (mapFn)\n" \
+ " @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));\n" \
+ " else\n" \
+ " @putByValDirect(result, k, value);\n" \
+ " k += 1;\n" \
+ " }\n" \
+ "\n" \
+ " result.length = k;\n" \
+ " return result;\n" \
+ " }\n" \
+ "\n" \
+ " var arrayLike = @Object(items);\n" \
+ " var arrayLikeLength = @toLength(arrayLike.length);\n" \
+ "\n" \
+ " //\n" \
+ " var result = (typeof thisObj === \"function\") ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength);\n" \
+ "\n" \
+ " var k = 0;\n" \
+ " while (k < arrayLikeLength) {\n" \
+ " var value = arrayLike[k];\n" \
+ " if (mapFn)\n" \
+ " @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));\n" \
+ " else\n" \
+ " @putByValDirect(result, k, value);\n" \
+ " k += 1;\n" \
+ " }\n" \
+ "\n" \
+ " result.length = arrayLikeLength;\n" \
+ " return result;\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); }
+JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace JSC
+### End File: JSCBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result
new file mode 100644
index 000000000..2d26e4934
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result
@@ -0,0 +1,221 @@
+### Begin File: BuiltinConstructorBuiltins.h
+/*
+ * Copyright (c) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef BuiltinConstructorBuiltins_h
+#define BuiltinConstructorBuiltins_h
+
+
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace JSC {
+
+/* BuiltinConstructor */
+extern const char* s_builtinConstructorOfCode;
+extern const int s_builtinConstructorOfCodeLength;
+extern const JSC::ConstructAbility s_builtinConstructorOfCodeConstructAbility;
+extern const char* s_builtinConstructorFromCode;
+extern const int s_builtinConstructorFromCodeLength;
+extern const JSC::ConstructAbility s_builtinConstructorFromCodeConstructAbility;
+
+#define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_DATA(macro) \
+ macro(of, builtinConstructorOf, 0) \
+ macro(from, builtinConstructorFrom, 1) \
+
+#define JSC_BUILTIN_BUILTINCONSTRUCTOR_OF 1
+#define JSC_BUILTIN_BUILTINCONSTRUCTOR_FROM 1
+
+#define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_CODE(macro) \
+ macro(builtinConstructorOfCode, of, s_builtinConstructorOfCodeLength) \
+ macro(builtinConstructorFromCode, from, s_builtinConstructorFromCodeLength) \
+
+#define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_FUNCTION_NAME(macro) \
+ macro(from) \
+ macro(of) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+} // namespace JSC
+
+#endif // BuiltinConstructorBuiltins_h
+
+### End File: BuiltinConstructorBuiltins.h
+
+### Begin File: BuiltinConstructorBuiltins.cpp
+/*
+ * Copyright (c) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "BuiltinConstructorBuiltins.h"
+
+#include "BuiltinExecutables.h"
+#include "Executable.h"
+#include "JSCellInlines.h"
+#include "VM.h"
+
+namespace JSC {
+
+const JSC::ConstructAbility s_builtinConstructorOfCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinConstructorOfCodeLength = 294;
+const char* s_builtinConstructorOfCode =
+ "(function ()\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var length = arguments.length;\n" \
+ " //\n" \
+ " var array = typeof this === 'function' ? new this(length) : new @Array(length);\n" \
+ " for (var k = 0; k < length; ++k)\n" \
+ " @putByValDirect(array, k, arguments[k]);\n" \
+ " array.length = length;\n" \
+ " return array;\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_builtinConstructorFromCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_builtinConstructorFromCodeLength = 2046;
+const char* s_builtinConstructorFromCode =
+ "(function (items )\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var thisObj = this;\n" \
+ "\n" \
+ " var mapFn = arguments.length > 1 ? arguments[1] : undefined;\n" \
+ "\n" \
+ " var thisArg;\n" \
+ "\n" \
+ " if (mapFn !== undefined) {\n" \
+ " if (typeof mapFn !== \"function\")\n" \
+ " throw new @TypeError(\"Array.from requires that the second argument, when provided, be a function\");\n" \
+ "\n" \
+ " if (arguments.length > 2)\n" \
+ " thisArg = arguments[2];\n" \
+ " }\n" \
+ "\n" \
+ " if (items == null)\n" \
+ " throw new @TypeError(\"Array.from requires an array-like object - not null or undefined\");\n" \
+ "\n" \
+ " var iteratorMethod = items[@symbolIterator];\n" \
+ " if (iteratorMethod != null) {\n" \
+ " if (typeof iteratorMethod !== \"function\")\n" \
+ " throw new @TypeError(\"Array.from requires that the property of the first argument, items[Symbol.iterator], when exists, be a function\");\n" \
+ "\n" \
+ " //\n" \
+ " var result = (typeof thisObj === \"function\") ? @Object(new thisObj()) : [];\n" \
+ "\n" \
+ " var k = 0;\n" \
+ " var iterator = iteratorMethod.@call(items);\n" \
+ "\n" \
+ " //\n" \
+ " //\n" \
+ " //\n" \
+ " var wrapper = {\n" \
+ " [@symbolIterator]() {\n" \
+ " return iterator;\n" \
+ " }\n" \
+ " };\n" \
+ "\n" \
+ " for (var value of wrapper) {\n" \
+ " if (mapFn)\n" \
+ " @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));\n" \
+ " else\n" \
+ " @putByValDirect(result, k, value);\n" \
+ " k += 1;\n" \
+ " }\n" \
+ "\n" \
+ " result.length = k;\n" \
+ " return result;\n" \
+ " }\n" \
+ "\n" \
+ " var arrayLike = @Object(items);\n" \
+ " var arrayLikeLength = @toLength(arrayLike.length);\n" \
+ "\n" \
+ " //\n" \
+ " var result = (typeof thisObj === \"function\") ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength);\n" \
+ "\n" \
+ " var k = 0;\n" \
+ " while (k < arrayLikeLength) {\n" \
+ " var value = arrayLike[k];\n" \
+ " if (mapFn)\n" \
+ " @putByValDirect(result, k, thisArg === undefined ? mapFn(value, k) : mapFn.@call(thisArg, value, k));\n" \
+ " else\n" \
+ " @putByValDirect(result, k, value);\n" \
+ " k += 1;\n" \
+ " }\n" \
+ "\n" \
+ " result.length = arrayLikeLength;\n" \
+ " return result;\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); }
+JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace JSC
+### End File: BuiltinConstructorBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-error b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-error
new file mode 100644
index 000000000..eb147c40b
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-error
@@ -0,0 +1 @@
+ERROR: There are several internal functions with the same name. Private identifiers may clash.
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result
new file mode 100644
index 000000000..d569ac528
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result
@@ -0,0 +1,146 @@
+### Begin File: JSCBuiltins.h
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef JSCBuiltins_h
+#define JSCBuiltins_h
+
+namespace JSC {
+class FunctionExecutable;
+class VM;
+
+enum class ConstructAbility : unsigned;
+}
+
+namespace JSC {
+
+/* InternalClashingNames */
+extern const char* s_internalClashingNamesIsReadableStreamLockedCode;
+extern const int s_internalClashingNamesIsReadableStreamLockedCodeLength;
+extern const JSC::ConstructAbility s_internalClashingNamesIsReadableStreamLockedCodeConstructAbility;
+extern const char* s_internalClashingNamesIsReadableStreamLockedCode;
+extern const int s_internalClashingNamesIsReadableStreamLockedCodeLength;
+extern const JSC::ConstructAbility s_internalClashingNamesIsReadableStreamLockedCodeConstructAbility;
+
+#define JSC_FOREACH_INTERNALCLASHINGNAMES_BUILTIN_DATA(macro) \
+ macro(isReadableStreamLocked, internalClashingNamesIsReadableStreamLocked, 1) \
+ macro(isReadableStreamLocked, internalClashingNamesIsReadableStreamLocked, 1) \
+
+#define JSC_FOREACH_BUILTIN_CODE(macro) \
+ macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, s_internalClashingNamesIsReadableStreamLockedCodeLength) \
+ macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, s_internalClashingNamesIsReadableStreamLockedCodeLength) \
+
+#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \
+ macro(isReadableStreamLocked) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+} // namespace JSC
+
+#endif // JSCBuiltins_h
+
+### End File: JSCBuiltins.h
+
+### Begin File: JSCBuiltins.cpp
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "JSCBuiltins.h"
+
+#include "BuiltinExecutables.h"
+#include "Executable.h"
+#include "JSCellInlines.h"
+#include "VM.h"
+
+namespace JSC {
+
+const JSC::ConstructAbility s_internalClashingNamesIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_internalClashingNamesIsReadableStreamLockedCodeLength = 71;
+const char* s_internalClashingNamesIsReadableStreamLockedCode =
+ "(function (stream)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " return !!stream.@reader;\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_internalClashingNamesIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_internalClashingNamesIsReadableStreamLockedCodeLength = 71;
+const char* s_internalClashingNamesIsReadableStreamLockedCode =
+ "(function (stream)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " return !!stream.@reader;\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); }
+JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace JSC
+### End File: JSCBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Operations.Promise-Combined.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Operations.Promise-Combined.js-result
new file mode 100644
index 000000000..c1451111c
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Operations.Promise-Combined.js-result
@@ -0,0 +1,415 @@
+### Begin File: JSCBuiltins.h
+/*
+ * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef JSCBuiltins_h
+#define JSCBuiltins_h
+
+namespace JSC {
+class FunctionExecutable;
+class VM;
+
+enum class ConstructAbility : unsigned;
+}
+
+namespace JSC {
+
+/* Operations.Promise */
+extern const char* s_operationsPromiseIsPromiseCode;
+extern const int s_operationsPromiseIsPromiseCodeLength;
+extern const JSC::ConstructAbility s_operationsPromiseIsPromiseCodeConstructAbility;
+extern const char* s_operationsPromiseNewPromiseReactionCode;
+extern const int s_operationsPromiseNewPromiseReactionCodeLength;
+extern const JSC::ConstructAbility s_operationsPromiseNewPromiseReactionCodeConstructAbility;
+extern const char* s_operationsPromiseNewPromiseCapabilityCode;
+extern const int s_operationsPromiseNewPromiseCapabilityCodeLength;
+extern const JSC::ConstructAbility s_operationsPromiseNewPromiseCapabilityCodeConstructAbility;
+extern const char* s_operationsPromiseTriggerPromiseReactionsCode;
+extern const int s_operationsPromiseTriggerPromiseReactionsCodeLength;
+extern const JSC::ConstructAbility s_operationsPromiseTriggerPromiseReactionsCodeConstructAbility;
+extern const char* s_operationsPromiseRejectPromiseCode;
+extern const int s_operationsPromiseRejectPromiseCodeLength;
+extern const JSC::ConstructAbility s_operationsPromiseRejectPromiseCodeConstructAbility;
+extern const char* s_operationsPromiseFulfillPromiseCode;
+extern const int s_operationsPromiseFulfillPromiseCodeLength;
+extern const JSC::ConstructAbility s_operationsPromiseFulfillPromiseCodeConstructAbility;
+extern const char* s_operationsPromiseCreateResolvingFunctionsCode;
+extern const int s_operationsPromiseCreateResolvingFunctionsCodeLength;
+extern const JSC::ConstructAbility s_operationsPromiseCreateResolvingFunctionsCodeConstructAbility;
+extern const char* s_operationsPromisePromiseReactionJobCode;
+extern const int s_operationsPromisePromiseReactionJobCodeLength;
+extern const JSC::ConstructAbility s_operationsPromisePromiseReactionJobCodeConstructAbility;
+extern const char* s_operationsPromisePromiseResolveThenableJobCode;
+extern const int s_operationsPromisePromiseResolveThenableJobCodeLength;
+extern const JSC::ConstructAbility s_operationsPromisePromiseResolveThenableJobCodeConstructAbility;
+extern const char* s_operationsPromiseInitializePromiseCode;
+extern const int s_operationsPromiseInitializePromiseCodeLength;
+extern const JSC::ConstructAbility s_operationsPromiseInitializePromiseCodeConstructAbility;
+
+#define JSC_FOREACH_OPERATIONSPROMISE_BUILTIN_DATA(macro) \
+ macro(isPromise, operationsPromiseIsPromise, 1) \
+ macro(newPromiseReaction, operationsPromiseNewPromiseReaction, 2) \
+ macro(newPromiseCapability, operationsPromiseNewPromiseCapability, 1) \
+ macro(triggerPromiseReactions, operationsPromiseTriggerPromiseReactions, 2) \
+ macro(rejectPromise, operationsPromiseRejectPromise, 2) \
+ macro(fulfillPromise, operationsPromiseFulfillPromise, 2) \
+ macro(createResolvingFunctions, operationsPromiseCreateResolvingFunctions, 1) \
+ macro(promiseReactionJob, operationsPromisePromiseReactionJob, 2) \
+ macro(promiseResolveThenableJob, operationsPromisePromiseResolveThenableJob, 3) \
+ macro(initializePromise, operationsPromiseInitializePromise, 1) \
+
+#define JSC_BUILTIN_OPERATIONSPROMISE_ISPROMISE 1
+#define JSC_BUILTIN_OPERATIONSPROMISE_NEWPROMISEREACTION 1
+#define JSC_BUILTIN_OPERATIONSPROMISE_NEWPROMISECAPABILITY 1
+#define JSC_BUILTIN_OPERATIONSPROMISE_TRIGGERPROMISEREACTIONS 1
+#define JSC_BUILTIN_OPERATIONSPROMISE_REJECTPROMISE 1
+#define JSC_BUILTIN_OPERATIONSPROMISE_FULFILLPROMISE 1
+#define JSC_BUILTIN_OPERATIONSPROMISE_CREATERESOLVINGFUNCTIONS 1
+#define JSC_BUILTIN_OPERATIONSPROMISE_PROMISEREACTIONJOB 1
+#define JSC_BUILTIN_OPERATIONSPROMISE_PROMISERESOLVETHENABLEJOB 1
+#define JSC_BUILTIN_OPERATIONSPROMISE_INITIALIZEPROMISE 1
+
+#define JSC_FOREACH_BUILTIN_CODE(macro) \
+ macro(operationsPromiseIsPromiseCode, isPromise, s_operationsPromiseIsPromiseCodeLength) \
+ macro(operationsPromiseNewPromiseReactionCode, newPromiseReaction, s_operationsPromiseNewPromiseReactionCodeLength) \
+ macro(operationsPromiseNewPromiseCapabilityCode, newPromiseCapability, s_operationsPromiseNewPromiseCapabilityCodeLength) \
+ macro(operationsPromiseTriggerPromiseReactionsCode, triggerPromiseReactions, s_operationsPromiseTriggerPromiseReactionsCodeLength) \
+ macro(operationsPromiseRejectPromiseCode, rejectPromise, s_operationsPromiseRejectPromiseCodeLength) \
+ macro(operationsPromiseFulfillPromiseCode, fulfillPromise, s_operationsPromiseFulfillPromiseCodeLength) \
+ macro(operationsPromiseCreateResolvingFunctionsCode, createResolvingFunctions, s_operationsPromiseCreateResolvingFunctionsCodeLength) \
+ macro(operationsPromisePromiseReactionJobCode, promiseReactionJob, s_operationsPromisePromiseReactionJobCodeLength) \
+ macro(operationsPromisePromiseResolveThenableJobCode, promiseResolveThenableJob, s_operationsPromisePromiseResolveThenableJobCodeLength) \
+ macro(operationsPromiseInitializePromiseCode, initializePromise, s_operationsPromiseInitializePromiseCodeLength) \
+
+#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \
+ macro(createResolvingFunctions) \
+ macro(fulfillPromise) \
+ macro(initializePromise) \
+ macro(isPromise) \
+ macro(newPromiseCapability) \
+ macro(newPromiseReaction) \
+ macro(promiseReactionJob) \
+ macro(promiseResolveThenableJob) \
+ macro(rejectPromise) \
+ macro(triggerPromiseReactions) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+#define JSC_BUILTIN_EXISTS(object, func) defined JSC_BUILTIN_ ## object ## _ ## func
+
+} // namespace JSC
+
+#endif // JSCBuiltins_h
+
+### End File: JSCBuiltins.h
+
+### Begin File: JSCBuiltins.cpp
+/*
+ * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "JSCBuiltins.h"
+
+#include "BuiltinExecutables.h"
+#include "Executable.h"
+#include "JSCellInlines.h"
+#include "VM.h"
+
+namespace JSC {
+
+const JSC::ConstructAbility s_operationsPromiseIsPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_operationsPromiseIsPromiseCodeLength = 158;
+const char* s_operationsPromiseIsPromiseCode =
+ "(function (promise)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " return @isObject(promise) && !!promise.@promiseState;\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_operationsPromiseNewPromiseReactionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_operationsPromiseNewPromiseReactionCodeLength = 220;
+const char* s_operationsPromiseNewPromiseReactionCode =
+ "(function (capability, handler)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " return {\n" \
+ " @capabilities: capability,\n" \
+ " @handler: handler\n" \
+ " };\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_operationsPromiseNewPromiseCapabilityCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_operationsPromiseNewPromiseCapabilityCodeLength = 1427;
+const char* s_operationsPromiseNewPromiseCapabilityCode =
+ "(function (constructor)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " //\n" \
+ " if (typeof constructor !== \"function\")\n" \
+ " throw new @TypeError(\"promise capability requires a constructor function\");\n" \
+ "\n" \
+ " var promiseCapability = {\n" \
+ " @promise: undefined,\n" \
+ " @resolve: undefined,\n" \
+ " @reject: undefined\n" \
+ " };\n" \
+ "\n" \
+ " function executor(resolve, reject)\n" \
+ " {\n" \
+ " if (promiseCapability.@resolve !== undefined)\n" \
+ " throw new @TypeError(\"resolve function is already set\");\n" \
+ " if (promiseCapability.@reject !== undefined)\n" \
+ " throw new @TypeError(\"reject function is already set\");\n" \
+ "\n" \
+ " promiseCapability.@resolve = resolve;\n" \
+ " promiseCapability.@reject = reject;\n" \
+ " }\n" \
+ "\n" \
+ " var promise = new constructor(executor);\n" \
+ "\n" \
+ " if (typeof promiseCapability.@resolve !== \"function\")\n" \
+ " throw new @TypeError(\"executor did not take a resolve function\");\n" \
+ "\n" \
+ " if (typeof promiseCapability.@reject !== \"function\")\n" \
+ " throw new @TypeError(\"executor did not take a reject function\");\n" \
+ "\n" \
+ " promiseCapability.@promise = promise;\n" \
+ "\n" \
+ " return promiseCapability;\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_operationsPromiseTriggerPromiseReactionsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_operationsPromiseTriggerPromiseReactionsCodeLength = 269;
+const char* s_operationsPromiseTriggerPromiseReactionsCode =
+ "(function (reactions, argument)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " for (var index = 0, length = reactions.length; index < length; ++index)\n" \
+ " @enqueueJob(@promiseReactionJob, [reactions[index], argument]);\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_operationsPromiseRejectPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_operationsPromiseRejectPromiseCodeLength = 541;
+const char* s_operationsPromiseRejectPromiseCode =
+ "(function (promise, reason)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var reactions = promise.@promiseRejectReactions;\n" \
+ " promise.@promiseResult = reason;\n" \
+ " promise.@promiseFulfillReactions = undefined;\n" \
+ " promise.@promiseRejectReactions = undefined;\n" \
+ " promise.@promiseState = @promiseRejected;\n" \
+ "\n" \
+ " @InspectorInstrumentation.promiseRejected(promise, reason, reactions);\n" \
+ "\n" \
+ " @triggerPromiseReactions(reactions, reason);\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_operationsPromiseFulfillPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_operationsPromiseFulfillPromiseCodeLength = 540;
+const char* s_operationsPromiseFulfillPromiseCode =
+ "(function (promise, value)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var reactions = promise.@promiseFulfillReactions;\n" \
+ " promise.@promiseResult = value;\n" \
+ " promise.@promiseFulfillReactions = undefined;\n" \
+ " promise.@promiseRejectReactions = undefined;\n" \
+ " promise.@promiseState = @promiseFulfilled;\n" \
+ "\n" \
+ " @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);\n" \
+ "\n" \
+ " @triggerPromiseReactions(reactions, value);\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_operationsPromiseCreateResolvingFunctionsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_operationsPromiseCreateResolvingFunctionsCodeLength = 1468;
+const char* s_operationsPromiseCreateResolvingFunctionsCode =
+ "(function (promise)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var alreadyResolved = false;\n" \
+ "\n" \
+ " var resolve = function (resolution) {\n" \
+ " if (alreadyResolved)\n" \
+ " return undefined;\n" \
+ " alreadyResolved = true;\n" \
+ "\n" \
+ " if (resolution === promise)\n" \
+ " return @rejectPromise(promise, new @TypeError(\"Resolve a promise with itself\"));\n" \
+ "\n" \
+ " if (!@isObject(resolution))\n" \
+ " return @fulfillPromise(promise, resolution);\n" \
+ "\n" \
+ " var then;\n" \
+ " try {\n" \
+ " then = resolution.then;\n" \
+ " } catch (error) {\n" \
+ " return @rejectPromise(promise, error);\n" \
+ " }\n" \
+ "\n" \
+ " if (typeof then !== 'function')\n" \
+ " return @fulfillPromise(promise, resolution);\n" \
+ "\n" \
+ " @enqueueJob(@promiseResolveThenableJob, [promise, resolution, then]);\n" \
+ "\n" \
+ " return undefined;\n" \
+ " };\n" \
+ "\n" \
+ " var reject = function (reason) {\n" \
+ " if (alreadyResolved)\n" \
+ " return undefined;\n" \
+ " alreadyResolved = true;\n" \
+ "\n" \
+ " return @rejectPromise(promise, reason);\n" \
+ " };\n" \
+ "\n" \
+ " return {\n" \
+ " @resolve: resolve,\n" \
+ " @reject: reject\n" \
+ " };\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_operationsPromisePromiseReactionJobCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_operationsPromisePromiseReactionJobCodeLength = 493;
+const char* s_operationsPromisePromiseReactionJobCode =
+ "(function (reaction, argument)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var promiseCapability = reaction.@capabilities;\n" \
+ "\n" \
+ " var result;\n" \
+ " try {\n" \
+ " result = reaction.@handler.@call(undefined, argument);\n" \
+ " } catch (error) {\n" \
+ " return promiseCapability.@reject.@call(undefined, error);\n" \
+ " }\n" \
+ "\n" \
+ " return promiseCapability.@resolve.@call(undefined, result);\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_operationsPromisePromiseResolveThenableJobCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_operationsPromisePromiseResolveThenableJobCodeLength = 453;
+const char* s_operationsPromisePromiseResolveThenableJobCode =
+ "(function (promiseToResolve, thenable, then)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " var resolvingFunctions = @createResolvingFunctions(promiseToResolve);\n" \
+ "\n" \
+ " try {\n" \
+ " return then.@call(thenable, resolvingFunctions.@resolve, resolvingFunctions.@reject);\n" \
+ " } catch (error) {\n" \
+ " return resolvingFunctions.@reject.@call(undefined, error);\n" \
+ " }\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_operationsPromiseInitializePromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_operationsPromiseInitializePromiseCodeLength = 731;
+const char* s_operationsPromiseInitializePromiseCode =
+ "(function (executor)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " if (typeof executor !== 'function')\n" \
+ " throw new @TypeError(\"Promise constructor takes a function argument\");\n" \
+ "\n" \
+ " this.@promiseState = @promisePending;\n" \
+ " this.@promiseFulfillReactions = [];\n" \
+ " this.@promiseRejectReactions = [];\n" \
+ "\n" \
+ " var resolvingFunctions = @createResolvingFunctions(this);\n" \
+ " try {\n" \
+ " executor(resolvingFunctions.@resolve, resolvingFunctions.@reject);\n" \
+ " } catch (error) {\n" \
+ " return resolvingFunctions.@reject.@call(undefined, error);\n" \
+ " }\n" \
+ "\n" \
+ " return this;\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); }
+JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace JSC
+### End File: JSCBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result
new file mode 100644
index 000000000..5b61d2f82
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result
@@ -0,0 +1,198 @@
+### Begin File: ArbitraryConditionalGuardBuiltins.h
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef ArbitraryConditionalGuardBuiltins_h
+#define ArbitraryConditionalGuardBuiltins_h
+
+#if ENABLE(STREAMS_API) || USE(CF)
+
+#include <builtins/BuiltinUtils.h>
+#include <bytecode/UnlinkedFunctionExecutable.h>
+#include <runtime/Identifier.h>
+#include <runtime/JSFunction.h>
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace WebCore {
+
+/* ArbitraryConditionalGuard */
+extern const char* s_arbitraryConditionalGuardIsReadableStreamLockedCode;
+extern const int s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength;
+extern const JSC::ConstructAbility s_arbitraryConditionalGuardIsReadableStreamLockedCodeConstructAbility;
+
+#define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_DATA(macro) \
+ macro(isReadableStreamLocked, arbitraryConditionalGuardIsReadableStreamLocked, 1) \
+
+#define WEBCORE_BUILTIN_ARBITRARYCONDITIONALGUARD_ISREADABLESTREAMLOCKED 1
+
+#define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(macro) \
+ macro(arbitraryConditionalGuardIsReadableStreamLockedCode, isReadableStreamLocked, s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength) \
+
+#define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(macro) \
+ macro(isReadableStreamLocked) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+class ArbitraryConditionalGuardBuiltinsWrapper : private JSC::WeakHandleOwner {
+public:
+ explicit ArbitraryConditionalGuardBuiltinsWrapper(JSC::VM* vm)
+ : m_vm(*vm)
+ WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
+#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length)))
+ WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
+#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
+ {
+ }
+
+#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
+ JSC::UnlinkedFunctionExecutable* name##Executable(); \
+ const JSC::SourceCode& name##Source() const { return m_##name##Source; }
+ WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
+#undef EXPOSE_BUILTIN_EXECUTABLES
+
+ WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
+
+ void exportNames();
+
+private:
+ JSC::VM& m_vm;
+
+ WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
+
+#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
+ JSC::SourceCode m_##name##Source;\
+ JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
+ WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+
+};
+
+#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
+inline JSC::UnlinkedFunctionExecutable* ArbitraryConditionalGuardBuiltinsWrapper::name##Executable() \
+{\
+ if (!m_##name##Executable)\
+ m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
+ return m_##name##Executable.get();\
+}
+WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
+#undef DEFINE_BUILTIN_EXECUTABLES
+
+inline void ArbitraryConditionalGuardBuiltinsWrapper::exportNames()
+{
+#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
+ WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
+#undef EXPORT_FUNCTION_NAME
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(STREAMS_API) || USE(CF)
+
+#endif // ArbitraryConditionalGuardBuiltins_h
+
+### End File: ArbitraryConditionalGuardBuiltins.h
+
+### Begin File: ArbitraryConditionalGuardBuiltins.cpp
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "ArbitraryConditionalGuardBuiltins.h"
+
+#if ENABLE(STREAMS_API) || USE(CF)
+
+#include "WebCoreJSClientData.h"
+#include <runtime/Executable.h>
+#include <runtime/JSCJSValueInlines.h>
+#include <runtime/JSCellInlines.h>
+#include <runtime/StructureInlines.h>
+#include <runtime/VM.h>
+
+namespace WebCore {
+
+const JSC::ConstructAbility s_arbitraryConditionalGuardIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength = 71;
+const char* s_arbitraryConditionalGuardIsReadableStreamLockedCode =
+ "(function (stream)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " return !!stream.@reader;\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
+ return clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Source()); \
+}
+WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace WebCore
+
+#endif // ENABLE(STREAMS_API) || USE(CF)
+
+### End File: ArbitraryConditionalGuardBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateFlagAnnotation-Separate.js-error b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateFlagAnnotation-Separate.js-error
new file mode 100644
index 000000000..b15152e63
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateFlagAnnotation-Separate.js-error
@@ -0,0 +1 @@
+ERROR: Duplicate annotation found: internal
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateKeyValueAnnotation-Separate.js-error b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateKeyValueAnnotation-Separate.js-error
new file mode 100644
index 000000000..f1b429e27
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateKeyValueAnnotation-Separate.js-error
@@ -0,0 +1 @@
+ERROR: Duplicate annotation found: conditional
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result
new file mode 100644
index 000000000..5b1544cb5
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result
@@ -0,0 +1,198 @@
+### Begin File: GuardedBuiltinBuiltins.h
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef GuardedBuiltinBuiltins_h
+#define GuardedBuiltinBuiltins_h
+
+#if ENABLE(STREAMS_API)
+
+#include <builtins/BuiltinUtils.h>
+#include <bytecode/UnlinkedFunctionExecutable.h>
+#include <runtime/Identifier.h>
+#include <runtime/JSFunction.h>
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace WebCore {
+
+/* GuardedBuiltin */
+extern const char* s_guardedBuiltinIsReadableStreamLockedCode;
+extern const int s_guardedBuiltinIsReadableStreamLockedCodeLength;
+extern const JSC::ConstructAbility s_guardedBuiltinIsReadableStreamLockedCodeConstructAbility;
+
+#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_DATA(macro) \
+ macro(isReadableStreamLocked, guardedBuiltinIsReadableStreamLocked, 1) \
+
+#define WEBCORE_BUILTIN_GUARDEDBUILTIN_ISREADABLESTREAMLOCKED 1
+
+#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(macro) \
+ macro(guardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_guardedBuiltinIsReadableStreamLockedCodeLength) \
+
+#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
+ macro(isReadableStreamLocked) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+class GuardedBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner {
+public:
+ explicit GuardedBuiltinBuiltinsWrapper(JSC::VM* vm)
+ : m_vm(*vm)
+ WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
+#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length)))
+ WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
+#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
+ {
+ }
+
+#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
+ JSC::UnlinkedFunctionExecutable* name##Executable(); \
+ const JSC::SourceCode& name##Source() const { return m_##name##Source; }
+ WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
+#undef EXPOSE_BUILTIN_EXECUTABLES
+
+ WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
+
+ void exportNames();
+
+private:
+ JSC::VM& m_vm;
+
+ WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
+
+#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
+ JSC::SourceCode m_##name##Source;\
+ JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
+ WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+
+};
+
+#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
+inline JSC::UnlinkedFunctionExecutable* GuardedBuiltinBuiltinsWrapper::name##Executable() \
+{\
+ if (!m_##name##Executable)\
+ m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
+ return m_##name##Executable.get();\
+}
+WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
+#undef DEFINE_BUILTIN_EXECUTABLES
+
+inline void GuardedBuiltinBuiltinsWrapper::exportNames()
+{
+#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
+ WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
+#undef EXPORT_FUNCTION_NAME
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(STREAMS_API)
+
+#endif // GuardedBuiltinBuiltins_h
+
+### End File: GuardedBuiltinBuiltins.h
+
+### Begin File: GuardedBuiltinBuiltins.cpp
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "GuardedBuiltinBuiltins.h"
+
+#if ENABLE(STREAMS_API)
+
+#include "WebCoreJSClientData.h"
+#include <runtime/Executable.h>
+#include <runtime/JSCJSValueInlines.h>
+#include <runtime/JSCellInlines.h>
+#include <runtime/StructureInlines.h>
+#include <runtime/VM.h>
+
+namespace WebCore {
+
+const JSC::ConstructAbility s_guardedBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_guardedBuiltinIsReadableStreamLockedCodeLength = 71;
+const char* s_guardedBuiltinIsReadableStreamLockedCode =
+ "(function (stream)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " return !!stream.@reader;\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
+ return clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Source()); \
+}
+WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace WebCore
+
+#endif // ENABLE(STREAMS_API)
+
+### End File: GuardedBuiltinBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result
new file mode 100644
index 000000000..53b5552e2
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result
@@ -0,0 +1,230 @@
+### Begin File: GuardedInternalBuiltinBuiltins.h
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef GuardedInternalBuiltinBuiltins_h
+#define GuardedInternalBuiltinBuiltins_h
+
+#if ENABLE(STREAMS_API)
+
+#include <builtins/BuiltinUtils.h>
+#include <bytecode/UnlinkedFunctionExecutable.h>
+#include <runtime/Identifier.h>
+#include <runtime/JSFunction.h>
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace WebCore {
+
+/* GuardedInternalBuiltin */
+extern const char* s_guardedInternalBuiltinIsReadableStreamLockedCode;
+extern const int s_guardedInternalBuiltinIsReadableStreamLockedCodeLength;
+extern const JSC::ConstructAbility s_guardedInternalBuiltinIsReadableStreamLockedCodeConstructAbility;
+
+#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_DATA(macro) \
+ macro(isReadableStreamLocked, guardedInternalBuiltinIsReadableStreamLocked, 1) \
+
+#define WEBCORE_BUILTIN_GUARDEDINTERNALBUILTIN_ISREADABLESTREAMLOCKED 1
+
+#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(macro) \
+ macro(guardedInternalBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_guardedInternalBuiltinIsReadableStreamLockedCodeLength) \
+
+#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
+ macro(isReadableStreamLocked) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+class GuardedInternalBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner {
+public:
+ explicit GuardedInternalBuiltinBuiltinsWrapper(JSC::VM* vm)
+ : m_vm(*vm)
+ WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
+#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length)))
+ WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
+#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
+ {
+ }
+
+#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
+ JSC::UnlinkedFunctionExecutable* name##Executable(); \
+ const JSC::SourceCode& name##Source() const { return m_##name##Source; }
+ WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
+#undef EXPOSE_BUILTIN_EXECUTABLES
+
+ WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
+
+ void exportNames();
+
+private:
+ JSC::VM& m_vm;
+
+ WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
+
+#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
+ JSC::SourceCode m_##name##Source;\
+ JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
+ WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+
+};
+
+#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
+inline JSC::UnlinkedFunctionExecutable* GuardedInternalBuiltinBuiltinsWrapper::name##Executable() \
+{\
+ if (!m_##name##Executable)\
+ m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
+ return m_##name##Executable.get();\
+}
+WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
+#undef DEFINE_BUILTIN_EXECUTABLES
+
+inline void GuardedInternalBuiltinBuiltinsWrapper::exportNames()
+{
+#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
+ WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
+#undef EXPORT_FUNCTION_NAME
+}
+
+class GuardedInternalBuiltinBuiltinFunctions {
+public:
+ explicit GuardedInternalBuiltinBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
+
+ void init(JSC::JSGlobalObject&);
+ void visit(JSC::SlotVisitor&);
+
+public:
+ JSC::VM& m_vm;
+
+#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
+ JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
+ WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+};
+
+inline void GuardedInternalBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
+{
+#define EXPORT_FUNCTION(codeName, functionName, length)\
+ m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
+ WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION)
+#undef EXPORT_FUNCTION
+}
+
+inline void GuardedInternalBuiltinBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
+{
+#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
+ WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
+#undef VISIT_FUNCTION
+}
+
+
+} // namespace WebCore
+
+#endif // ENABLE(STREAMS_API)
+
+#endif // GuardedInternalBuiltinBuiltins_h
+
+### End File: GuardedInternalBuiltinBuiltins.h
+
+### Begin File: GuardedInternalBuiltinBuiltins.cpp
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "GuardedInternalBuiltinBuiltins.h"
+
+#if ENABLE(STREAMS_API)
+
+#include "WebCoreJSClientData.h"
+#include <runtime/Executable.h>
+#include <runtime/JSCJSValueInlines.h>
+#include <runtime/JSCellInlines.h>
+#include <runtime/StructureInlines.h>
+#include <runtime/VM.h>
+
+namespace WebCore {
+
+const JSC::ConstructAbility s_guardedInternalBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_guardedInternalBuiltinIsReadableStreamLockedCodeLength = 71;
+const char* s_guardedInternalBuiltinIsReadableStreamLockedCode =
+ "(function (stream)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " return !!stream.@reader;\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
+ return clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Source()); \
+}
+WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace WebCore
+
+#endif // ENABLE(STREAMS_API)
+
+### End File: GuardedInternalBuiltinBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result
new file mode 100644
index 000000000..7c96b9f14
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result
@@ -0,0 +1,189 @@
+### Begin File: UnguardedBuiltinBuiltins.h
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef UnguardedBuiltinBuiltins_h
+#define UnguardedBuiltinBuiltins_h
+
+#include <builtins/BuiltinUtils.h>
+#include <bytecode/UnlinkedFunctionExecutable.h>
+#include <runtime/Identifier.h>
+#include <runtime/JSFunction.h>
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace WebCore {
+
+/* UnguardedBuiltin */
+extern const char* s_unguardedBuiltinIsReadableStreamLockedCode;
+extern const int s_unguardedBuiltinIsReadableStreamLockedCodeLength;
+extern const JSC::ConstructAbility s_unguardedBuiltinIsReadableStreamLockedCodeConstructAbility;
+
+#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_DATA(macro) \
+ macro(isReadableStreamLocked, unguardedBuiltinIsReadableStreamLocked, 1) \
+
+#define WEBCORE_BUILTIN_UNGUARDEDBUILTIN_ISREADABLESTREAMLOCKED 1
+
+#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(macro) \
+ macro(unguardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_unguardedBuiltinIsReadableStreamLockedCodeLength) \
+
+#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
+ macro(isReadableStreamLocked) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+class UnguardedBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner {
+public:
+ explicit UnguardedBuiltinBuiltinsWrapper(JSC::VM* vm)
+ : m_vm(*vm)
+ WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
+#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length)))
+ WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
+#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
+ {
+ }
+
+#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
+ JSC::UnlinkedFunctionExecutable* name##Executable(); \
+ const JSC::SourceCode& name##Source() const { return m_##name##Source; }
+ WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
+#undef EXPOSE_BUILTIN_EXECUTABLES
+
+ WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
+
+ void exportNames();
+
+private:
+ JSC::VM& m_vm;
+
+ WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
+
+#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
+ JSC::SourceCode m_##name##Source;\
+ JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
+ WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+
+};
+
+#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
+inline JSC::UnlinkedFunctionExecutable* UnguardedBuiltinBuiltinsWrapper::name##Executable() \
+{\
+ if (!m_##name##Executable)\
+ m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
+ return m_##name##Executable.get();\
+}
+WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
+#undef DEFINE_BUILTIN_EXECUTABLES
+
+inline void UnguardedBuiltinBuiltinsWrapper::exportNames()
+{
+#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
+ WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
+#undef EXPORT_FUNCTION_NAME
+}
+
+} // namespace WebCore
+
+#endif // UnguardedBuiltinBuiltins_h
+
+### End File: UnguardedBuiltinBuiltins.h
+
+### Begin File: UnguardedBuiltinBuiltins.cpp
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "UnguardedBuiltinBuiltins.h"
+
+#include "WebCoreJSClientData.h"
+#include <runtime/Executable.h>
+#include <runtime/JSCJSValueInlines.h>
+#include <runtime/JSCellInlines.h>
+#include <runtime/StructureInlines.h>
+#include <runtime/VM.h>
+
+namespace WebCore {
+
+const JSC::ConstructAbility s_unguardedBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_unguardedBuiltinIsReadableStreamLockedCodeLength = 71;
+const char* s_unguardedBuiltinIsReadableStreamLockedCode =
+ "(function (stream)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " return !!stream.@reader;\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
+ return clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Source()); \
+}
+WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace WebCore
+### End File: UnguardedBuiltinBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result
new file mode 100644
index 000000000..726b281a9
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result
@@ -0,0 +1,281 @@
+### Begin File: xmlCasingTestBuiltins.h
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#ifndef xmlCasingTestBuiltins_h
+#define xmlCasingTestBuiltins_h
+
+#if ENABLE(STREAMS_API)
+
+#include <builtins/BuiltinUtils.h>
+#include <bytecode/UnlinkedFunctionExecutable.h>
+#include <runtime/Identifier.h>
+#include <runtime/JSFunction.h>
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace WebCore {
+
+/* xmlCasingTest */
+extern const char* s_xmlCasingTestXMLCasingTestCode;
+extern const int s_xmlCasingTestXMLCasingTestCodeLength;
+extern const JSC::ConstructAbility s_xmlCasingTestXMLCasingTestCodeConstructAbility;
+extern const char* s_xmlCasingTestCssCasingTestCode;
+extern const int s_xmlCasingTestCssCasingTestCodeLength;
+extern const JSC::ConstructAbility s_xmlCasingTestCssCasingTestCodeConstructAbility;
+extern const char* s_xmlCasingTestUrlCasingTestCode;
+extern const int s_xmlCasingTestUrlCasingTestCodeLength;
+extern const JSC::ConstructAbility s_xmlCasingTestUrlCasingTestCodeConstructAbility;
+
+#define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_DATA(macro) \
+ macro(xmlCasingTest, xmlCasingTestXMLCasingTest, 1) \
+ macro(cssCasingTest, xmlCasingTestCssCasingTest, 2) \
+ macro(urlCasingTest, xmlCasingTestUrlCasingTest, 3) \
+
+#define WEBCORE_BUILTIN_XMLCASINGTEST_XMLCASINGTEST 1
+#define WEBCORE_BUILTIN_XMLCASINGTEST_CSSCASINGTEST 1
+#define WEBCORE_BUILTIN_XMLCASINGTEST_URLCASINGTEST 1
+
+#define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(macro) \
+ macro(xmlCasingTestXMLCasingTestCode, xmlCasingTest, s_xmlCasingTestXMLCasingTestCodeLength) \
+ macro(xmlCasingTestCssCasingTestCode, cssCasingTest, s_xmlCasingTestCssCasingTestCodeLength) \
+ macro(xmlCasingTestUrlCasingTestCode, urlCasingTest, s_xmlCasingTestUrlCasingTestCodeLength) \
+
+#define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(macro) \
+ macro(cssCasingTest) \
+ macro(urlCasingTest) \
+ macro(xmlCasingTest) \
+
+#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+class xmlCasingTestBuiltinsWrapper : private JSC::WeakHandleOwner {
+public:
+ explicit xmlCasingTestBuiltinsWrapper(JSC::VM* vm)
+ : m_vm(*vm)
+ WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
+#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length)))
+ WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
+#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
+ {
+ }
+
+#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
+ JSC::UnlinkedFunctionExecutable* name##Executable(); \
+ const JSC::SourceCode& name##Source() const { return m_##name##Source; }
+ WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
+#undef EXPOSE_BUILTIN_EXECUTABLES
+
+ WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
+
+ void exportNames();
+
+private:
+ JSC::VM& m_vm;
+
+ WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
+
+#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
+ JSC::SourceCode m_##name##Source;\
+ JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
+ WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+
+};
+
+#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
+inline JSC::UnlinkedFunctionExecutable* xmlCasingTestBuiltinsWrapper::name##Executable() \
+{\
+ if (!m_##name##Executable)\
+ m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
+ return m_##name##Executable.get();\
+}
+WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
+#undef DEFINE_BUILTIN_EXECUTABLES
+
+inline void xmlCasingTestBuiltinsWrapper::exportNames()
+{
+#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
+ WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
+#undef EXPORT_FUNCTION_NAME
+}
+
+class xmlCasingTestBuiltinFunctions {
+public:
+ explicit xmlCasingTestBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
+
+ void init(JSC::JSGlobalObject&);
+ void visit(JSC::SlotVisitor&);
+
+public:
+ JSC::VM& m_vm;
+
+#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
+ JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
+ WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+};
+
+inline void xmlCasingTestBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
+{
+#define EXPORT_FUNCTION(codeName, functionName, length)\
+ m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
+ WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(EXPORT_FUNCTION)
+#undef EXPORT_FUNCTION
+}
+
+inline void xmlCasingTestBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
+{
+#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
+ WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
+#undef VISIT_FUNCTION
+}
+
+
+} // namespace WebCore
+
+#endif // ENABLE(STREAMS_API)
+
+#endif // xmlCasingTestBuiltins_h
+
+### End File: xmlCasingTestBuiltins.h
+
+### Begin File: xmlCasingTestBuiltins.cpp
+/*
+ * Copyright (c) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
+// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
+
+#include "config.h"
+#include "xmlCasingTestBuiltins.h"
+
+#if ENABLE(STREAMS_API)
+
+#include "WebCoreJSClientData.h"
+#include <runtime/Executable.h>
+#include <runtime/JSCJSValueInlines.h>
+#include <runtime/JSCellInlines.h>
+#include <runtime/StructureInlines.h>
+#include <runtime/VM.h>
+
+namespace WebCore {
+
+const JSC::ConstructAbility s_xmlCasingTestXMLCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_xmlCasingTestXMLCasingTestCodeLength = 71;
+const char* s_xmlCasingTestXMLCasingTestCode =
+ "(function (stream)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " return !!stream.@reader;\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_xmlCasingTestCssCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_xmlCasingTestCssCasingTestCodeLength = 402;
+const char* s_xmlCasingTestCssCasingTestCode =
+ "(function (stream, reason)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " if (stream.@state === @readableStreamClosed)\n" \
+ " return Promise.resolve();\n" \
+ " if (stream.@state === @readableStreamErrored)\n" \
+ " return Promise.reject(stream.@storedError);\n" \
+ " stream.@queue = [];\n" \
+ " @finishClosingReadableStream(stream);\n" \
+ " return @promiseInvokeOrNoop(stream.@underlyingSource, \"cancel\", [reason]).then(function() { });\n" \
+ "})\n" \
+;
+
+const JSC::ConstructAbility s_xmlCasingTestUrlCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_xmlCasingTestUrlCasingTestCodeLength = 338;
+const char* s_xmlCasingTestUrlCasingTestCode =
+ "(function (object, key, args)\n" \
+ "{\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " try {\n" \
+ " var method = object[key];\n" \
+ " if (typeof method === \"undefined\")\n" \
+ " return Promise.resolve();\n" \
+ " var result = method.@apply(object, args);\n" \
+ " return Promise.resolve(result);\n" \
+ " }\n" \
+ " catch(error) {\n" \
+ " return Promise.reject(error);\n" \
+ " }\n" \
+ "})\n" \
+;
+
+
+#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
+JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
+{\
+ JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
+ return clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Source()); \
+}
+WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace WebCore
+
+#endif // ENABLE(STREAMS_API)
+
+### End File: xmlCasingTestBuiltins.cpp
diff --git a/Source/JavaScriptCore/Scripts/xxd.pl b/Source/JavaScriptCore/Scripts/xxd.pl
new file mode 100644
index 000000000..5ee08a52d
--- /dev/null
+++ b/Source/JavaScriptCore/Scripts/xxd.pl
@@ -0,0 +1,45 @@
+#! /usr/bin/perl
+
+# Copyright (C) 2010-2011 Google 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:
+#
+# # Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# # 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.
+# # Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+# OWNER 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.
+#
+
+$varname = shift;
+$fname = shift;
+$output = shift;
+
+open($input, '<', $fname) or die "Can't open file for read: $fname $!";
+$/ = undef;
+$text = <$input>;
+close($input);
+
+$text = join(', ', map('0x' . unpack("H*", $_), split(undef, $text)));
+
+open($output, '>', $output) or die "Can't open file for write: $output $!";
+print $output "const unsigned char $varname\[\] = {\n$text\n};\n";
+close($output);