runtime/SymbolPrototype.cpp
)
-set(JavaScriptCore_SCRIPTS_DIR "${JAVASCRIPTCORE_DIR}/Scripts")
-
set(JavaScriptCore_LIBRARIES
WTF${DEBUG_SUFFIX}
${ICU_I18N_LIBRARIES}
)
+set(JavaScriptCore_SCRIPTS_SOURCES_DIR "${JAVASCRIPTCORE_DIR}/Scripts")
+
+# Globbing relies on the fact that generator-specific file names are prefixed with their directory.
+# Top-level scripts should have a file extension, since they are invoked during the build.
+
+set(JavaScriptCore_SCRIPTS_SOURCES_PATHS
+ ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/*.pl
+ ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/*.py
+ ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/builtins/builtins*.py
+)
+
+# Force JavaScriptCore to run scripts from the same staging path as WebCore.
+set(JavaScriptCore_SCRIPTS_DIR "${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore/Scripts")
+
+file(MAKE_DIRECTORY ${JavaScriptCore_SCRIPTS_DIR})
+
+# The directory flattening performed below mirrors what the Mac port does with private headers.
+
+file(GLOB JavaScriptCore_SCRIPTS_SOURCES ${JavaScriptCore_SCRIPTS_SOURCES_PATHS})
+
+foreach (_file ${JavaScriptCore_SCRIPTS_SOURCES})
+ get_filename_component(_script "${_file}" NAME)
+ add_custom_command(
+ OUTPUT ${JavaScriptCore_SCRIPTS_DIR}/${_script}
+ MAIN_DEPENDENCY ${_file}
+ WORKING_DIRECTORY ${DERIVED_SOURCES_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file} ${JavaScriptCore_SCRIPTS_DIR}/${_script}
+ VERBATIM)
+ list(APPEND JavaScriptCore_SCRIPTS ${JavaScriptCore_SCRIPTS_DIR}/${_script})
+endforeach ()
+
if (USE_UDIS86)
set(UDIS_GEN_DEP
disassembler/udis86/ud_opcode.py
macro(GENERATE_HASH_LUT _input _output)
add_custom_command(
OUTPUT ${_output}
- DEPENDS ${HASH_LUT_GENERATOR} ${_input} ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins
+ DEPENDS ${HASH_LUT_GENERATOR} ${_input} ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py
COMMAND ${PERL_EXECUTABLE} ${HASH_LUT_GENERATOR} ${_input} -i > ${_output}
VERBATIM)
list(APPEND JavaScriptCore_HEADERS ${_output})
VERBATIM)
# JSCBuiltins
+
+set(BUILTINS_GENERATOR_SCRIPTS
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generator.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_model.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_templates.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_combined_header.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_combined_implementation.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_separate_header.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_separate_implementation.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_separate_wrapper.py
+ ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py
+ ${JavaScriptCore_SCRIPTS_DIR}/lazywriter.py
+)
+
set(JavaScriptCore_BUILTINS_SOURCES
${JAVASCRIPTCORE_DIR}/builtins/ArrayConstructor.js
${JAVASCRIPTCORE_DIR}/builtins/ArrayIterator.prototype.js
)
add_custom_command(
- OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.h
- MAIN_DEPENDENCY ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins
- DEPENDS ${JavaScriptCore_BUILTINS_SOURCES}
- COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins --input-directory ${CMAKE_CURRENT_SOURCE_DIR}/builtins --output ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.cpp
+ OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.cpp
+ ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.h
+ MAIN_DEPENDENCY ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py
+ DEPENDS ${JavaScriptCore_BUILTINS_SOURCES} ${BUILTINS_GENERATOR_SCRIPTS}
+ COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py --framework JavaScriptCore --output-directory ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR} --combined ${JavaScriptCore_BUILTINS_SOURCES}
VERBATIM)
list(APPEND JavaScriptCore_SOURCES
add_dependencies(JavaScriptCore llvmForJSC)
endif ()
+# Force staging of shared scripts, even if they aren't directly used to build JavaScriptCore.
+add_custom_target(stageSharedScripts DEPENDS ${JavaScriptCore_SCRIPTS})
+add_dependencies(JavaScriptCore stageSharedScripts)
\ No newline at end of file
+2015-10-21 Brian Burg <bburg@apple.com>
+
+ Restructure generate-js-bindings script to be modular and testable
+ https://bugs.webkit.org/show_bug.cgi?id=149929
+
+ Reviewed by Alex Christensen.
+
+ This is a new code generator, based on the replay inputs code generator and
+ the inspector protocol code generator, which produces various files for JS
+ builtins.
+
+ Relative to the generator it replaces, this one consolidates two scripts in
+ JavaScriptCore and WebCore into a single script with multiple files. Parsed
+ information about the builtins file is stored in backend-independent model
+ objects. Each output file has its own code generator that uses the model to
+ produce resulting code. Generators are additionally parameterized by the target
+ framework (to choose correct macros and includes) and output mode (one
+ header/implementation file per builtin or per framework).
+
+ It includes a few simple tests of the generator's functionality. These result-
+ based tests will become increasingly more important as we start to add support
+ for builtins annotation such as @optional, @internal, etc. to the code generator.
+
+ Some of these complexities, such as having two output modes, will be removed in
+ subsequent patches. This patch is intended to exactly replace the existing
+ functionality with a unified script that makes additional cleanups straightforward.
+
+ Additional cleanup and consolidation between inspector code generator scripts
+ and this script will be pursued in followup patches.
+
+ New tests:
+
+ Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Combined.js
+ Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Separate.js
+ Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js
+ Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js
+ Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Combined.js
+ Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Separate.js
+ Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js
+ Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js
+ Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js
+ Scripts/tests/builtins/WebCore-xmlCasingTest-Separate.js
+
+
+ * CMakeLists.txt:
+
+ Copy the scripts that are used by other targets to a staging directory inside
+ ${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore/Scripts.
+ Define JavaScriptCore_SCRIPTS_DIR to point here so that the add_custom_command
+ and shared file lists are identical between JavaScriptCore and WebCore. The staged
+ scripts are a dependency of the main JavaScriptCore target so that they are
+ always staged, even if JavaScriptCore itself does not use a particular script.
+
+ The output files additionally depend on all builtin generator script files
+ and input files that are combined into the single header/implementation file.
+
+ * DerivedSources.make:
+
+ Define JavaScriptCore_SCRIPTS_DIR explicitly so the rule for code generation and
+ shared file lists are identical between JavaScriptCore and WebCore.
+
+ The output files additionally depend on all builtin generator script files
+ and input files that are combined into the single header/implementation file.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+ Mark the new builtins generator files as private headers so we can use them from
+ WebCore.
+
+ * Scripts/UpdateContents.py: Renamed from Source/JavaScriptCore/UpdateContents.py.
+ * Scripts/builtins/__init__.py: Added.
+ * Scripts/builtins/builtins.py: Added.
+ * Scripts/builtins/builtins_generator.py: Added. This file contains the base generator.
+ (WK_lcfirst):
+ (WK_ucfirst):
+ (BuiltinsGenerator):
+ (BuiltinsGenerator.__init__):
+ (BuiltinsGenerator.model):
+ (BuiltinsGenerator.generate_license):
+ (BuiltinsGenerator.generate_includes_from_entries):
+ (BuiltinsGenerator.generate_output):
+ (BuiltinsGenerator.output_filename):
+ (BuiltinsGenerator.mangledNameForFunction):
+ (BuiltinsGenerator.mangledNameForFunction.toCamel):
+ (BuiltinsGenerator.generate_embedded_code_string_section_for_function):
+ * Scripts/builtins/builtins_model.py: Added. This file contains builtins model objects.
+ (ParseException):
+ (Framework):
+ (Framework.__init__):
+ (Framework.setting):
+ (Framework.fromString):
+ (Frameworks):
+ (BuiltinObject):
+ (BuiltinObject.__init__):
+ (BuiltinFunction):
+ (BuiltinFunction.__init__):
+ (BuiltinFunction.fromString):
+ (BuiltinFunction.__str__):
+ (BuiltinsCollection):
+ (BuiltinsCollection.__init__):
+ (BuiltinsCollection.parse_builtins_file):
+ (BuiltinsCollection.copyrights):
+ (BuiltinsCollection.all_functions):
+ (BuiltinsCollection._parse_copyright_lines):
+ (BuiltinsCollection._parse_functions):
+ * Scripts/builtins/builtins_templates.py: Added.
+ (BuiltinsGeneratorTemplates):
+ * Scripts/builtins/builtins_generate_combined_header.py: Added.
+ (BuiltinsCombinedHeaderGenerator):
+ (BuiltinsCombinedHeaderGenerator.__init__):
+ (BuiltinsCombinedHeaderGenerator.output_filename):
+ (BuiltinsCombinedHeaderGenerator.generate_output):
+ (BuiltinsCombinedHeaderGenerator.generate_forward_declarations):
+ (FunctionExecutable):
+ (VM):
+ (ConstructAbility):
+ (generate_section_for_object):
+ (generate_externs_for_object):
+ (generate_macros_for_object):
+ (generate_defines_for_object):
+ (generate_section_for_code_table_macro):
+ (generate_section_for_code_name_macro):
+ * Scripts/builtins/builtins_generate_combined_implementation.py: Added.
+ (BuiltinsCombinedImplementationGenerator):
+ (BuiltinsCombinedImplementationGenerator.__init__):
+ (BuiltinsCombinedImplementationGenerator.output_filename):
+ (BuiltinsCombinedImplementationGenerator.generate_output):
+ (BuiltinsCombinedImplementationGenerator.generate_header_includes):
+ * Scripts/builtins/builtins_generate_separate_header.py: Added.
+ (BuiltinsSeparateHeaderGenerator):
+ (BuiltinsSeparateHeaderGenerator.__init__):
+ (BuiltinsSeparateHeaderGenerator.output_filename):
+ (BuiltinsSeparateHeaderGenerator.macro_prefix):
+ (BuiltinsSeparateHeaderGenerator.generate_output):
+ (BuiltinsSeparateHeaderGenerator.generate_forward_declarations):
+ (FunctionExecutable):
+ (generate_header_includes):
+ (generate_section_for_object):
+ (generate_externs_for_object):
+ (generate_macros_for_object):
+ (generate_defines_for_object):
+ (generate_section_for_code_table_macro):
+ (generate_section_for_code_name_macro):
+ * Scripts/builtins/builtins_generate_separate_implementation.py: Added.
+ (BuiltinsSeparateImplementationGenerator):
+ (BuiltinsSeparateImplementationGenerator.__init__):
+ (BuiltinsSeparateImplementationGenerator.output_filename):
+ (BuiltinsSeparateImplementationGenerator.macro_prefix):
+ (BuiltinsSeparateImplementationGenerator.generate_output):
+ (BuiltinsSeparateImplementationGenerator.generate_header_includes):
+ * Scripts/builtins/builtins_generate_separate_wrapper.py: Added.
+ (BuiltinsSeparateWrapperGenerator):
+ (BuiltinsSeparateWrapperGenerator.__init__):
+ (BuiltinsSeparateWrapperGenerator.output_filename):
+ (BuiltinsSeparateWrapperGenerator.macro_prefix):
+ (BuiltinsSeparateWrapperGenerator.generate_output):
+ (BuiltinsSeparateWrapperGenerator.generate_header_includes):
+ * Scripts/generate-js-builtins.py: Added.
+
+ Parse command line options, decide which generators and output modes to use.
+
+ (generate_bindings_for_builtins_files):
+ * Scripts/lazywriter.py: Copied from the inspector protocol generator.
+ (LazyFileWriter):
+ (LazyFileWriter.__init__):
+ (LazyFileWriter.write):
+ (LazyFileWriter.close):
+ * Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Combined.js: Added.
+ * Scripts/tests/builtins/JavaScriptCore-Builtin.Promise-Separate.js: Added.
+ * Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js: Added.
+ * Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js: Added.
+ * Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Combined.js: Added.
+ * Scripts/tests/builtins/JavaScriptCore-BuiltinConstructor-Separate.js: Added.
+ * Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js: Added.
+ * Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js: Added.
+ * Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js: Added.
+ * Scripts/tests/builtins/WebCore-xmlCasingTest-Separate.js: Added.
+ * Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result: Added.
+ * Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result: Added.
+ * Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result: Added.
+ * Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result: Added.
+ * Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result: Added.
+ * Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result: Added.
+ * Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result: Added.
+ * Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result: Added.
+ * Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result: Added.
+ * Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result: Added.
+ * builtins/BuiltinExecutables.cpp:
+ (JSC::BuiltinExecutables::BuiltinExecutables):
+ * builtins/BuiltinExecutables.h:
+ * create_hash_table:
+
+ Update the generated builtin macro names.
+
+ * generate-js-builtins: Removed.
+
2015-10-21 Benjamin Poulain <bpoulain@apple.com>
[JSC] Remove FTL Native Inlining, it is dead code
udis86_itab.h \
Bytecodes.h \
InitBytecodes.asm \
- JSCBuiltins \
+ JSCBuiltins.h \
#
-# builtin functions
PYTHON = python
PERL = perl
endif
# --------
-.PHONY: JSCBuiltins
-JSCBuiltins: $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins JSCBuiltins.h JSCBuiltins.cpp
-JSCBuiltins.h: $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins $(JavaScriptCore)/builtins JSCBuiltinsSources
- $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins --input-directory $(JavaScriptCore)/builtins --output $@
-
-JSCBuiltins.cpp: JSCBuiltins.h
+# JavaScript builtins.
+
+BUILTINS_GENERATOR_SCRIPTS = \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins/__init__.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generator.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_model.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_templates.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_combined_header.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_combined_implementation.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_separate_header.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_separate_implementation.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_separate_wrapper.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/lazywriter.py \
+#
-.PHONY: JSCBuiltinsSources
-JSCBuiltinsSources: \
+JavaScriptCore_BUILTINS_SOURCES = \
$(JavaScriptCore)/builtins/ArrayConstructor.js \
$(JavaScriptCore)/builtins/ArrayIterator.prototype.js \
$(JavaScriptCore)/builtins/Array.prototype.js \
$(JavaScriptCore)/builtins/ReflectObject.js \
$(JavaScriptCore)/builtins/StringConstructor.js \
$(JavaScriptCore)/builtins/StringIterator.prototype.js \
+ $(JavaScriptCore)/builtins/TypedArrayConstructor.js \
+ $(JavaScriptCore)/builtins/TypedArray.prototype.js \
#
+# The combined output file depends on the contents of builtins and generator scripts, so
+# adding, modifying, or removing builtins or scripts will trigger regeneration of files.
+
+.PHONY: force
+JavaScriptCore_BUILTINS_DEPENDENCIES_LIST : $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py force
+ $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py '$(JavaScriptCore_BUILTINS_SOURCES) $(BUILTINS_GENERATOR_SCRIPTS)' $@
+
+JSCBuiltins.h: $(BUILTINS_GENERATOR_SCRIPTS) $(JavaScriptCore_BUILTINS_SOURCES) JavaScriptCore_BUILTINS_DEPENDENCIES_LIST
+ $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins.py --combined --output-directory . --framework JavaScriptCore $(JavaScriptCore_BUILTINS_SOURCES)
+
# lookup tables for classes
%.lut.h: create_hash_table %.cpp
# adding, modifying, or removing domains will trigger regeneration of inspector files.
.PHONY: force
-EnabledInspectorDomains : $(JavaScriptCore)/UpdateContents.py force
- $(PYTHON) $(JavaScriptCore)/UpdateContents.py '$(INSPECTOR_DOMAINS)' $@
+EnabledInspectorDomains : $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py force
+ $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py '$(INSPECTOR_DOMAINS)' $@
CombinedDomains.json : $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) EnabledInspectorDomains
$(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) > ./CombinedDomains.json
9928FF3B18AC4AEC00B8CF12 /* JSReplayInputs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9928FF3918AC4AEC00B8CF12 /* JSReplayInputs.cpp */; };
9928FF3C18AC4AEC00B8CF12 /* JSReplayInputs.h in Headers */ = {isa = PBXBuildFile; fileRef = 9928FF3A18AC4AEC00B8CF12 /* JSReplayInputs.h */; settings = {ATTRIBUTES = (Private, ); }; };
9959E92B1BD17FA4001AA413 /* cssmin.py in Headers */ = {isa = PBXBuildFile; fileRef = 9959E9271BD17FA0001AA413 /* cssmin.py */; settings = {ATTRIBUTES = (Private, ); }; };
- 9959E92C1BD17FA4001AA413 /* generate-js-builtins in Headers */ = {isa = PBXBuildFile; fileRef = 9959E9281BD17FA0001AA413 /* generate-js-builtins */; settings = {ATTRIBUTES = (Private, ); }; };
9959E92D1BD17FA4001AA413 /* jsmin.py in Headers */ = {isa = PBXBuildFile; fileRef = 9959E9291BD17FA0001AA413 /* jsmin.py */; settings = {ATTRIBUTES = (Private, ); }; };
9959E92E1BD17FA4001AA413 /* xxd.pl in Headers */ = {isa = PBXBuildFile; fileRef = 9959E92A1BD17FA0001AA413 /* xxd.pl */; settings = {ATTRIBUTES = (Private, ); }; };
9959E9311BD18272001AA413 /* generate-combined-inspector-json.py in Headers */ = {isa = PBXBuildFile; fileRef = 9959E92F1BD181F6001AA413 /* generate-combined-inspector-json.py */; settings = {ATTRIBUTES = (Private, ); }; };
996231E918D1804200C03FDA /* InspectorBackendCommands.js in Headers */ = {isa = PBXBuildFile; fileRef = A53243961856A475002ED692 /* InspectorBackendCommands.js */; settings = {ATTRIBUTES = (Private, ); }; };
99CC0B6218BE9946006CEBCC /* CodeGeneratorReplayInputsTemplates.py in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A1E18A1B1E70026D88F /* CodeGeneratorReplayInputsTemplates.py */; settings = {ATTRIBUTES = (Private, ); }; };
99CC0B6318BE9950006CEBCC /* CodeGeneratorReplayInputs.py in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A1D18A1B1E70026D88F /* CodeGeneratorReplayInputs.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00A31BD5993100F4575C /* builtins_generator.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA009A1BD5992700F4575C /* builtins_generator.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00A41BD5993100F4575C /* builtins_model.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA009B1BD5992700F4575C /* builtins_model.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00A51BD5993100F4575C /* builtins_templates.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA009C1BD5992700F4575C /* builtins_templates.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00A61BD5993100F4575C /* builtins.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA009D1BD5992700F4575C /* builtins.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00A71BD5993100F4575C /* builtins_generate_combined_header.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA009E1BD5992700F4575C /* builtins_generate_combined_header.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00A81BD5993100F4575C /* builtins_generate_combined_implementation.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA009F1BD5992700F4575C /* builtins_generate_combined_implementation.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00A91BD5993100F4575C /* builtins_generate_separate_header.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA00A01BD5992700F4575C /* builtins_generate_separate_header.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00AA1BD5993100F4575C /* builtins_generate_separate_implementation.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA00A11BD5992700F4575C /* builtins_generate_separate_implementation.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00AB1BD5993100F4575C /* builtins_generate_separate_wrapper.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA00A21BD5992700F4575C /* builtins_generate_separate_wrapper.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00AF1BD5994E00F4575C /* generate-js-builtins.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA00AC1BD5993E00F4575C /* generate-js-builtins.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00B01BD5994E00F4575C /* lazywriter.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA00AD1BD5993E00F4575C /* lazywriter.py */; settings = {ATTRIBUTES = (Private, ); }; };
+ 99DA00B11BD5994E00F4575C /* UpdateContents.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA00AE1BD5993E00F4575C /* UpdateContents.py */; settings = {ATTRIBUTES = (Private, ); }; };
99E45A2418A1B2590026D88F /* EmptyInputCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A1F18A1B2590026D88F /* EmptyInputCursor.h */; settings = {ATTRIBUTES = (Private, ); }; };
99E45A2518A1B2590026D88F /* EncodedValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 99E45A2018A1B2590026D88F /* EncodedValue.cpp */; };
99E45A2618A1B2590026D88F /* EncodedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A2118A1B2590026D88F /* EncodedValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE7C41961B97FC4B00F4D598 /* PingPongStackOverflowTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDA50D41B97F442009A3B4F /* PingPongStackOverflowTest.cpp */; };
FEA08620182B7A0400F6D851 /* Breakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861E182B7A0400F6D851 /* Breakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
FEA08621182B7A0400F6D851 /* DebuggerPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */; settings = {ATTRIBUTES = (Private, ); }; };
- FEB137571BB11EF900CD5100 /* MacroAssemblerARM64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEB137561BB11EEE00CD5100 /* MacroAssemblerARM64.cpp */; settings = {ASSET_TAGS = (); }; };
+ FEB137571BB11EF900CD5100 /* MacroAssemblerARM64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEB137561BB11EEE00CD5100 /* MacroAssemblerARM64.cpp */; };
FEB51F6C1A97B688001F921C /* Regress141809.mm in Sources */ = {isa = PBXBuildFile; fileRef = FEB51F6B1A97B688001F921C /* Regress141809.mm */; };
FEB58C14187B8B160098EF0B /* ErrorHandlingScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEB58C12187B8B160098EF0B /* ErrorHandlingScope.cpp */; };
FEB58C15187B8B160098EF0B /* ErrorHandlingScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FEB58C13187B8B160098EF0B /* ErrorHandlingScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
9928FF3A18AC4AEC00B8CF12 /* JSReplayInputs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReplayInputs.h; sourceTree = "<group>"; };
9928FF3D18AC4B1C00B8CF12 /* JSInputs.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = JSInputs.json; sourceTree = "<group>"; };
9959E9271BD17FA0001AA413 /* cssmin.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = cssmin.py; sourceTree = "<group>"; };
- 9959E9281BD17FA0001AA413 /* generate-js-builtins */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-js-builtins"; sourceTree = "<group>"; };
9959E9291BD17FA0001AA413 /* jsmin.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = jsmin.py; sourceTree = "<group>"; };
9959E92A1BD17FA0001AA413 /* xxd.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = xxd.pl; sourceTree = "<group>"; };
9959E92F1BD181F6001AA413 /* generate-combined-inspector-json.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-combined-inspector-json.py"; sourceTree = "<group>"; };
9959E9301BD181F6001AA413 /* inline-and-minify-stylesheets-and-scripts.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "inline-and-minify-stylesheets-and-scripts.py"; sourceTree = "<group>"; };
+ 99DA00991BD5992700F4575C /* __init__.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = "<group>"; };
+ 99DA009A1BD5992700F4575C /* builtins_generator.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_generator.py; sourceTree = "<group>"; };
+ 99DA009B1BD5992700F4575C /* builtins_model.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_model.py; sourceTree = "<group>"; };
+ 99DA009C1BD5992700F4575C /* builtins_templates.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_templates.py; sourceTree = "<group>"; };
+ 99DA009D1BD5992700F4575C /* builtins.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins.py; sourceTree = "<group>"; };
+ 99DA009E1BD5992700F4575C /* builtins_generate_combined_header.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_generate_combined_header.py; sourceTree = "<group>"; };
+ 99DA009F1BD5992700F4575C /* builtins_generate_combined_implementation.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_generate_combined_implementation.py; sourceTree = "<group>"; };
+ 99DA00A01BD5992700F4575C /* builtins_generate_separate_header.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_generate_separate_header.py; sourceTree = "<group>"; };
+ 99DA00A11BD5992700F4575C /* builtins_generate_separate_implementation.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_generate_separate_implementation.py; sourceTree = "<group>"; };
+ 99DA00A21BD5992700F4575C /* builtins_generate_separate_wrapper.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_generate_separate_wrapper.py; sourceTree = "<group>"; };
+ 99DA00AC1BD5993E00F4575C /* generate-js-builtins.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-js-builtins.py"; sourceTree = "<group>"; };
+ 99DA00AD1BD5993E00F4575C /* lazywriter.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = lazywriter.py; sourceTree = "<group>"; };
+ 99DA00AE1BD5993E00F4575C /* UpdateContents.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = UpdateContents.py; sourceTree = "<group>"; };
99E45A1D18A1B1E70026D88F /* CodeGeneratorReplayInputs.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = CodeGeneratorReplayInputs.py; sourceTree = "<group>"; };
99E45A1E18A1B1E70026D88F /* CodeGeneratorReplayInputsTemplates.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = CodeGeneratorReplayInputsTemplates.py; sourceTree = "<group>"; };
99E45A1F18A1B2590026D88F /* EmptyInputCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmptyInputCursor.h; sourceTree = "<group>"; };
034768DFFF38A50411DB9C8B /* Products */ = {
isa = PBXGroup;
children = (
+ 0FF922CF14F46B130041A24E /* JSCLLIntOffsetsExtractor */,
932F5BD90822A1C700736975 /* JavaScriptCore.framework */,
932F5BE10822A1C700736975 /* jsc */,
- 0FF922CF14F46B130041A24E /* JSCLLIntOffsetsExtractor */,
0FCEFAB61805D61600472CE4 /* libllvmForJSC.dylib */,
141211200A48793C00480255 /* minidom */,
14BD59BF0A3E8F9000BAF59C /* testapi */,
9959E9251BD17F1E001AA413 /* Scripts */ = {
isa = PBXGroup;
children = (
- 9959E9281BD17FA0001AA413 /* generate-js-builtins */,
+ 99DA00971BD598E000F4575C /* builtins */,
9959E9271BD17FA0001AA413 /* cssmin.py */,
9959E92F1BD181F6001AA413 /* generate-combined-inspector-json.py */,
+ 99DA00AC1BD5993E00F4575C /* generate-js-builtins.py */,
9959E9301BD181F6001AA413 /* inline-and-minify-stylesheets-and-scripts.py */,
9959E9291BD17FA0001AA413 /* jsmin.py */,
+ 99DA00AD1BD5993E00F4575C /* lazywriter.py */,
+ 99DA00AE1BD5993E00F4575C /* UpdateContents.py */,
9959E92A1BD17FA0001AA413 /* xxd.pl */,
);
path = Scripts;
sourceTree = "<group>";
};
+ 99DA00971BD598E000F4575C /* builtins */ = {
+ isa = PBXGroup;
+ children = (
+ 99DA00991BD5992700F4575C /* __init__.py */,
+ 99DA009D1BD5992700F4575C /* builtins.py */,
+ 99DA009E1BD5992700F4575C /* builtins_generate_combined_header.py */,
+ 99DA009F1BD5992700F4575C /* builtins_generate_combined_implementation.py */,
+ 99DA00A01BD5992700F4575C /* builtins_generate_separate_header.py */,
+ 99DA00A11BD5992700F4575C /* builtins_generate_separate_implementation.py */,
+ 99DA00A21BD5992700F4575C /* builtins_generate_separate_wrapper.py */,
+ 99DA009A1BD5992700F4575C /* builtins_generator.py */,
+ 99DA009B1BD5992700F4575C /* builtins_model.py */,
+ 99DA009C1BD5992700F4575C /* builtins_templates.py */,
+ );
+ path = builtins;
+ sourceTree = "<group>";
+ };
99E45A0C18A01E930026D88F /* replay */ = {
isa = PBXGroup;
children = (
FEA08620182B7A0400F6D851 /* Breakpoint.h in Headers */,
A7D801A51880D66E0026C39B /* BuiltinExecutables.h in Headers */,
A75EE9B218AAB7E200AAD043 /* BuiltinNames.h in Headers */,
+ 99DA00A61BD5993100F4575C /* builtins.py in Headers */,
+ 99DA00A71BD5993100F4575C /* builtins_generate_combined_header.py in Headers */,
+ 99DA00A81BD5993100F4575C /* builtins_generate_combined_implementation.py in Headers */,
+ 99DA00A91BD5993100F4575C /* builtins_generate_separate_header.py in Headers */,
+ 99DA00AA1BD5993100F4575C /* builtins_generate_separate_implementation.py in Headers */,
+ 99DA00AB1BD5993100F4575C /* builtins_generate_separate_wrapper.py in Headers */,
+ 99DA00A31BD5993100F4575C /* builtins_generator.py in Headers */,
+ 99DA00A41BD5993100F4575C /* builtins_model.py in Headers */,
+ 99DA00A51BD5993100F4575C /* builtins_templates.py in Headers */,
41DEA1321B9F3163006D65DD /* BuiltinUtils.h in Headers */,
9E72940B190F0514001A91B5 /* BundlePath.h in Headers */,
0FB7F39715ED8E4600F167B2 /* Butterfly.h in Headers */,
C2FC9BD316644DFB00810D33 /* CopiedBlockInlines.h in Headers */,
C2EAA3FA149A835E00FCE112 /* CopiedSpace.h in Headers */,
C2C8D02D14A3C6E000578E65 /* CopiedSpaceInlines.h in Headers */,
+ 0F7C11AD1BC3862C00C74CDB /* CopyBarrier.h in Headers */,
0F5A52D017ADD717008ECB2D /* CopyToken.h in Headers */,
C2239D1816262BDD005AC5FD /* CopyVisitor.h in Headers */,
C2239D1916262BDD005AC5FD /* CopyVisitorInlines.h in Headers */,
0F38B01A17CFE75500B144D3 /* DFGCompilationMode.h in Headers */,
0F3B3A1B153E68F4003ED0FF /* DFGConstantFoldingPhase.h in Headers */,
0FED67BA1B26256D0066CE15 /* DFGConstantHoistingPhase.h in Headers */,
+ 0F0981F81BC5E565004814F8 /* DFGCopyBarrierOptimizationPhase.h in Headers */,
0FBE0F7316C1DB050082C5E8 /* DFGCPSRethreadingPhase.h in Headers */,
A7D89CF617A0B8CC00773AD8 /* DFGCriticalEdgeBreakingPhase.h in Headers */,
0FFFC95A14EF90A900C72532 /* DFGCSEPhase.h in Headers */,
A54E8EB118BFFBBE00556D28 /* GCSegmentedArrayInlines.h in Headers */,
9959E9311BD18272001AA413 /* generate-combined-inspector-json.py in Headers */,
C4703CC0192844960013FBEA /* generate-inspector-protocol-bindings.py in Headers */,
- 9959E92C1BD17FA4001AA413 /* generate-js-builtins in Headers */,
+ 99DA00AF1BD5994E00F4575C /* generate-js-builtins.py in Headers */,
A5EA70EC19F5B3EA0098F5EC /* generate_cpp_alternate_backend_dispatcher_header.py in Headers */,
A5EF9B141A1D43F600702E90 /* generate_cpp_backend_dispatcher_header.py in Headers */,
A5EF9B151A1D43FA00702E90 /* generate_cpp_backend_dispatcher_implementation.py in Headers */,
0F766D2C15A8CC3A008F363E /* JITStubRoutineSet.h in Headers */,
0F5EF91F16878F7D003E5C25 /* JITThunks.h in Headers */,
0FC712E317CD8793008CC93C /* JITToDFGDeferredCompilationCallback.h in Headers */,
- 0F0981F81BC5E565004814F8 /* DFGCopyBarrierOptimizationPhase.h in Headers */,
A76F54A313B28AAB00EF2BCE /* JITWriteBarrier.h in Headers */,
840480131021A1D9008E7F01 /* JSAPIValueWrapper.h in Headers */,
C2CF39C216E15A8100DD69BE /* JSAPIWrapperObject.h in Headers */,
797E07AA1B8FCFB9008400BA /* JSGlobalLexicalEnvironment.h in Headers */,
BC18C4210E16F5CD00B34460 /* JSGlobalObject.h in Headers */,
A5FD0086189B1B7E00633231 /* JSGlobalObjectConsoleAgent.h in Headers */,
- 534C457C1BC72411007476A7 /* JSTypedArrayViewConstructor.h in Headers */,
A5C3A1A618C0490200C9593A /* JSGlobalObjectConsoleClient.h in Headers */,
A59455931824744700CC3843 /* JSGlobalObjectDebuggable.h in Headers */,
A57D23EA1891B0770031C7FA /* JSGlobalObjectDebuggerAgent.h in Headers */,
0F2B66FB17B6B5AB00A7AE3F /* JSTypedArrayConstructors.h in Headers */,
0F2B66FD17B6B5AB00A7AE3F /* JSTypedArrayPrototypes.h in Headers */,
0F2B66FF17B6B5AB00A7AE3F /* JSTypedArrays.h in Headers */,
+ 534C457C1BC72411007476A7 /* JSTypedArrayViewConstructor.h in Headers */,
DEA7E2451BBC677F00D78440 /* JSTypedArrayViewPrototype.h in Headers */,
6507D29E0E871E5E00D7D896 /* JSTypeInfo.h in Headers */,
0F2B670217B6B5AB00A7AE3F /* JSUint16Array.h in Headers */,
969A072A0ED1CE6900F1F681 /* Label.h in Headers */,
960097A60EBABB58007A7297 /* LabelScope.h in Headers */,
0FB5467714F59B5C002C2989 /* LazyOperandValueProfile.h in Headers */,
+ 99DA00B01BD5994E00F4575C /* lazywriter.py in Headers */,
BC18C4520E16F5CD00B34460 /* LegacyProfiler.h in Headers */,
BC18C4310E16F5CD00B34460 /* Lexer.h in Headers */,
BC18C52E0E16FCE100B34460 /* Lexer.lut.h in Headers */,
868916B0155F286300CB2B9A /* PrivateName.h in Headers */,
BC18C4500E16F5CD00B34460 /* Profile.h in Headers */,
95CD45770E1C4FDD0085358E /* ProfileGenerator.h in Headers */,
- 0F7C11AD1BC3862C00C74CDB /* CopyBarrier.h in Headers */,
BC18C4510E16F5CD00B34460 /* ProfileNode.h in Headers */,
0FF729A5166AD351000F5BA3 /* ProfilerBytecode.h in Headers */,
0FF729B9166AD360000F5BA3 /* ProfilerBytecodes.h in Headers */,
A7B601821639FD2A00372BA3 /* UnlinkedCodeBlock.h in Headers */,
14142E511B796ECE00F4BF4B /* UnlinkedFunctionExecutable.h in Headers */,
0F2E892C16D028AD009E4FD2 /* UnusedPointer.h in Headers */,
+ 99DA00B11BD5994E00F4575C /* UpdateContents.py in Headers */,
0F963B3813FC6FE90002D9B2 /* ValueProfile.h in Headers */,
0F426A481460CBB300131F8F /* ValueRecovery.h in Headers */,
79EE0C001B4AFB85000385C9 /* VariableEnvironment.h in Headers */,
0F63945415D07055006A597C /* ArrayProfile.cpp in Sources */,
147F39C0107EC37600427A48 /* ArrayPrototype.cpp in Sources */,
0F24E54017EA9F5900ABB217 /* AssemblyHelpers.cpp in Sources */,
- FEB137571BB11EF900CD5100 /* MacroAssemblerARM64.cpp in Sources */,
52678F8E1A031009006A306D /* BasicBlockLocation.cpp in Sources */,
0F64B2711A784BAF006E4E66 /* BinarySwitch.cpp in Sources */,
14280863107EC11A0013E7B2 /* BooleanConstructor.cpp in Sources */,
A77F1821164088B200640A47 /* CodeCache.cpp in Sources */,
0F8F9446166764F100D61971 /* CodeOrigin.cpp in Sources */,
86B5826714D2796C00A9C306 /* CodeProfile.cpp in Sources */,
- DE5A0A001BA3AC3E003D4424 /* IntrinsicEmitter.cpp in Sources */,
86B5826914D2797000A9C306 /* CodeProfiling.cpp in Sources */,
0F8F943C1667631300D61971 /* CodeSpecializationKind.cpp in Sources */,
0F8F94421667633500D61971 /* CodeType.cpp in Sources */,
1428082E107EC0570013E7B2 /* ConstructData.cpp in Sources */,
A57D23F11891B5B40031C7FA /* ContentSearchUtilities.cpp in Sources */,
52B717B51A0597E1007AF4F3 /* ControlFlowProfiler.cpp in Sources */,
+ 0FBADF541BD1F4B800E073C1 /* CopiedBlock.cpp in Sources */,
C240305514B404E60079EB64 /* CopiedSpace.cpp in Sources */,
C2239D1716262BDD005AC5FD /* CopyVisitor.cpp in Sources */,
2A111245192FCE79005EE18D /* CustomGetterSetter.cpp in Sources */,
0F38B01917CFE75500B144D3 /* DFGCompilationMode.cpp in Sources */,
0F3B3A1A153E68F2003ED0FF /* DFGConstantFoldingPhase.cpp in Sources */,
0FED67B91B26256D0066CE15 /* DFGConstantHoistingPhase.cpp in Sources */,
+ 0F0981F71BC5E565004814F8 /* DFGCopyBarrierOptimizationPhase.cpp in Sources */,
0FBE0F7216C1DB030082C5E8 /* DFGCPSRethreadingPhase.cpp in Sources */,
A7D89CF517A0B8CC00773AD8 /* DFGCriticalEdgeBreakingPhase.cpp in Sources */,
0FFFC95914EF90A600C72532 /* DFGCSEPhase.cpp in Sources */,
A1D792FE1B43864B004516F5 /* IntlNumberFormatConstructor.cpp in Sources */,
A1D793001B43864B004516F5 /* IntlNumberFormatPrototype.cpp in Sources */,
A12BBFF41B044A9800664B69 /* IntlObject.cpp in Sources */,
+ DE5A0A001BA3AC3E003D4424 /* IntrinsicEmitter.cpp in Sources */,
70113D4B1A8DB093003848C4 /* IteratorOperations.cpp in Sources */,
70DC3E091B2DF2C700054299 /* IteratorPrototype.cpp in Sources */,
A503FA19188E0FB000110F14 /* JavaScriptCallFrame.cpp in Sources */,
0F24E54C17EE274900ABB217 /* JITOperations.cpp in Sources */,
86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */,
A7C1E8E4112E72EF00A37F98 /* JITPropertyAccess32_64.cpp in Sources */,
- 0FBADF541BD1F4B800E073C1 /* CopiedBlock.cpp in Sources */,
0F766D2815A8CC1E008F363E /* JITStubRoutine.cpp in Sources */,
0F766D2B15A8CC38008F363E /* JITStubRoutineSet.cpp in Sources */,
0F5EF91E16878F7A003E5C25 /* JITThunks.cpp in Sources */,
0F2B66FA17B6B5AB00A7AE3F /* JSTypedArrayConstructors.cpp in Sources */,
0F2B66FC17B6B5AB00A7AE3F /* JSTypedArrayPrototypes.cpp in Sources */,
0F2B66FE17B6B5AB00A7AE3F /* JSTypedArrays.cpp in Sources */,
+ 534C457E1BC72549007476A7 /* JSTypedArrayViewConstructor.cpp in Sources */,
DEA7E2441BBC677200D78440 /* JSTypedArrayViewPrototype.cpp in Sources */,
86E3C61A167BABEE006D760A /* JSValue.mm in Sources */,
14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */,
14B723B212D7DA46003BD5ED /* MachineStackMarker.cpp in Sources */,
0FEB3ECF16237F6C00AB67AD /* MacroAssembler.cpp in Sources */,
86C568E011A213EE0007F7F0 /* MacroAssemblerARM.cpp in Sources */,
+ FEB137571BB11EF900CD5100 /* MacroAssemblerARM64.cpp in Sources */,
A729009C17976C6000317298 /* MacroAssemblerARMv7.cpp in Sources */,
FE68C6381B90DE0B0042BCB3 /* MacroAssemblerPrinter.cpp in Sources */,
A7A4AE0817973B26005612B1 /* MacroAssemblerX86Common.cpp in Sources */,
6540C7A01B82E1C3000F6B79 /* RegisterAtOffset.cpp in Sources */,
6540C7A11B82E1C3000F6B79 /* RegisterAtOffsetList.cpp in Sources */,
0FC3141518146D7000033232 /* RegisterSet.cpp in Sources */,
- 534C457E1BC72549007476A7 /* JSTypedArrayViewConstructor.cpp in Sources */,
A57D23ED1891B5540031C7FA /* RegularExpression.cpp in Sources */,
A5BA15E9182340B300A82E69 /* RemoteInspector.mm in Sources */,
A594558F18245EFD00CC3843 /* RemoteInspectorDebuggable.cpp in Sources */,
709FB86B1AE335C60039D069 /* WeakSetPrototype.cpp in Sources */,
2A4EC90B1860D6C20094F782 /* WriteBarrierBuffer.cpp in Sources */,
0FC8150B14043C0E00CFA603 /* WriteBarrierSupport.cpp in Sources */,
- 0F0981F71BC5E565004814F8 /* DFGCopyBarrierOptimizationPhase.cpp in Sources */,
A7E5AB3A1799E4B200D2833D /* X86Disassembler.cpp in Sources */,
863C6D9C1521111A00585E4E /* YarrCanonicalizeUCS2.cpp in Sources */,
86704B8412DBA33700A9FE7B /* YarrInterpreter.cpp in Sources */,
file(MAKE_DIRECTORY ${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore)
-file(GLOB _JavaScriptCore_Scripts "${JavaScriptCore_SCRIPTS_DIR}/*")
-foreach (_script ${_JavaScriptCore_Scripts})
- file(COPY ${_script} DESTINATION ${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore/Scripts)
-endforeach()
-
set(JavaScriptCore_POST_BUILD_COMMAND "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore/postBuild.cmd")
file(WRITE "${JavaScriptCore_POST_BUILD_COMMAND}" "@xcopy /y /d /f \"${DERIVED_SOURCES_DIR}/JavaScriptCore/*.h\" \"${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore\" >nul 2>nul\n")
file(APPEND "${JavaScriptCore_POST_BUILD_COMMAND}" "@xcopy /y /d /f \"${DERIVED_SOURCES_DIR}/JavaScriptCore/inspector/*.h\" \"${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore\" >nul 2>nul\n")
-file(APPEND "${JavaScriptCore_POST_BUILD_COMMAND}" "@xcopy /y /d /f \"${JavaScriptCore_SCRIPTS_DIR}/*.*\" \"${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore/Scripts\" >nul 2>nul\n")
+
foreach (_directory ${JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES})
file(APPEND "${JavaScriptCore_POST_BUILD_COMMAND}" "@xcopy /y /d /f \"${JAVASCRIPTCORE_DIR}/${_directory}/*.h\" \"${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore\" >nul 2>nul\n")
endforeach ()
# 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 puter, Inc. ("Apple") nor the names of
+# 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.
#
--- /dev/null
+# Required for Python to search this directory for module files
+
+from builtins import *
--- /dev/null
+# 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 *
+from builtins_generate_separate_wrapper import *
--- /dev/null
+#!/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))
+ 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.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_defines_for_object(self, object):
+ lines = []
+ for function in object.functions:
+ args = {
+ 'macroPrefix': self.model().framework.setting('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'),
+ }
+
+ 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'),
+ }
+
+ 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)
--- /dev/null
+#!/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_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_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))
--- /dev/null
+#!/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 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.upper(),
+ }
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(Templates.DoNotEditWarning).substitute(args))
+ sections.append(Template(Templates.HeaderIncludeGuardTop).substitute(args))
+ sections.append(self.generate_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))
+ 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;
+}"""
+
+ def generate_header_includes(self):
+ header_includes = [
+ (["WebCore"],
+ ("JavaScriptCore", "builtins/BuiltinUtils.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)
--- /dev/null
+#!/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),
+ }
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(Templates.DoNotEditWarning).substitute(args))
+ sections.append(self.generate_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))
+
+ return "\n\n".join(sections)
+
+ def generate_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))
--- /dev/null
+#!/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 BuiltinsSeparateWrapperGenerator(BuiltinsGenerator):
+ def __init__(self, model, object):
+ BuiltinsGenerator.__init__(self, model)
+ self.object = object
+
+ def output_filename(self):
+ return "%sBuiltinsWrapper.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(),
+ }
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(Templates.DoNotEditWarning).substitute(args))
+ sections.append(Template(Templates.HeaderIncludeGuardTop).substitute(args))
+ sections.append(self.generate_header_includes())
+ sections.append(Template(Templates.NamespaceTop).substitute(args))
+ sections.append(Template(Templates.SeparateWrapperHeaderBoilerplate).substitute(args))
+ sections.append(Template(Templates.NamespaceBottom).substitute(args))
+ sections.append(Template(Templates.HeaderIncludeGuardBottom).substitute(args))
+
+ return "\n\n".join(sections)
+
+ def generate_header_includes(self):
+ header_includes = [
+ (["WebCore"],
+ ("WebCore", "%sBuiltins.h" % self.object.object_name),
+ ),
+
+ (["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))
--- /dev/null
+#!/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')
+ 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))
+
+ sorted_includes = sorted(list(includes))
+ # Always include config.h and the counterpart header before other headers.
+ name, ext = os.path.splitext(self.output_filename())
+ if ext != '.h':
+ sorted_includes[:0] = [
+ "#include \"config.h\"",
+ "#include \"%s.h\"" % name,
+ "",
+ ]
+
+ return sorted_includes
+
+ 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)
--- /dev/null
+#!/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)
+
+
+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, functions):
+ self.object_name = object_name
+ 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)
+ 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_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, 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
+
+ # 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_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)
--- /dev/null
+#!/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
+
+#define ${macroPrefix}_BUILTIN_EXISTS(object, func) defined ${macroPrefix}_BUILTIN_ ## object ## _ ## func""")
+
+ SeparateHeaderStaticMacros = (
+ """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
+ JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
+
+${macroPrefix}_FOREACH_${objectName}_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
+#undef DECLARE_BUILTIN_GENERATOR
+
+#define ${macroPrefix}_BUILTIN_${objectName}_EXISTS(object, func) defined ${macroPrefix}_BUILTIN_ ## object ## _ ## func""")
+
+ 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
+""")
+
+ SeparateWrapperHeaderBoilerplate = (
+ """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
+}
+
+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
+}
+""")
+++ /dev/null
-#!/usr/bin/python
-# Copyright (C) 2014 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.
-
-import argparse
-import filecmp
-import fnmatch
-import os
-import re
-import shutil
-import sys
-import datetime
-import json
-
-parser = argparse.ArgumentParser()
-parser.add_argument('input_file', nargs='*', help='Input JS files which builtins generated from')
-parser.add_argument('--input-directory', help='All JS files will be used as input from this directory.')
-parser.add_argument('--output', help='path to output cpp or h file')
-parser.add_argument('--prefix', default='JSC', help='prefix used for public macros')
-parser.add_argument('--namespace', default='JSC', help='C++ namespace')
-args = parser.parse_args()
-
-copyrightText = """ *
- * 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.
- */\n
-"""
-
-generatorString = "/* Generated by %s do not hand edit. */\n" % os.path.basename(__file__)
-
-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)
-
-def getCopyright(source):
- copyrightBlock = multilineCommentRegExp.findall(source)[0]
- copyrightBlock = copyrightBlock[:copyrightBlock.index("Redistribution")]
- copyRightLines = []
-
- for line in copyrightBlock.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 list(set(copyRightLines))
-
-class Function(object):
- def __init__(self, name, source, isConstructor, parameters):
- self.name = name
- self.source = source
- self.isConstructor = isConstructor
- self.parameters = parameters
-
- def mangleName(self, object):
- qName = object + "." + self.name
- mangledName = ""
- i = 0
- while i < len(qName):
- if qName[i] == '.':
- mangledName = mangledName + qName[i + 1].upper()
- i = i + 1
- else:
- mangledName = mangledName + qName[i]
- i = i + 1
- if self.isConstructor:
- mangledName = mangledName + "Constructor"
- return mangledName
-
-def getFunctions(source):
-
- source = multilineCommentRegExp.sub("/**/", singleLineCommentRegExp.sub("//\n", source))
-
- matches = [ f for f in functionHeadRegExp.finditer(source)]
- functionBounds = []
- start = 0
- end = 0
- for match in matches:
- start = match.start()
- if start < end:
- continue
- end = match.end()
- while source[end] != '{':
- end = end + 1
- depth = 1
- end = end + 1
- while depth > 0:
- if source[end] == '{':
- depth = depth + 1
- elif source[end] == '}':
- depth = depth - 1
- end = end + 1
- functionBounds.append((start, end))
-
- functions = [source[start:end].strip() for (start, end) in functionBounds]
- result = []
- for function in functions:
- function = multilineCommentRegExp.sub("", function)
- functionName = functionNameRegExp.findall(function)[0]
- functionIsConstructor = functionIsConstructorRegExp.match(function) != None
- functionParameters = functionParameterFinder.findall(function)[0].split(',')
- if len(functionParameters[0]) == 0:
- functionParameters = []
-
- result.append(Function(functionName, function, functionIsConstructor, functionParameters))
- return result
-
-def writeIncludeDirectives(writer, headerNames):
- for headerName in headerNames:
- writer.write("#include " + headerName + "\n")
-
-def generateCode(source):
- inputFile = open(source, "r")
- baseName = os.path.basename(source).replace(".js", "")
-
- source = ""
- for line in inputFile:
- source = source + line
-
- if sys.platform == "cygwin":
- source = source.replace("\r\n", "\n")
- return (baseName, getFunctions(source), getCopyright(source))
-
-builtins = []
-copyrights = []
-(output_base, _) = os.path.splitext(args.output)
-
-if args.input_directory:
- for file in os.listdir(args.input_directory):
- args.input_file.append(os.path.join(args.input_directory, file))
-
-for file in args.input_file:
- if fnmatch.fnmatch(file, '*.js'):
- (baseName, functions, objectCopyrights) = generateCode(file)
- copyrights.extend(objectCopyrights)
- builtins.append((baseName, functions))
-namespace = args.namespace
-macroPrefix = args.prefix
-scopeName = os.path.splitext(os.path.basename(args.output))[0]
-includeGuard = scopeName + "_H"
-headerName = scopeName + ".h"
-
-headerIncludes = ["\"BuiltinUtils.h\""] if namespace == "JSC" else ["<builtins/BuiltinUtils.h>"]
-contentIncludes = ["\"BuiltinExecutables.h\"", "\"Executable.h\"", "\"JSCellInlines.h\"", "\"VM.h\""] if namespace == "JSC" else ["<runtime/Executable.h>", "<runtime/StructureInlines.h>", "<runtime/JSCJSValueInlines.h>", "<runtime/JSCellInlines.h>", "<runtime/VM.h>", "\"WebCoreJSClientData.h\""]
-
-copyrights = list(set(copyrights))
-
-copyrightBody = ""
-for copyright in copyrights:
- copyrightBody = copyrightBody +" * Copyright (C) " + copyright + "\n"
-
-builtinsHeader = open(output_base + ".h.tmp", "w")
-builtinsImplementation = open(output_base + ".cpp.tmp", "w")
-copyrightText = "/*\n" + copyrightBody + copyrightText
-builtinsHeader.write("""%s
-%s
-
-#ifndef %s
-#define %s
-
-""" % (generatorString, copyrightText, includeGuard, includeGuard))
-
-writeIncludeDirectives(builtinsHeader, headerIncludes)
-
-builtinsHeader.write("""
-namespace JSC {
- class FunctionExecutable;
-}
-
-namespace %s {
-
-""" % namespace)
-
-codeReferences = []
-
-for (objectName, functions) in builtins:
- print("Generating bindings for the %s builtin." % objectName)
- builtinsHeader.write("/* %s functions */\n" % objectName)
- for function in functions:
- name = function.name
- mangledName = function.mangleName(objectName)
- mangledName = mangledName[0].lower() + mangledName[1:] + "Code"
- codeReferences.append((mangledName, function))
- builtinsHeader.write("extern const char* s_%s;\n" % mangledName)
- builtinsHeader.write("extern const int s_%sLength;\n" % mangledName)
- builtinsHeader.write("extern const JSC::ConstructAbility s_%sConstructAbility;\n" % mangledName)
- builtinsHeader.write("\n")
- builtinsHeader.write("#define %s_FOREACH_%s_BUILTIN(macro) \\\n" % (macroPrefix, objectName.replace(".", "_").upper()))
- for function in functions:
- mangledName = function.mangleName(objectName)
- builtinsHeader.write(" macro(%s, %s, %d) \\\n" % (function.name, mangledName, len(function.parameters)))
- builtinsHeader.write("\n")
- for function in functions:
- builtinsHeader.write("#define %s_BUILTIN_%s 1\n" % (macroPrefix, function.mangleName(objectName).upper()))
- builtinsHeader.write("\n\n")
-names = []
-builtinsHeader.write("#define %s_FOREACH_BUILTIN(macro)\\\n" % macroPrefix)
-for (codeReference, function) in codeReferences:
- builtinsHeader.write(" macro(%s, %s, s_%sLength) \\\n" % (codeReference, function.name, codeReference))
- names.append(function.name)
-
-builtinsHeader.write("\n\n")
-builtinsHeader.write("#define %s_FOREACH_BUILTIN_FUNCTION_NAME(macro) \\\n" % macroPrefix)
-for name in sorted(set(names)):
- builtinsHeader.write(" macro(%s) \\\n" % name)
-builtinsHeader.write("""
-
-#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
- JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
-
-%s_FOREACH_BUILTIN(DECLARE_BUILTIN_GENERATOR)
-#undef DECLARE_BUILTIN_GENERATOR
-
-#define %s_BUILTIN_EXISTS(name) defined %s_BUILTIN_ ## name
-
-}
-
-#endif // %s
-
-""" % (macroPrefix, macroPrefix, macroPrefix, includeGuard))
-
-builtinsImplementation.write("""%s
-%s
-
-#include "config.h"
-
-#include "%s"
-
-""" % (generatorString, copyrightText, headerName))
-
-writeIncludeDirectives(builtinsImplementation, contentIncludes)
-
-builtinsImplementation.write("""
-namespace %s {
-
-""" % (namespace))
-
-
-
-for (codeReference, function) in codeReferences:
- source = function.source
- source = "(function " + source[source.index("("):] + ")"
- lines = json.dumps(source)[1:-1].split("\\n")
- sourceLength = len(source)
- source = ""
- for line in lines:
- source = source + (" \"%s\\n\" \\\n" % line)
- builtinsImplementation.write("const char* s_%s =\n%s;\n\n" % (codeReference, source))
- builtinsImplementation.write("const int s_%sLength = %d;\n\n" % (codeReference, sourceLength + 1)) # + 1 for \n
- constructAbility = "JSC::ConstructAbility::CannotConstruct"
- if function.isConstructor:
- constructAbility = "JSC::ConstructAbility::CanConstruct"
- builtinsImplementation.write("const JSC::ConstructAbility s_%sConstructAbility = %s;\n\n" % (codeReference, constructAbility)) # + 1 for \n
-
-builtinsImplementation.write("""
-#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
-JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
-""");
-
-if (namespace == "JSC"):
- builtinsImplementation.write("""{\\
- return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); \\
-""")
-else:
- builtinName = scopeName[0].lower() + scopeName[1:]
- builtinsImplementation.write("""{\\
- JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \\
- return clientData->builtinFunctions().%s().codeName##Executable()->link(vm, clientData->builtinFunctions().%s().codeName##Source()); \\
-"""% (builtinName, builtinName))
-
-builtinsImplementation.write("""}
-%s_FOREACH_BUILTIN(DEFINE_BUILTIN_GENERATOR)
-#undef DEFINE_BUILTIN_GENERATOR
-}
-
-"""% (macroPrefix))
-
-builtinsHeader.close()
-builtinsImplementation.close()
-
-if (not os.path.exists(output_base + ".h")) or (not filecmp.cmp(output_base + ".h.tmp", output_base + ".h", shallow=False)):
- if (os.path.exists(output_base + ".h")):
- os.remove(output_base + ".h")
- os.rename(output_base + ".h.tmp", output_base + ".h")
-else:
- os.remove(output_base + ".h.tmp")
-
-if (not os.path.exists(output_base + ".cpp")) or (not filecmp.cmp(output_base + ".cpp.tmp", output_base + ".cpp", shallow=False)):
- if (os.path.exists(output_base + ".cpp")):
- os.remove(output_base + ".cpp")
- os.rename(output_base + ".cpp.tmp", output_base + ".cpp")
-else:
- os.remove(output_base + ".cpp.tmp")
--- /dev/null
+#!/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))
+
+ if model.framework is Frameworks.WebCore:
+ generators.append(BuiltinsSeparateWrapperGenerator(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.
--- /dev/null
+#!/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()
--- /dev/null
+/*
+ * 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);
+}
--- /dev/null
+/*
+ * 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);
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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.
+ */
+
+// @optional=STREAMS_API
+
+function isReadableStreamLocked(stream)
+{
+ "use strict";
+
+ return !!stream.@reader;
+}
+
+
+function cancelReadableStream(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 promiseInvokeOrNoop(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);
+ }
+}
--- /dev/null
+/*
+ * 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.
+ */
+
+// @optional=STREAMS_API
+// @internal
+
+function isReadableStreamLocked(stream)
+{
+ "use strict";
+
+ return !!stream.@reader;
+}
+
+
+function cancelReadableStream(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 promiseInvokeOrNoop(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);
+ }
+}
--- /dev/null
+/*
+ * 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;
+}
+
+
+function cancelReadableStream(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 promiseInvokeOrNoop(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);
+ }
+}
--- /dev/null
+/*
+ * 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.
+ */
+
+// @optional=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);
+ }
+}
--- /dev/null
+### 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_BUILTIN_BUILTINPROMISE_REJECTPROMISE 1
+#define JSC_BUILTIN_BUILTINPROMISE_FULFILLPROMISE 1
+
+#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
+
+#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_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
--- /dev/null
+### 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
+
+#define JSC_BUILTIN_BUILTIN.PROMISE_EXISTS(object, func) defined JSC_BUILTIN_ ## object ## _ ## func
+
+} // 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
--- /dev/null
+### 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_BUILTIN_BUILTINPROTOTYPE_EVERY 1
+#define JSC_BUILTIN_BUILTINPROTOTYPE_FOREACH 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
+
+#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) 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
--- /dev/null
+### 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
+
+#define JSC_BUILTIN_BUILTIN.PROTOTYPE_EXISTS(object, func) defined JSC_BUILTIN_ ## object ## _ ## func
+
+} // 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
--- /dev/null
+### 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_BUILTIN_BUILTINCONSTRUCTOR_OF 1
+#define JSC_BUILTIN_BUILTINCONSTRUCTOR_FROM 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
+
+#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 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
--- /dev/null
+### 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
+
+#define JSC_BUILTIN_BUILTINCONSTRUCTOR_EXISTS(object, func) defined JSC_BUILTIN_ ## object ## _ ## func
+
+} // 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
--- /dev/null
+### 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
--- /dev/null
+### 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
+
+#include <builtins/BuiltinUtils.h>
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace WebCore {
+
+/* GuardedBuiltin */
+extern const char* s_guardedBuiltinIsReadableStreamLockedCode;
+extern const int s_guardedBuiltinIsReadableStreamLockedCodeLength;
+extern const JSC::ConstructAbility s_guardedBuiltinIsReadableStreamLockedCodeConstructAbility;
+extern const char* s_guardedBuiltinCancelReadableStreamCode;
+extern const int s_guardedBuiltinCancelReadableStreamCodeLength;
+extern const JSC::ConstructAbility s_guardedBuiltinCancelReadableStreamCodeConstructAbility;
+extern const char* s_guardedBuiltinPromiseInvokeOrNoopCode;
+extern const int s_guardedBuiltinPromiseInvokeOrNoopCodeLength;
+extern const JSC::ConstructAbility s_guardedBuiltinPromiseInvokeOrNoopCodeConstructAbility;
+
+#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_DATA(macro) \
+ macro(isReadableStreamLocked, guardedBuiltinIsReadableStreamLocked, 1) \
+ macro(cancelReadableStream, guardedBuiltinCancelReadableStream, 2) \
+ macro(promiseInvokeOrNoop, guardedBuiltinPromiseInvokeOrNoop, 3) \
+
+#define WEBCORE_BUILTIN_GUARDEDBUILTIN_ISREADABLESTREAMLOCKED 1
+#define WEBCORE_BUILTIN_GUARDEDBUILTIN_CANCELREADABLESTREAM 1
+#define WEBCORE_BUILTIN_GUARDEDBUILTIN_PROMISEINVOKEORNOOP 1
+
+#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(macro) \
+ macro(guardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_guardedBuiltinIsReadableStreamLockedCodeLength) \
+ macro(guardedBuiltinCancelReadableStreamCode, cancelReadableStream, s_guardedBuiltinCancelReadableStreamCodeLength) \
+ macro(guardedBuiltinPromiseInvokeOrNoopCode, promiseInvokeOrNoop, s_guardedBuiltinPromiseInvokeOrNoopCodeLength) \
+
+#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
+ macro(cancelReadableStream) \
+ macro(isReadableStreamLocked) \
+ macro(promiseInvokeOrNoop) \
+
+#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
+
+#define WEBCORE_BUILTIN_GUARDEDBUILTIN_EXISTS(object, func) defined WEBCORE_BUILTIN_ ## object ## _ ## func
+
+} // namespace WebCore
+
+#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"
+
+#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" \
+;
+
+const JSC::ConstructAbility s_guardedBuiltinCancelReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_guardedBuiltinCancelReadableStreamCodeLength = 402;
+const char* s_guardedBuiltinCancelReadableStreamCode =
+ "(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_guardedBuiltinPromiseInvokeOrNoopCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_guardedBuiltinPromiseInvokeOrNoopCodeLength = 338;
+const char* s_guardedBuiltinPromiseInvokeOrNoopCode =
+ "(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().guardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Source()); \
+}
+WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace WebCore
+### End File: GuardedBuiltinBuiltins.cpp
+
+### Begin File: GuardedBuiltinBuiltinsWrapper.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 GuardedBuiltinBuiltinsWrapper_h
+#define GuardedBuiltinBuiltinsWrapper_h
+
+#include "GuardedBuiltinBuiltins.h"
+#include <builtins/BuiltinUtils.h>
+#include <bytecode/UnlinkedFunctionExecutable.h>
+#include <runtime/Identifier.h>
+#include <runtime/JSFunction.h>
+
+namespace WebCore {
+
+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
+}
+
+class GuardedBuiltinBuiltinFunctions {
+public:
+ explicit GuardedBuiltinBuiltinFunctions(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_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+};
+
+inline void GuardedBuiltinBuiltinFunctions::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_GUARDEDBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION)
+#undef EXPORT_FUNCTION
+}
+
+inline void GuardedBuiltinBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
+{
+#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
+ WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
+#undef VISIT_FUNCTION
+}
+
+
+} // namespace WebCore
+
+#endif // GuardedBuiltinBuiltinsWrapper_h
+
+### End File: GuardedBuiltinBuiltinsWrapper.h
--- /dev/null
+### 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
+
+#include <builtins/BuiltinUtils.h>
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace WebCore {
+
+/* GuardedInternalBuiltin */
+extern const char* s_guardedInternalBuiltinIsReadableStreamLockedCode;
+extern const int s_guardedInternalBuiltinIsReadableStreamLockedCodeLength;
+extern const JSC::ConstructAbility s_guardedInternalBuiltinIsReadableStreamLockedCodeConstructAbility;
+extern const char* s_guardedInternalBuiltinCancelReadableStreamCode;
+extern const int s_guardedInternalBuiltinCancelReadableStreamCodeLength;
+extern const JSC::ConstructAbility s_guardedInternalBuiltinCancelReadableStreamCodeConstructAbility;
+extern const char* s_guardedInternalBuiltinPromiseInvokeOrNoopCode;
+extern const int s_guardedInternalBuiltinPromiseInvokeOrNoopCodeLength;
+extern const JSC::ConstructAbility s_guardedInternalBuiltinPromiseInvokeOrNoopCodeConstructAbility;
+
+#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_DATA(macro) \
+ macro(isReadableStreamLocked, guardedInternalBuiltinIsReadableStreamLocked, 1) \
+ macro(cancelReadableStream, guardedInternalBuiltinCancelReadableStream, 2) \
+ macro(promiseInvokeOrNoop, guardedInternalBuiltinPromiseInvokeOrNoop, 3) \
+
+#define WEBCORE_BUILTIN_GUARDEDINTERNALBUILTIN_ISREADABLESTREAMLOCKED 1
+#define WEBCORE_BUILTIN_GUARDEDINTERNALBUILTIN_CANCELREADABLESTREAM 1
+#define WEBCORE_BUILTIN_GUARDEDINTERNALBUILTIN_PROMISEINVOKEORNOOP 1
+
+#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(macro) \
+ macro(guardedInternalBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_guardedInternalBuiltinIsReadableStreamLockedCodeLength) \
+ macro(guardedInternalBuiltinCancelReadableStreamCode, cancelReadableStream, s_guardedInternalBuiltinCancelReadableStreamCodeLength) \
+ macro(guardedInternalBuiltinPromiseInvokeOrNoopCode, promiseInvokeOrNoop, s_guardedInternalBuiltinPromiseInvokeOrNoopCodeLength) \
+
+#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
+ macro(cancelReadableStream) \
+ macro(isReadableStreamLocked) \
+ macro(promiseInvokeOrNoop) \
+
+#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
+
+#define WEBCORE_BUILTIN_GUARDEDINTERNALBUILTIN_EXISTS(object, func) defined WEBCORE_BUILTIN_ ## object ## _ ## func
+
+} // namespace WebCore
+
+#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"
+
+#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" \
+;
+
+const JSC::ConstructAbility s_guardedInternalBuiltinCancelReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_guardedInternalBuiltinCancelReadableStreamCodeLength = 402;
+const char* s_guardedInternalBuiltinCancelReadableStreamCode =
+ "(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_guardedInternalBuiltinPromiseInvokeOrNoopCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_guardedInternalBuiltinPromiseInvokeOrNoopCodeLength = 338;
+const char* s_guardedInternalBuiltinPromiseInvokeOrNoopCode =
+ "(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().guardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Source()); \
+}
+WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
+#undef DEFINE_BUILTIN_GENERATOR
+
+
+} // namespace WebCore
+### End File: GuardedInternalBuiltinBuiltins.cpp
+
+### Begin File: GuardedInternalBuiltinBuiltinsWrapper.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 GuardedInternalBuiltinBuiltinsWrapper_h
+#define GuardedInternalBuiltinBuiltinsWrapper_h
+
+#include "GuardedInternalBuiltinBuiltins.h"
+#include <builtins/BuiltinUtils.h>
+#include <bytecode/UnlinkedFunctionExecutable.h>
+#include <runtime/Identifier.h>
+#include <runtime/JSFunction.h>
+
+namespace WebCore {
+
+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 // GuardedInternalBuiltinBuiltinsWrapper_h
+
+### End File: GuardedInternalBuiltinBuiltinsWrapper.h
--- /dev/null
+### 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>
+
+namespace JSC {
+class FunctionExecutable;
+}
+
+namespace WebCore {
+
+/* UnguardedBuiltin */
+extern const char* s_unguardedBuiltinIsReadableStreamLockedCode;
+extern const int s_unguardedBuiltinIsReadableStreamLockedCodeLength;
+extern const JSC::ConstructAbility s_unguardedBuiltinIsReadableStreamLockedCodeConstructAbility;
+extern const char* s_unguardedBuiltinCancelReadableStreamCode;
+extern const int s_unguardedBuiltinCancelReadableStreamCodeLength;
+extern const JSC::ConstructAbility s_unguardedBuiltinCancelReadableStreamCodeConstructAbility;
+extern const char* s_unguardedBuiltinPromiseInvokeOrNoopCode;
+extern const int s_unguardedBuiltinPromiseInvokeOrNoopCodeLength;
+extern const JSC::ConstructAbility s_unguardedBuiltinPromiseInvokeOrNoopCodeConstructAbility;
+
+#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_DATA(macro) \
+ macro(isReadableStreamLocked, unguardedBuiltinIsReadableStreamLocked, 1) \
+ macro(cancelReadableStream, unguardedBuiltinCancelReadableStream, 2) \
+ macro(promiseInvokeOrNoop, unguardedBuiltinPromiseInvokeOrNoop, 3) \
+
+#define WEBCORE_BUILTIN_UNGUARDEDBUILTIN_ISREADABLESTREAMLOCKED 1
+#define WEBCORE_BUILTIN_UNGUARDEDBUILTIN_CANCELREADABLESTREAM 1
+#define WEBCORE_BUILTIN_UNGUARDEDBUILTIN_PROMISEINVOKEORNOOP 1
+
+#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(macro) \
+ macro(unguardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_unguardedBuiltinIsReadableStreamLockedCodeLength) \
+ macro(unguardedBuiltinCancelReadableStreamCode, cancelReadableStream, s_unguardedBuiltinCancelReadableStreamCodeLength) \
+ macro(unguardedBuiltinPromiseInvokeOrNoopCode, promiseInvokeOrNoop, s_unguardedBuiltinPromiseInvokeOrNoopCodeLength) \
+
+#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
+ macro(cancelReadableStream) \
+ macro(isReadableStreamLocked) \
+ macro(promiseInvokeOrNoop) \
+
+#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
+
+#define WEBCORE_BUILTIN_UNGUARDEDBUILTIN_EXISTS(object, func) defined WEBCORE_BUILTIN_ ## object ## _ ## func
+
+} // 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" \
+;
+
+const JSC::ConstructAbility s_unguardedBuiltinCancelReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_unguardedBuiltinCancelReadableStreamCodeLength = 402;
+const char* s_unguardedBuiltinCancelReadableStreamCode =
+ "(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_unguardedBuiltinPromiseInvokeOrNoopCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const int s_unguardedBuiltinPromiseInvokeOrNoopCodeLength = 338;
+const char* s_unguardedBuiltinPromiseInvokeOrNoopCode =
+ "(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().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
+
+### Begin File: UnguardedBuiltinBuiltinsWrapper.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 UnguardedBuiltinBuiltinsWrapper_h
+#define UnguardedBuiltinBuiltinsWrapper_h
+
+#include "UnguardedBuiltinBuiltins.h"
+#include <builtins/BuiltinUtils.h>
+#include <bytecode/UnlinkedFunctionExecutable.h>
+#include <runtime/Identifier.h>
+#include <runtime/JSFunction.h>
+
+namespace WebCore {
+
+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
+}
+
+class UnguardedBuiltinBuiltinFunctions {
+public:
+ explicit UnguardedBuiltinBuiltinFunctions(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_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
+#undef DECLARE_BUILTIN_SOURCE_MEMBERS
+};
+
+inline void UnguardedBuiltinBuiltinFunctions::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_UNGUARDEDBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION)
+#undef EXPORT_FUNCTION
+}
+
+inline void UnguardedBuiltinBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
+{
+#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
+ WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
+#undef VISIT_FUNCTION
+}
+
+
+} // namespace WebCore
+
+#endif // UnguardedBuiltinBuiltinsWrapper_h
+
+### End File: UnguardedBuiltinBuiltinsWrapper.h
--- /dev/null
+### 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
+
+#include <builtins/BuiltinUtils.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
+
+#define WEBCORE_BUILTIN_XMLCASINGTEST_EXISTS(object, func) defined WEBCORE_BUILTIN_ ## object ## _ ## func
+
+} // namespace WebCore
+
+#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"
+
+#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
+### End File: xmlCasingTestBuiltins.cpp
+
+### Begin File: xmlCasingTestBuiltinsWrapper.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 xmlCasingTestBuiltinsWrapper_h
+#define xmlCasingTestBuiltinsWrapper_h
+
+#include "xmlCasingTestBuiltins.h"
+#include <builtins/BuiltinUtils.h>
+#include <bytecode/UnlinkedFunctionExecutable.h>
+#include <runtime/Identifier.h>
+#include <runtime/JSFunction.h>
+
+namespace WebCore {
+
+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 // xmlCasingTestBuiltinsWrapper_h
+
+### End File: xmlCasingTestBuiltinsWrapper.h
BuiltinExecutables::BuiltinExecutables(VM& vm)
: m_vm(vm)
#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(makeSource(StringImpl::createFromLiteral(s_##name, length)))
- JSC_FOREACH_BUILTIN(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
+ JSC_FOREACH_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
#undef EXPOSE_BUILTIN_STRINGS
{
}
m_##name##Executable = Weak<UnlinkedFunctionExecutable>(createBuiltinExecutable(m_##name##Source, m_vm.propertyNames->builtinNames().functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
return m_##name##Executable.get();\
}
-JSC_FOREACH_BUILTIN(DEFINE_BUILTIN_EXECUTABLES)
+JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
#undef EXPOSE_BUILTIN_SOURCES
}
UnlinkedFunctionExecutable* name##Executable(); \
const SourceCode& name##Source() { return m_##name##Source; }
- JSC_FOREACH_BUILTIN(EXPOSE_BUILTIN_EXECUTABLES)
+ JSC_FOREACH_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
#undef EXPOSE_BUILTIN_SOURCES
UnlinkedFunctionExecutable* createDefaultConstructor(ConstructorKind, const Identifier& name);
#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length)\
SourceCode m_##name##Source; \
Weak<UnlinkedFunctionExecutable> m_##name##Executable;
- JSC_FOREACH_BUILTIN(DECLARE_BUILTIN_SOURCE_MEMBERS)
+ JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
#undef DECLARE_BUILTIN_SOURCE_MEMBERS
};
if ($values[$i]{"type"} eq "Function") {
my $tableHead = $name;
$tableHead =~ s/Table$//;
- print " #if JSC_BUILTIN_EXISTS(" . uc($tableHead . $key) .")\n";
+ print " #if JSC_BUILTIN_EXISTS(" . uc($tableHead) . ", " . uc($key) .")\n";
print " { \"$key\", (($attrs[$i]) & ~Function) | Builtin, $intrinsic, { (intptr_t)static_cast<BuiltinGenerator>(" . $tableHead . ucfirst($key) . "CodeGenerator), (intptr_t)$secondValue } },\n";
print " #else\n"
}
${WebCore_SVG_IDL_FILES}
)
-if (WIN32)
- if (INTERNAL_BUILD)
- set(JavaScriptCore_SCRIPTS_DIR "${CMAKE_BINARY_DIR}/../include/private/JavaScriptCore/Scripts")
- else ()
- set(JavaScriptCore_SCRIPTS_DIR "${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore/Scripts")
- endif ()
+if (WIN32 AND INTERNAL_BUILD)
+ set(JavaScriptCore_SCRIPTS_DIR "${CMAKE_BINARY_DIR}/../include/private/JavaScriptCore/Scripts")
else ()
- set(JavaScriptCore_SCRIPTS_DIR "${JAVASCRIPTCORE_DIR}/Scripts")
+ set(JavaScriptCore_SCRIPTS_DIR "${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore/Scripts")
endif ()
set(WebCore_SOURCES
set(DEDICATEDWORKERGLOBALSCOPE_CONSTRUCTORS_FILE ${DERIVED_SOURCES_WEBCORE_DIR}/DedicatedWorkerGlobalScopeConstructors.idl)
set(IDL_ATTRIBUTES_FILE ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.txt)
-set(WEBCORE_JS_BUILTINS
- ${WEBCORE_DIR}/Modules/mediastream/MediaDevices.js
- ${WEBCORE_DIR}/Modules/streams/ByteLengthQueuingStrategy.js
- ${WEBCORE_DIR}/Modules/streams/CountQueuingStrategy.js
- ${WEBCORE_DIR}/Modules/streams/ReadableStream.js
- ${WEBCORE_DIR}/Modules/streams/ReadableStreamController.js
- ${WEBCORE_DIR}/Modules/streams/ReadableStreamInternals.js
- ${WEBCORE_DIR}/Modules/streams/ReadableStreamReader.js
- ${WEBCORE_DIR}/Modules/streams/StreamInternals.js
- ${WEBCORE_DIR}/Modules/streams/WritableStream.js
- ${WEBCORE_DIR}/Modules/streams/WritableStreamInternals.js
-)
-
WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
# Generate InspectorOverlayPage.h
${ADDITIONAL_BINDINGS_DEPENDENCIES})
# WebCore JS Builtins
-foreach (_builtinjs ${WEBCORE_JS_BUILTINS})
- get_filename_component(_name ${_builtinjs} NAME_WE)
+
+set(WebCore_BUILTINS_SOURCES
+ ${WEBCORE_DIR}/Modules/mediastream/MediaDevices.js
+ ${WEBCORE_DIR}/Modules/streams/ByteLengthQueuingStrategy.js
+ ${WEBCORE_DIR}/Modules/streams/CountQueuingStrategy.js
+ ${WEBCORE_DIR}/Modules/streams/ReadableStream.js
+ ${WEBCORE_DIR}/Modules/streams/ReadableStreamController.js
+ ${WEBCORE_DIR}/Modules/streams/ReadableStreamInternals.js
+ ${WEBCORE_DIR}/Modules/streams/ReadableStreamReader.js
+ ${WEBCORE_DIR}/Modules/streams/StreamInternals.js
+ ${WEBCORE_DIR}/Modules/streams/WritableStream.js
+)
+
+set(BUILTINS_GENERATOR_SCRIPTS
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generator.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_model.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_templates.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_combined_header.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_combined_implementation.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_separate_header.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_separate_implementation.py
+ ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_separate_wrapper.py
+ ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py
+ ${JavaScriptCore_SCRIPTS_DIR}/lazywriter.py
+)
+
+foreach (_builtinSource ${WebCore_BUILTINS_SOURCES})
+ get_filename_component(_objectName ${_builtinSource} NAME_WE)
add_custom_command(
- OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}BuiltinsWrapper.h ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}Builtins.h ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}Builtins.cpp
- MAIN_DEPENDENCY ${WEBCORE_DIR}/generate-js-builtins
- DEPENDS ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins
- DEPENDS ${_builtinjs}
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate-js-builtins --input ${_builtinjs} --output_dir ${DERIVED_SOURCES_WEBCORE_DIR} --generate_js_builtins_path ${JavaScriptCore_SCRIPTS_DIR}
+ OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_objectName}Builtins.cpp
+ ${DERIVED_SOURCES_WEBCORE_DIR}/${_objectName}Builtins.h
+ ${DERIVED_SOURCES_WEBCORE_DIR}/${_objectName}BuiltinsWrapper.h
+ MAIN_DEPENDENCY ${_builtinSource}
+ DEPENDS ${BUILTINS_GENERATOR_SCRIPTS}
+ COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py --framework WebCore --output-directory ${DERIVED_SOURCES_WEBCORE_DIR} ${_builtinSource}
VERBATIM)
list(APPEND WebCore_SOURCES
- ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}Builtins.h
- ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}BuiltinsWrapper.h
+ ${DERIVED_SOURCES_WEBCORE_DIR}/${_objectName}Builtins.h
+ ${DERIVED_SOURCES_WEBCORE_DIR}/${_objectName}BuiltinsWrapper.h
)
- ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/bindings/js/WebCoreJSBuiltins.cpp ${_name}Builtins.cpp)
+ ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/bindings/js/WebCoreJSBuiltins.cpp ${_objectName}Builtins.cpp)
endforeach ()
+
ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/html/HTMLTreeBuilder.cpp MathMLNames.cpp)
+2015-10-21 Brian Burg <bburg@apple.com>
+
+ Restructure generate-js-bindings script to be modular and testable
+ https://bugs.webkit.org/show_bug.cgi?id=149929
+
+ Reviewed by Alex Christensen.
+
+ * CMakeLists.txt:
+
+ Define JavaScriptCore_SCRIPTS_DIR explicitly so the add_custom_command and
+ shared file lists are identical between JavaScriptCore and WebCore.
+
+ The output files additionally depend on all builtin generator script files.
+
+ * DerivedSources.make:
+
+ Use JavaScriptCore_SCRIPTS_DIR so that the rule for code generation and
+ shared file lists are identical between JavaScriptCore and WebCore.
+
+ The output files additionally depend on all builtin generator script files.
+
+ * WebCore.xcodeproj/project.pbxproj:
+
+ Define JavaScriptCore_SCRIPTS_DIR before calling DerivedSources.make.
+ This will eventually be merged with the other similar script paths.
+
+ * bindings/js/JSDOMWindowBase.cpp:
+ (WebCore::JSDOMWindowBase::finishCreation):
+
+ Update the generated builtin macro names.
+
+ * generate-js-builtins: Removed.
+
2015-10-21 Alex Christensen <achristensen@webkit.org>
Recommit r191428.
$(WORKERGLOBALSCOPE_CONSTRUCTORS_FILE) \
$(JS_DOM_HEADERS) \
$(WEB_DOM_HEADERS) \
- $(WEBCORE_JS_BUILTINS) \
\
CSSGrammar.cpp \
CSSPropertyNames.cpp \
# WebCore JS Builtins
-WEBCORE_JS_BUILTINS = \
+WebCore_BUILTINS_SOURCES = \
$(WebCore)/Modules/mediastream/MediaDevices.js \
$(WebCore)/Modules/streams/ByteLengthQueuingStrategy.js \
$(WebCore)/Modules/streams/CountQueuingStrategy.js \
$(WebCore)/Modules/streams/WritableStreamInternals.js \
#
-all : $(WEBCORE_JS_BUILTINS:%.js=%Builtins.cpp)
+BUILTINS_GENERATOR_SCRIPTS = \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins_generator.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins_model.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins_templates.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins_generate_combined_header.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins_generate_combined_implementation.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins_generate_separate_header.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins_generate_separate_implementation.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/builtins_generate_separate_wrapper.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins.py \
+ $(JavaScriptCore_SCRIPTS_DIR)/lazywriter.py \
+#
+
+# Adding/removing scripts should trigger regeneration, but changing which builtins are
+# generated should not affect other builtins when not passing '--combined' to the generator.
+
+.PHONY: force
+WebCore_BUILTINS_DEPENDENCIES_LIST : $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py force
+ $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py '$(BUILTINS_GENERATOR_SCRIPTS)' $@
+
+%Builtins.h: %.js $(BUILTINS_GENERATOR_SCRIPTS) WebCore_BUILTINS_DEPENDENCIES_LIST
+ $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins.py --output-directory . --framework WebCore $<
-%Builtins.cpp: %.js
- $(PYTHON) $(WebCore)/generate-js-builtins --input $< --generate_js_builtins_path $(JavaScriptCore_SCRIPTS_DIR)
+all : $(notdir $(WebCore_BUILTINS_SOURCES:%.js=%Builtins.h))
# ------------------------
2D5002F81B56D7810020AAF7 /* DOMPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D5002F71B56D7810020AAF7 /* DOMPath.cpp */; };
2D5002FB1B56D7990020AAF7 /* PathUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D5002F91B56D7990020AAF7 /* PathUtilities.cpp */; };
2D5002FC1B56D7990020AAF7 /* PathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5002FA1B56D7990020AAF7 /* PathUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 2D5036681BCDDDC400E20BB3 /* GestureEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D5036671BCDDDC400E20BB3 /* GestureEvents.cpp */; settings = {ASSET_TAGS = (); }; };
+ 2D5036681BCDDDC400E20BB3 /* GestureEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D5036671BCDDDC400E20BB3 /* GestureEvents.cpp */; };
2D5646B01B8F8493003C4994 /* DictionaryPopupInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5646AF1B8F8493003C4994 /* DictionaryPopupInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D58D8551A15F65F00A5F726 /* DataDetection.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D58D8531A15F65F00A5F726 /* DataDetection.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D58D8561A15F65F00A5F726 /* DataDetection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D58D8541A15F65F00A5F726 /* DataDetection.mm */; };
BC779E171BB227CA00CAA8BF /* StyleCustomPropertyData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC779E151BB226A200CAA8BF /* StyleCustomPropertyData.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC7D8FEF1BD03B6400FFE540 /* CSSUnsetValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7D8FED1BD03B6400FFE540 /* CSSUnsetValue.cpp */; };
BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7D8FEE1BD03B6400FFE540 /* CSSUnsetValue.h */; };
- BC7D8FF31BD1A47900FFE540 /* CSSRevertValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7D8FF11BD1A47900FFE540 /* CSSRevertValue.cpp */; settings = {ASSET_TAGS = (); }; };
- BC7D8FF41BD1A47900FFE540 /* CSSRevertValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7D8FF21BD1A47900FFE540 /* CSSRevertValue.h */; settings = {ASSET_TAGS = (); }; };
+ BC7D8FF31BD1A47900FFE540 /* CSSRevertValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7D8FF11BD1A47900FFE540 /* CSSRevertValue.cpp */; };
+ BC7D8FF41BD1A47900FFE540 /* CSSRevertValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7D8FF21BD1A47900FFE540 /* CSSRevertValue.h */; };
BC7F44A80B9E324E00A9D081 /* ImageObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F44A70B9E324E00A9D081 /* ImageObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC7FA6200D1F0CBD00DB22A9 /* LiveNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7FA61E0D1F0CBD00DB22A9 /* LiveNodeList.cpp */; };
BC7FA6210D1F0CBD00DB22A9 /* LiveNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7FA61F0D1F0CBD00DB22A9 /* LiveNodeList.h */; };
98CE4325129E00BD005821DC /* LinkLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkLoader.cpp; sourceTree = "<group>"; };
98CE4329129E00E5005821DC /* LinkLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkLoader.h; sourceTree = "<group>"; };
98EB1F941313FE0500D0E1EA /* NotImplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotImplemented.h; sourceTree = "<group>"; };
- 9908B0EC1BCACF1F00ED0F65 /* generate-js-builtins */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-js-builtins"; sourceTree = "<group>"; };
9908B0ED1BCACF9100ED0F65 /* ByteLengthQueuingStrategy.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = ByteLengthQueuingStrategy.js; sourceTree = "<group>"; };
9908B0EE1BCACF9100ED0F65 /* CountQueuingStrategy.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = CountQueuingStrategy.js; sourceTree = "<group>"; };
9908B0EF1BCACF9100ED0F65 /* ReadableStream.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = ReadableStream.js; sourceTree = "<group>"; };
9908B1001BCAD07D00ED0F65 /* ReadableStreamReaderBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamReaderBuiltinsWrapper.h; sourceTree = "<group>"; };
9920398018B95BC600B39AF9 /* UserInputBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserInputBridge.cpp; sourceTree = "<group>"; };
9920398118B95BC600B39AF9 /* UserInputBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInputBridge.h; sourceTree = "<group>"; };
+ 9994E5D81BD843A300F2D835 /* MediaDevices.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = MediaDevices.js; sourceTree = "<group>"; };
99C7CCB218C663E40032E413 /* MemoizedDOMResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoizedDOMResult.h; sourceTree = "<group>"; };
99C7CCB418C6B8990032E413 /* MemoizedDOMResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoizedDOMResult.cpp; sourceTree = "<group>"; };
99CC0B3818BE9849006CEBCC /* AllReplayInputs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllReplayInputs.h; sourceTree = "<group>"; };
5EA725CD1ACABCD900EAD17B /* MediaDevices.cpp */,
5EA725CE1ACABCD900EAD17B /* MediaDevices.h */,
5EA725CF1ACABCD900EAD17B /* MediaDevices.idl */,
+ 9994E5D81BD843A300F2D835 /* MediaDevices.js */,
07394EC71BAB2CCD00BE99CD /* MediaDevicesRequest.cpp */,
07394EC91BAB2CD700BE99CD /* MediaDevicesRequest.h */,
07C59B6517F784BA000FBCBB /* MediaSourceStates.cpp */,
0867D691FE84028FC02AAC07 /* WebKit */ = {
isa = PBXGroup;
children = (
- 9908B0EC1BCACF1F00ED0F65 /* generate-js-builtins */,
65C97AF208EA908800ACD273 /* config.h */,
EDEC98020AED7E170059137F /* WebCorePrefix.h */,
9307061309E0CA8200B17FE4 /* DerivedSources.make */,
1A1414B413A0F0500019996C /* WebKitFontFamilyNames.h */,
99CC0B6818BEA1FF006CEBCC /* WebReplayInputs.cpp */,
99CC0B6918BEA1FF006CEBCC /* WebReplayInputs.h */,
+ 9908B0F91BCAD07D00ED0F75 /* WritableStreamBuiltins.cpp */,
9B03D8061BB3110D00B764E8 /* WritableStreamBuiltins.h */,
9B03D8071BB3110D00B764E8 /* WritableStreamBuiltinsWrapper.h */,
- 9908B0F91BCAD07D00ED0F75 /* WritableStreamBuiltins.cpp */,
9908B0FD1BCAD07D00ED0F75 /* WritableStreamInternalsBuiltins.cpp */,
9B03D8061BB3110D00B764E9 /* WritableStreamInternalsBuiltins.h */,
9B03D8071BB3110D00B764EA /* WritableStreamInternalsBuiltinsWrapper.h */,
9746AF2614F4DDE6003E7A70 /* GeolocationController.cpp in Sources */,
0FB6252E18DE1B1500A07C05 /* GeometryUtilities.cpp in Sources */,
46C83EFD1A9BBE2900A79A41 /* GeoNotifier.cpp in Sources */,
+ 2D5036681BCDDDC400E20BB3 /* GestureEvents.cpp in Sources */,
B2AFFC830D00A5C10030074D /* GlyphPageMac.cpp in Sources */,
BC53C6080DA56C570021EB5D /* Gradient.cpp in Sources */,
BC53C60B0DA56CF10021EB5D /* GradientCG.cpp in Sources */,
0705853317FDE6D9005F2BCB /* JSMediaTrackConstraints.cpp in Sources */,
0705853517FDE6D9005F2BCB /* JSMediaTrackConstraintSet.cpp in Sources */,
E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */,
- 0FEF20CE1BD4A24100128E5D /* LengthSize.cpp in Sources */,
E1A5F99B0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp in Sources */,
75793EC80D0CE72D007FC0AC /* JSMessageEvent.cpp in Sources */,
410B7E721045FAB000D8224F /* JSMessageEventCustom.cpp in Sources */,
51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */,
BCE65BEA0EACDF16007E4533 /* Length.cpp in Sources */,
E55F497A151B888000BB67DB /* LengthFunctions.cpp in Sources */,
+ 0FEF20CE1BD4A24100128E5D /* LengthSize.cpp in Sources */,
FFB698CC1833EE0D00158A31 /* LineBreaker.cpp in Sources */,
89B5EAA111E8003D00F2367E /* LineEnding.cpp in Sources */,
FFB698CF183402BB00158A31 /* LineInfo.cpp in Sources */,
D302754912A5FE84004BD828 /* RenderDetailsMarker.cpp in Sources */,
9B32CDAA13DF7FA900F34D13 /* RenderedPosition.cpp in Sources */,
E43A023D17EB3713004CDD25 /* RenderElement.cpp in Sources */,
- 0FEF20D01BD4A64F00128E5D /* RenderStyleConstants.cpp in Sources */,
0F5B7A5410F65D7A00376302 /* RenderEmbeddedObject.cpp in Sources */,
A8EA73C30A1900E300A8EF5F /* RenderFieldset.cpp in Sources */,
066C77300AB603FD00238CC4 /* RenderFileUploadControl.cpp in Sources */,
AB247A6C0AFD6383003FA5FD /* RenderSlider.cpp in Sources */,
31955A86160D199000858025 /* RenderSnapshottedPlugIn.cpp in Sources */,
BC8C8FAD0DDCD31B00B592F4 /* RenderStyle.cpp in Sources */,
+ 0FEF20D01BD4A64F00128E5D /* RenderStyleConstants.cpp in Sources */,
0F4E57171313276200CF85AF /* RenderSVGAllInOne.cpp in Sources */,
A8DF4AEC0980C42C0052981B /* RenderTable.cpp in Sources */,
6ED878C4147493F4004C3597 /* RenderTableCaption.cpp in Sources */,
24D912B713CA9A6900D21915 /* SVGAltGlyphItemElement.cpp in Sources */,
B22279760D00BF220071B782 /* SVGAngle.cpp in Sources */,
B22279790D00BF220071B782 /* SVGAnimateColorElement.cpp in Sources */,
- 2D5036681BCDDDC400E20BB3 /* GestureEvents.cpp in Sources */,
4362C7B913AC6F1A00344BEB /* SVGAnimatedAngle.cpp in Sources */,
431A308813B8F978007791E4 /* SVGAnimatedBoolean.cpp in Sources */,
43A625F913B3304000AC94B8 /* SVGAnimatedColor.cpp in Sources */,
GlobalPropertyInfo(\
static_cast<JSVMClientData*>(vm.clientData)->builtinFunctions().readableStreamInternalsBuiltins().name##PrivateName(), \
m_privateFunctions.readableStreamInternals().m_##name##Function.get() , DontDelete | ReadOnly),
- WEBCOREREADABLESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
+ WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
#undef DECLARE_GLOBAL_STATIC
#define DECLARE_GLOBAL_STATIC(name)\
GlobalPropertyInfo(\
static_cast<JSVMClientData*>(vm.clientData)->builtinFunctions().streamInternalsBuiltins().name##PrivateName(), \
m_privateFunctions.streamInternals().m_##name##Function.get() , DontDelete | ReadOnly),
- WEBCORESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
+ WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
#undef DECLARE_GLOBAL_STATIC
#define DECLARE_GLOBAL_STATIC(name)\
GlobalPropertyInfo(\
static_cast<JSVMClientData*>(vm.clientData)->builtinFunctions().writableStreamInternalsBuiltins().name##PrivateName(), \
m_privateFunctions.writableStreamInternals().m_##name##Function.get() , DontDelete | ReadOnly),
- WEBCOREWRITABLESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
+ WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
#undef DECLARE_GLOBAL_STATIC
#endif
};
+++ /dev/null
-#!/usr/bin/python
-# 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.
-
-
-import argparse
-import filecmp
-import os
-import subprocess
-
-from string import Template
-
-
-parser = argparse.ArgumentParser()
-parser.add_argument('--output_dir', default='', help='output directory')
-parser.add_argument('--input', help='path to input JS file')
-parser.add_argument('--generate_js_builtins_path', help='path to directory containing JavaScriptCore\'s generate-js-builtins')
-
-args = parser.parse_args()
-filename = os.path.splitext(os.path.basename(args.input))[0]
-
-# generate JS builtins
-namespace = "WebCore"
-prefix = "WEBCORE" + filename.upper()
-output = os.path.join(args.output_dir, filename + "Builtins")
-jsc_generate_builtin_script = os.path.join(args.generate_js_builtins_path, "generate-js-builtins")
-
-subprocess.call(["python", jsc_generate_builtin_script, "--output", output, "--namespace", namespace, "--prefix", prefix, args.input], stderr=subprocess.STDOUT)
-
-# generate JS builtins wrapper
-output_base = output + "Wrapper"
-
-builtinsWrapperHeader = open(output_base + ".h.tmp", "w")
-
-builtinsWrapperHeader.write(Template(
-"""
-/* Generated by generate-js-builtins do not hand edit. */
-
-/*
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef ${Filename}BuiltinsWrapper_h
-#define ${Filename}BuiltinsWrapper_h
-
-#include "${Filename}Builtins.h"
-#include <bytecode/UnlinkedFunctionExecutable.h>
-#include <builtins/BuiltinUtils.h>
-#include <runtime/Identifier.h>
-#include <runtime/JSFunction.h>
-
-namespace WebCore {
-
-class ${Filename}BuiltinsWrapper : private JSC::WeakHandleOwner {
-public:
- explicit ${Filename}BuiltinsWrapper(JSC::VM* vm)
- : m_vm(*vm)
- ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
-#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length)))
- ${Prefix}_FOREACH_BUILTIN(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; }
- ${Prefix}_FOREACH_BUILTIN(EXPOSE_BUILTIN_EXECUTABLES)
-#undef EXPOSE_BUILTIN_EXECUTABLES
-
- ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
-
- void exportNames();
-
-private:
- JSC::VM& m_vm;
-
- ${Prefix}_FOREACH_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;
- ${Prefix}_FOREACH_BUILTIN(DECLARE_BUILTIN_SOURCE_MEMBERS)
-#undef DECLARE_BUILTIN_SOURCE_MEMBERS
-
-};
-
-#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \\
-inline JSC::UnlinkedFunctionExecutable* ${Filename}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();\\
-}
-${Prefix}_FOREACH_BUILTIN(DEFINE_BUILTIN_EXECUTABLES)
-#undef DEFINE_BUILTIN_EXECUTABLES
-
-inline void ${Filename}BuiltinsWrapper::exportNames()
-{
-#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
- ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
-#undef EXPORT_FUNCTION_NAME
-}
-
-class ${Filename}BuiltinFunctions {
-public:
- explicit ${Filename}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;
- ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
-#undef DECLARE_BUILTIN_SOURCE_MEMBERS
-};
-
-inline void ${Filename}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));
- ${Prefix}_FOREACH_BUILTIN(EXPORT_FUNCTION)
-#undef EXPORT_FUNCTION
-}
-
-inline void ${Filename}BuiltinFunctions::visit(JSC::SlotVisitor& visitor)
-{
-#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
- ${Prefix}_FOREACH_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
-#undef VISIT_FUNCTION
-}
-
-} // namespace WebCore
-
-#endif // ${Filename}BuiltinsWrapper_h
-""").substitute(dict(Filename=filename, Prefix=prefix)))
-
-builtinsWrapperHeader.close()
-
-if (not os.path.exists(output_base + ".h")) or (not filecmp.cmp(output_base + ".h.tmp", output_base + ".h", shallow=False)):
- if (os.path.exists(output_base + ".h")):
- os.remove(output_base + ".h")
- os.rename(output_base + ".h.tmp", output_base + ".h")
-else:
- os.remove(output_base + ".h.tmp")
+2015-10-21 Brian Burg <bburg@apple.com>
+
+ Restructure generate-js-bindings script to be modular and testable
+ https://bugs.webkit.org/show_bug.cgi?id=149929
+
+ Reviewed by Alex Christensen.
+
+ Add a stub shell script and basic webkitpy support for running builtins
+ generator tests.
+
+ * Scripts/run-builtins-generator-tests: Added.
+ (main):
+ * Scripts/webkitpy/codegen/__init__.py: Added.
+ * Scripts/webkitpy/codegen/main.py: Added.
+
+ The only interesting difference here from the inspector protocol
+ generator equivalent is that this implementation decodes the target
+ framework and output mode (combined or separate) from the test's file name.
+
+ (BuiltinsGeneratorTests):
+ (BuiltinsGeneratorTests.__init__):
+ (BuiltinsGeneratorTests.generate_from_js_builtins):
+ (BuiltinsGeneratorTests.write_error_file):
+ (BuiltinsGeneratorTests.detect_changes):
+ (BuiltinsGeneratorTests.run_tests):
+ (BuiltinsGeneratorTests.main):
+
2015-10-21 Aakash Jain <aakash_jain@apple.com>
run-webkit-tests does not copy all crash logs for layout test failures on Mac
--- /dev/null
+#!/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 sys
+from webkitpy.common.system import executive
+
+def main(argv):
+ """Runs the JS builtins code generator on test input files and compares
+ the results with reference files.
+
+ Options:
+ --reset-results: Overwrites the reference files with the generated results.
+
+ """
+ reset_results = "--reset-results" in argv
+
+ from webkitpy.codegen.main import BuiltinsGeneratorTests
+ return BuiltinsGeneratorTests(reset_results, executive.Executive()).main()
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
--- /dev/null
+# Required for Python to search this directory for module files
--- /dev/null
+# Copyright (C) 2011 Google Inc. All rights reserved.
+# Copyright (C) 2014 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 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
+# HOLDER 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.
+
+import os
+import os.path
+import shutil
+import sys
+import tempfile
+from webkitpy.common.checkout.scm.detection import detect_scm_system
+from webkitpy.common.system.executive import ScriptError
+
+
+class BuiltinsGeneratorTests:
+
+ def __init__(self, reset_results, executive):
+ self.reset_results = reset_results
+ self.executive = executive
+
+ def generate_from_js_builtins(self, builtins_file, output_directory, framework_name="", combined_outputs=False):
+ cmd = ['python',
+ 'JavaScriptCore/Scripts/generate-js-builtins.py',
+ '--output-directory', output_directory,
+ '--force',
+ '--framework', framework_name,
+ '--test']
+
+ if combined_outputs:
+ cmd.append('--combined')
+
+ cmd.append(builtins_file)
+
+ exit_code = 0
+ try:
+ stderr_output = self.executive.run_command(cmd)
+ if stderr_output:
+ self.write_error_file(builtins_file, output_directory, stderr_output)
+ except ScriptError, e:
+ print e.output
+ exit_code = e.exit_code
+ return exit_code
+
+ def write_error_file(self, input_filepath, output_directory, error_output):
+ output_filepath = os.path.join(output_directory, os.path.basename(input_filepath) + '-error')
+
+ with open(output_filepath, "w") as output_file:
+ output_file.write(error_output)
+
+ def detect_changes(self, work_directory, reference_directory):
+ changes_found = False
+ for output_file in os.listdir(work_directory):
+ cmd = ['diff',
+ '-u',
+ '-N',
+ os.path.join(reference_directory, output_file),
+ os.path.join(work_directory, output_file)]
+
+ exit_code = 0
+ try:
+ output = self.executive.run_command(cmd)
+ except ScriptError, e:
+ output = e.output
+ exit_code = e.exit_code
+
+ if exit_code or output:
+ print 'FAIL: %s' % output_file
+ print output
+ changes_found = True
+ else:
+ print 'PASS: %s' % output_file
+ return changes_found
+
+ def run_tests(self, input_directory, reference_directory):
+ work_directory = reference_directory
+
+ passed = True
+ for input_file in os.listdir(input_directory):
+ (test_name, extension) = os.path.splitext(input_file)
+ if extension != '.js':
+ continue
+ # Generate output into the work directory (either the given one or a
+ # temp one if not reset_results is performed)
+ if not self.reset_results:
+ work_directory = tempfile.mkdtemp()
+
+ (framework_name, test_case, output_mode) = test_name.split('-')
+ if not framework_name or not output_mode or not test_case:
+ print "Invalid test case name: should be Framework-TestCaseName-OutputMode.js"
+ continue
+
+ combined_outputs = output_mode == "Combined"
+ if self.generate_from_js_builtins(os.path.join(input_directory, input_file), work_directory, framework_name=framework_name, combined_outputs=combined_outputs):
+ passed = False
+
+ if self.reset_results:
+ print "Reset results for test: %s" % (input_file)
+ continue
+
+ # Detect changes
+ if self.detect_changes(work_directory, reference_directory):
+ passed = False
+ shutil.rmtree(work_directory)
+
+ return passed
+
+ def main(self):
+ current_scm = detect_scm_system(os.curdir)
+ os.chdir(os.path.join(current_scm.checkout_root, 'Source'))
+
+ all_tests_passed = True
+
+ input_directory = os.path.join('JavaScriptCore', 'Scripts', 'tests', 'builtins')
+ reference_directory = os.path.join('JavaScriptCore', 'Scripts', 'tests', 'builtins', 'expected')
+ if not self.run_tests(input_directory, reference_directory):
+ all_tests_passed = False
+
+ print ''
+ if all_tests_passed:
+ print 'All tests PASS!'
+ return 0
+ else:
+ print 'Some tests FAIL! (To update the reference files, execute "run-builtins-generator-tests --reset-results")'
+ return -1