Title: [222499] trunk
Revision
222499
Author
[email protected]
Date
2017-09-26 08:34:19 -0700 (Tue, 26 Sep 2017)

Log Message

JSC build should use unified sources for derived sources
https://bugs.webkit.org/show_bug.cgi?id=177421

Reviewed by JF Bastien.

.:

* Source/cmake/WebKitMacros.cmake:

Source/_javascript_Core:

This patch make a couple of changes:

1) Make derived sources added to relevant bundles. I was going to add JSCBuiltins.cpp
to runtime but that kept breaking the windows build. I'll get back to it later
2) Move the derived location of some sources both for clarity and for ease of use.
3) Make auto generator scripts able to create directories if needed.
4) Move some scripts from the top level of the _javascript_Core directory to a
more appropriate directory.
5) Move some CMake generation commands around for clarity.

* CMakeLists.txt:
* DerivedSources.make:
* _javascript_Core.xcodeproj/project.pbxproj:
* Scripts/lazywriter.py:
(LazyFileWriter.close):
* Sources.txt:
* inspector/scripts/generate-inspector-protocol-bindings.py:
(IncrementalFileWriter.close):
* yarr/create_regex_tables: Renamed from Source/_javascript_Core/create_regex_tables.
* yarr/generateYarrCanonicalizeUnicode: Renamed from Source/_javascript_Core/generateYarrCanonicalizeUnicode.

Source/WTF:

The script now needs to determine if a file is from a derived
source. This is only relevant for the CMake build since the
script needs to provide a list of the bundled source files. If the
script does not provide the full path for derived sources then
CMake will be unable to find them and the build will fail.

Additionally, I move the error message for the Xcode build outside
the main loop. This means that the error message will contain all
the files you need to add to Xcode and all those files will now be
written in DerivedSources so they should be easier to add.

* Scripts/generate-unified-source-bundles.rb:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/ChangeLog (222498 => 222499)


--- trunk/ChangeLog	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/ChangeLog	2017-09-26 15:34:19 UTC (rev 222499)
@@ -1,3 +1,12 @@
+2017-09-24  Keith Miller  <[email protected]>
+
+        JSC build should use unified sources for derived sources
+        https://bugs.webkit.org/show_bug.cgi?id=177421
+
+        Reviewed by JF Bastien.
+
+        * Source/cmake/WebKitMacros.cmake:
+
 2017-09-26  Zan Dobersek  <[email protected]>
 
         [CMake] Use implicit include directories for Clang as well

Modified: trunk/Source/_javascript_Core/CMakeLists.txt (222498 => 222499)


--- trunk/Source/_javascript_Core/CMakeLists.txt	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/_javascript_Core/CMakeLists.txt	2017-09-26 15:34:19 UTC (rev 222499)
@@ -40,6 +40,8 @@
     "${FORWARDING_HEADERS_DIR}"
     "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
     "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector"
+    "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/runtime"
+    "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr"
 )
 
 set(_javascript_Core_SYSTEM_INCLUDE_DIRECTORIES
@@ -356,24 +358,20 @@
 
 #GENERATOR: "RegExpJitTables.h": tables used by Yarr
 add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
-    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables
-    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
+    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/RegExpJitTables.h
+    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/yarr/create_regex_tables
+    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/yarr/create_regex_tables ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/RegExpJitTables.h
     VERBATIM)
-list(APPEND _javascript_Core_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
-WEBKIT_ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
+list(APPEND _javascript_Core_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/RegExpJitTables.h)
+WEBKIT_ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/RegExpJitTables.h)
 
 add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/YarrCanonicalizeUnicode.cpp
-    MAIN_DEPENDENCY ${_javascript_CORE_DIR}/generateYarrCanonicalizeUnicode
+    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/YarrCanonicalizeUnicode.cpp
+    MAIN_DEPENDENCY ${_javascript_CORE_DIR}/yarr/generateYarrCanonicalizeUnicode
     DEPENDS ${_javascript_CORE_DIR}/ucd/CaseFolding.txt
-    COMMAND ${PYTHON_EXECUTABLE} ${_javascript_CORE_DIR}/generateYarrCanonicalizeUnicode ${_javascript_CORE_DIR}/ucd/CaseFolding.txt ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/YarrCanonicalizeUnicode.cpp
+    COMMAND ${PYTHON_EXECUTABLE} ${_javascript_CORE_DIR}/yarr/generateYarrCanonicalizeUnicode ${_javascript_CORE_DIR}/ucd/CaseFolding.txt ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/YarrCanonicalizeUnicode.cpp
     VERBATIM)
 
-list(APPEND _javascript_Core_SOURCES
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/YarrCanonicalizeUnicode.cpp
-)
-
 #GENERATOR: "KeywordLookup.h": keyword decision tree used by the lexer
 add_custom_command(
     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
@@ -522,19 +520,6 @@
 )
 
 add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcode.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcodeGenerated.h
-    MAIN_DEPENDENCY ${_javascript_CORE_DIR}/b3/air/AirOpcode.opcodes
-    DEPENDS ${_javascript_CORE_DIR}/b3/air/opcode_generator.rb
-    COMMAND ${RUBY_EXECUTABLE} ${_javascript_CORE_DIR}/b3/air/opcode_generator.rb ${_javascript_CORE_DIR}/b3/air/AirOpcode.opcodes VERBATIM
-    WORKING_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
-)
-
-list(APPEND _javascript_Core_HEADERS
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcode.h
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcodeGenerated.h
-)
-
-add_custom_command(
     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.h
     MAIN_DEPENDENCY ${_javascript_Core_SCRIPTS_DIR}/generate-js-builtins.py
     DEPENDS ${_javascript_Core_BUILTINS_SOURCES} ${BUILTINS_GENERATOR_SCRIPTS}
@@ -541,13 +526,6 @@
     COMMAND ${PYTHON_EXECUTABLE} ${_javascript_Core_SCRIPTS_DIR}/generate-js-builtins.py --framework _javascript_Core --output-directory ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR} --combined ${_javascript_Core_BUILTINS_SOURCES}
     VERBATIM)
 
-list(APPEND _javascript_Core_SOURCES
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendDispatchers.cpp
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorFrontendDispatchers.cpp
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorProtocolObjects.cpp
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.cpp
-)
-
 list(APPEND _javascript_Core_HEADERS
     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendDispatchers.h
     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorFrontendDispatchers.h
@@ -556,6 +534,19 @@
 )
 
 add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcode.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcodeGenerated.h
+    MAIN_DEPENDENCY ${_javascript_CORE_DIR}/b3/air/AirOpcode.opcodes
+    DEPENDS ${_javascript_CORE_DIR}/b3/air/opcode_generator.rb
+    COMMAND ${RUBY_EXECUTABLE} ${_javascript_CORE_DIR}/b3/air/opcode_generator.rb ${_javascript_CORE_DIR}/b3/air/AirOpcode.opcodes VERBATIM
+    WORKING_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
+)
+
+list(APPEND _javascript_Core_HEADERS
+    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcode.h
+    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcodeGenerated.h
+)
+
+add_custom_command(
     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.min.js
     MAIN_DEPENDENCY ${_javascript_CORE_DIR}/inspector/InjectedScriptSource.js
     DEPENDS ${_javascript_Core_SCRIPTS_DIR}/xxd.pl ${_javascript_Core_SCRIPTS_DIR}/jsmin.py

Modified: trunk/Source/_javascript_Core/ChangeLog (222498 => 222499)


--- trunk/Source/_javascript_Core/ChangeLog	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-09-26 15:34:19 UTC (rev 222499)
@@ -1,3 +1,31 @@
+2017-09-24  Keith Miller  <[email protected]>
+
+        JSC build should use unified sources for derived sources
+        https://bugs.webkit.org/show_bug.cgi?id=177421
+
+        Reviewed by JF Bastien.
+
+        This patch make a couple of changes:
+
+        1) Make derived sources added to relevant bundles. I was going to add JSCBuiltins.cpp
+        to runtime but that kept breaking the windows build. I'll get back to it later
+        2) Move the derived location of some sources both for clarity and for ease of use.
+        3) Make auto generator scripts able to create directories if needed.
+        4) Move some scripts from the top level of the _javascript_Core directory to a
+        more appropriate directory.
+        5) Move some CMake generation commands around for clarity.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * Scripts/lazywriter.py:
+        (LazyFileWriter.close):
+        * Sources.txt:
+        * inspector/scripts/generate-inspector-protocol-bindings.py:
+        (IncrementalFileWriter.close):
+        * yarr/create_regex_tables: Renamed from Source/_javascript_Core/create_regex_tables.
+        * yarr/generateYarrCanonicalizeUnicode: Renamed from Source/_javascript_Core/generateYarrCanonicalizeUnicode.
+
 2017-09-26  Zan Dobersek  <[email protected]>
 
         Support building _javascript_Core with the Bionic C library

Modified: trunk/Source/_javascript_Core/DerivedSources.make (222498 => 222499)


--- trunk/Source/_javascript_Core/DerivedSources.make	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/_javascript_Core/DerivedSources.make	2017-09-26 15:34:19 UTC (rev 222499)
@@ -56,13 +56,13 @@
     CombinedDomains.json \
     InitBytecodes.asm \
     InjectedScriptSource.h \
-    InspectorFrontendDispatchers.h \
+    inspector/InspectorFrontendDispatchers.h \
     JSCBuiltins.h \
     Lexer.lut.h \
     KeywordLookup.h \
     RegExpJitTables.h \
     AirOpcode.h \
-    YarrCanonicalizeUnicode.cpp \
+    yarr/YarrCanonicalizeUnicode.cpp \
     WasmOps.h \
     WasmValidateInlines.h \
     WasmB3IRGeneratorInlines.h \
@@ -196,7 +196,7 @@
 
 # character tables for Yarr
 
-RegExpJitTables.h: create_regex_tables
+RegExpJitTables.h: yarr/create_regex_tables
 	$(PYTHON) $^ > $@
 
 KeywordLookup.h: KeywordLookupGenerator.py Keywords.table
@@ -281,8 +281,8 @@
 	$(PYTHON) $(_javascript_Core_SCRIPTS_DIR)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) > ./CombinedDomains.json
 
 # Inspector Backend Dispatchers, Frontend Dispatchers, Type Builders
-InspectorFrontendDispatchers.h : CombinedDomains.json $(INSPECTOR_GENERATOR_SCRIPTS)
-	$(PYTHON) $(_javascript_Core)/inspector/scripts/generate-inspector-protocol-bindings.py --framework _javascript_Core --outputDir . ./CombinedDomains.json
+inspector/InspectorFrontendDispatchers.h : CombinedDomains.json $(INSPECTOR_GENERATOR_SCRIPTS) inspector
+	$(PYTHON) $(_javascript_Core)/inspector/scripts/generate-inspector-protocol-bindings.py --framework _javascript_Core --outputDir inspector ./CombinedDomains.json
 
 InjectedScriptSource.h : inspector/InjectedScriptSource.js $(_javascript_Core_SCRIPTS_DIR)/jsmin.py $(_javascript_Core_SCRIPTS_DIR)/xxd.pl
 	echo "//# sourceURL=__InjectedScript_InjectedScriptSource.js" > ./InjectedScriptSource.min.js
@@ -293,8 +293,8 @@
 AirOpcode.h: $(_javascript_Core)/b3/air/opcode_generator.rb $(_javascript_Core)/b3/air/AirOpcode.opcodes
 	$(RUBY) $^
 
-YarrCanonicalizeUnicode.cpp: $(_javascript_Core)/generateYarrCanonicalizeUnicode $(_javascript_Core)/ucd/CaseFolding.txt
-	$(PYTHON) $(_javascript_Core)/generateYarrCanonicalizeUnicode $(_javascript_Core)/ucd/CaseFolding.txt ./YarrCanonicalizeUnicode.cpp
+yarr/YarrCanonicalizeUnicode.cpp: $(_javascript_Core)/yarr/generateYarrCanonicalizeUnicode $(_javascript_Core)/ucd/CaseFolding.txt
+	$(PYTHON) $(_javascript_Core)/yarr/generateYarrCanonicalizeUnicode $(_javascript_Core)/ucd/CaseFolding.txt ./yarr/YarrCanonicalizeUnicode.cpp
 
 WasmOps.h: $(_javascript_Core)/wasm/generateWasmOpsHeader.py $(_javascript_Core)/wasm/generateWasm.py $(_javascript_Core)/wasm/wasm.json
 	$(PYTHON) $(_javascript_Core)/wasm/generateWasmOpsHeader.py $(_javascript_Core)/wasm/wasm.json ./WasmOps.h

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (222498 => 222499)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2017-09-26 15:34:19 UTC (rev 222499)
@@ -836,6 +836,9 @@
 		534E03581E53BF2F00213F64 /* GetterSetterAccessCase.h in Headers */ = {isa = PBXBuildFile; fileRef = 534E03571E53BF2F00213F64 /* GetterSetterAccessCase.h */; };
 		53529A4C1C457B75000B49C6 /* APIUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 53529A4B1C457B75000B49C6 /* APIUtils.h */; };
 		535557141D9D9EA5006D583B /* WasmMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 535557131D9D9EA5006D583B /* WasmMemory.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		535C24611F78928E006EC40E /* create_regex_tables in Headers */ = {isa = PBXBuildFile; fileRef = A718F8211178EB4B002465A7 /* create_regex_tables */; };
+		535C24691F7A1624006EC40E /* JSCBuiltins.cpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D801A61880D6A80026C39B /* JSCBuiltins.cpp */; };
+		535C246C1F7A1778006EC40E /* UnifiedSource136.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 535C246B1F7A1777006EC40E /* UnifiedSource136.cpp */; };
 		536B310C1F71C5990037FC33 /* UnifiedSource119.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536B30871F71C5380037FC33 /* UnifiedSource119.cpp */; };
 		536B310D1F71C5990037FC33 /* UnifiedSource125.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536B30881F71C5380037FC33 /* UnifiedSource125.cpp */; };
 		536B310E1F71C5990037FC33 /* UnifiedSource131.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536B30891F71C5380037FC33 /* UnifiedSource131.cpp */; };
@@ -985,11 +988,6 @@
 		53E777E41E92E265007CBEC4 /* WasmModuleInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 53E777E21E92E265007CBEC4 /* WasmModuleInformation.h */; };
 		53E9E0AC1EAE83DF00FEE251 /* WasmMachineThreads.h in Headers */ = {isa = PBXBuildFile; fileRef = 53E9E0AA1EAE83DE00FEE251 /* WasmMachineThreads.h */; };
 		53E9E0AF1EAEC45700FEE251 /* WasmTierUpCount.h in Headers */ = {isa = PBXBuildFile; fileRef = 53E9E0AE1EAEC45700FEE251 /* WasmTierUpCount.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		53F1B5421F6A14A500E2D043 /* InspectorFrontendDispatchers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A532438318568317002ED692 /* InspectorFrontendDispatchers.cpp */; };
-		53F1B5431F6A14AC00E2D043 /* InspectorProtocolObjects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A532438518568317002ED692 /* InspectorProtocolObjects.cpp */; };
-		53F1B5441F6A14BC00E2D043 /* JSCBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D801A61880D6A80026C39B /* JSCBuiltins.cpp */; };
-		53F1B5451F6A14D000E2D043 /* YarrCanonicalizeUnicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65A946141C8E9F6F00A7209A /* YarrCanonicalizeUnicode.cpp */; };
-		53F1B5481F6A157700E2D043 /* InspectorBackendDispatchers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A532438118568317002ED692 /* InspectorBackendDispatchers.cpp */; };
 		53F40E851D58F9770099A1B6 /* WasmSections.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E841D58F9770099A1B6 /* WasmSections.h */; };
 		53F40E8B1D5901BB0099A1B6 /* WasmFunctionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E8A1D5901BB0099A1B6 /* WasmFunctionParser.h */; };
 		53F40E8D1D5901F20099A1B6 /* WasmParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E8C1D5901F20099A1B6 /* WasmParser.h */; };
@@ -3173,6 +3171,7 @@
 		53529A4B1C457B75000B49C6 /* APIUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIUtils.h; sourceTree = "<group>"; };
 		535557131D9D9EA5006D583B /* WasmMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmMemory.h; sourceTree = "<group>"; };
 		535557151D9DFA32006D583B /* WasmMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WasmMemory.cpp; sourceTree = "<group>"; };
+		535C246B1F7A1777006EC40E /* UnifiedSource136.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource136.cpp; sourceTree = "<group>"; };
 		536B30871F71C5380037FC33 /* UnifiedSource119.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource119.cpp; sourceTree = "<group>"; };
 		536B30881F71C5380037FC33 /* UnifiedSource125.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource125.cpp; sourceTree = "<group>"; };
 		536B30891F71C5380037FC33 /* UnifiedSource131.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource131.cpp; sourceTree = "<group>"; };
@@ -3415,7 +3414,7 @@
 		658D3A5519638268003C45D6 /* VMEntryRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VMEntryRecord.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
 		65987F2C167FE84B003C2F8D /* DFGOSRExitCompilationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOSRExitCompilationInfo.h; path = dfg/DFGOSRExitCompilationInfo.h; sourceTree = "<group>"; };
 		65987F2F16828A7E003C2F8D /* UnusedPointer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnusedPointer.h; sourceTree = "<group>"; };
-		65A946131C8E9F2000A7209A /* generateYarrCanonicalizeUnicode */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = generateYarrCanonicalizeUnicode; sourceTree = "<group>"; };
+		65A946131C8E9F2000A7209A /* generateYarrCanonicalizeUnicode */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = generateYarrCanonicalizeUnicode; path = yarr/generateYarrCanonicalizeUnicode; sourceTree = "<group>"; };
 		65A946141C8E9F6F00A7209A /* YarrCanonicalizeUnicode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YarrCanonicalizeUnicode.cpp; sourceTree = "<group>"; };
 		65B8392C1BACA92A0044E824 /* CachedRecovery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedRecovery.h; sourceTree = "<group>"; };
 		65B8392D1BACA9D30044E824 /* CachedRecovery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedRecovery.cpp; sourceTree = "<group>"; };
@@ -3959,7 +3958,7 @@
 		A709F2F117A0AC2A00512E98 /* CommonSlowPaths.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommonSlowPaths.cpp; sourceTree = "<group>"; };
 		A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITOpcodes32_64.cpp; sourceTree = "<group>"; };
 		A718F61A11754A21002465A7 /* RegExpJitTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpJitTables.h; sourceTree = "<group>"; };
-		A718F8211178EB4B002465A7 /* create_regex_tables */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; path = create_regex_tables; sourceTree = "<group>"; };
+		A718F8211178EB4B002465A7 /* create_regex_tables */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; name = create_regex_tables; path = yarr/create_regex_tables; sourceTree = "<group>"; };
 		A72028B41797601E0098028C /* JSCTestRunnerUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCTestRunnerUtils.cpp; sourceTree = "<group>"; };
 		A72028B51797601E0098028C /* JSCTestRunnerUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCTestRunnerUtils.h; sourceTree = "<group>"; };
 		A72028B91797603D0098028C /* JSFunctionInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFunctionInlines.h; sourceTree = "<group>"; };
@@ -4695,11 +4694,9 @@
 		0867D691FE84028FC02AAC07 /* _javascript_Core */ = {
 			isa = PBXGroup;
 			children = (
-				65A946131C8E9F2000A7209A /* generateYarrCanonicalizeUnicode */,
 				8604F4F2143A6C4400B295F5 /* ChangeLog */,
 				F68EBB8C0255D4C601FF60F7 /* config.h */,
 				F692A8540255597D01FF60F7 /* create_hash_table */,
-				A718F8211178EB4B002465A7 /* create_regex_tables */,
 				937B63CC09E766D200A671DD /* DerivedSources.make */,
 				0F93275A1C20BCDF00CF6564 /* dynbench.cpp */,
 				6529FB3018B2D63900C61102 /* generate-bytecode-files */,
@@ -5722,9 +5719,39 @@
 			name = accessCase;
 			sourceTree = "<group>";
 		};
-		536B30861F71C5380037FC33 /* unified-souces */ = {
+		535C24651F789389006EC40E /* inspector */ = {
 			isa = PBXGroup;
 			children = (
+				A5EA710D19F6DF810098F5EC /* InspectorAlternateBackendDispatchers.h */,
+				A53243961856A475002ED692 /* InspectorBackendCommands.js */,
+				A532438118568317002ED692 /* InspectorBackendDispatchers.cpp */,
+				A532438218568317002ED692 /* InspectorBackendDispatchers.h */,
+				A532438318568317002ED692 /* InspectorFrontendDispatchers.cpp */,
+				A532438418568317002ED692 /* InspectorFrontendDispatchers.h */,
+				A532438518568317002ED692 /* InspectorProtocolObjects.cpp */,
+				A532438618568317002ED692 /* InspectorProtocolObjects.h */,
+			);
+			path = inspector;
+			sourceTree = "<group>";
+		};
+		535C24661F789452006EC40E /* runtime */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			path = runtime;
+			sourceTree = "<group>";
+		};
+		535C24671F7894A2006EC40E /* yarr */ = {
+			isa = PBXGroup;
+			children = (
+				65A946141C8E9F6F00A7209A /* YarrCanonicalizeUnicode.cpp */,
+			);
+			path = yarr;
+			sourceTree = "<group>";
+		};
+		536B30861F71C5380037FC33 /* unified-sources */ = {
+			isa = PBXGroup;
+			children = (
 				536B30DA1F71C5380037FC33 /* UnifiedSource1.cpp */,
 				536B31981F735E5C0037FC33 /* UnifiedSource1.mm */,
 				536B31011F71C5380037FC33 /* UnifiedSource10.cpp */,
@@ -5767,6 +5794,7 @@
 				536B30981F71C5380037FC33 /* UnifiedSource133.cpp */,
 				536B31971F735E5B0037FC33 /* UnifiedSource134.cpp */,
 				536B31991F735E5D0037FC33 /* UnifiedSource135.cpp */,
+				535C246B1F7A1777006EC40E /* UnifiedSource136.cpp */,
 				536B30F71F71C5380037FC33 /* UnifiedSource14.cpp */,
 				536B30F81F71C5380037FC33 /* UnifiedSource15.cpp */,
 				536B30F11F71C5380037FC33 /* UnifiedSource16.cpp */,
@@ -5863,13 +5891,16 @@
 				536B30E51F71C5380037FC33 /* UnifiedSource98.cpp */,
 				536B30DE1F71C5380037FC33 /* UnifiedSource99.cpp */,
 			);
-			path = "unified-souces";
+			path = "unified-sources";
 			sourceTree = "<group>";
 		};
 		650FDF8D09D0FCA700769E54 /* Derived Sources */ = {
 			isa = PBXGroup;
 			children = (
-				536B30861F71C5380037FC33 /* unified-souces */,
+				535C24651F789389006EC40E /* inspector */,
+				535C24661F789452006EC40E /* runtime */,
+				536B30861F71C5380037FC33 /* unified-sources */,
+				535C24671F7894A2006EC40E /* yarr */,
 				0F6183321C45F35C0072450B /* AirOpcode.h */,
 				0F6183341C45F3B60072450B /* AirOpcodeGenerated.h */,
 				0F6183351C45F3B60072450B /* AirOpcodeUtils.h */,
@@ -5885,15 +5916,7 @@
 				70B791901C0246CE002481E2 /* GeneratorPrototype.lut.h */,
 				6514F21818B3E1670098FF8B /* InitBytecodes.asm */,
 				A513E5C6185F9436007E95AD /* InjectedScriptSource.h */,
-				A5EA710D19F6DF810098F5EC /* InspectorAlternateBackendDispatchers.h */,
-				A53243961856A475002ED692 /* InspectorBackendCommands.js */,
-				A532438118568317002ED692 /* InspectorBackendDispatchers.cpp */,
-				A532438218568317002ED692 /* InspectorBackendDispatchers.h */,
-				A532438318568317002ED692 /* InspectorFrontendDispatchers.cpp */,
-				A532438418568317002ED692 /* InspectorFrontendDispatchers.h */,
 				E33B3E251B7ABD750048DB2E /* InspectorInstrumentationObject.lut.h */,
-				A532438518568317002ED692 /* InspectorProtocolObjects.cpp */,
-				A532438618568317002ED692 /* InspectorProtocolObjects.h */,
 				A18193E11B4E0CDB00FC1029 /* IntlCollatorConstructor.lut.h */,
 				A18193E21B4E0CDB00FC1029 /* IntlCollatorPrototype.lut.h */,
 				A1587D731B4DC1C600D69849 /* IntlDateTimeFormatConstructor.lut.h */,
@@ -5937,7 +5960,6 @@
 				AD2FCC131DB59C5900B3E736 /* WebAssemblyRuntimeErrorPrototype.lut.h */,
 				AD2FCC141DB59C5900B3E736 /* WebAssemblyTableConstructor.lut.h */,
 				AD2FCC151DB59C5900B3E736 /* WebAssemblyTablePrototype.lut.h */,
-				65A946141C8E9F6F00A7209A /* YarrCanonicalizeUnicode.cpp */,
 			);
 			name = "Derived Sources";
 			path = DerivedSources/_javascript_Core;
@@ -6768,6 +6790,8 @@
 		86EAC48C0F93E8B9008EC948 /* yarr */ = {
 			isa = PBXGroup;
 			children = (
+				A718F8211178EB4B002465A7 /* create_regex_tables */,
+				65A946131C8E9F2000A7209A /* generateYarrCanonicalizeUnicode */,
 				A57D23EB1891B5540031C7FA /* RegularExpression.cpp */,
 				A57D23EC1891B5540031C7FA /* RegularExpression.h */,
 				451539B812DC994500EF7AC4 /* Yarr.h */,
@@ -8081,6 +8105,7 @@
 				C4F4B6F31A05C944005CAB76 /* cpp_generator_templates.py in Headers */,
 				0F30D7C01D95D6320053089D /* CPU.h in Headers */,
 				5DE6E5B30E1728EC00180407 /* create_hash_table in Headers */,
+				535C24611F78928E006EC40E /* create_regex_tables in Headers */,
 				9959E92B1BD17FA4001AA413 /* cssmin.py in Headers */,
 				2A111246192FCE79005EE18D /* CustomGetterSetter.h in Headers */,
 				0F426A4B1460CD6E00131F8F /* DataFormat.h in Headers */,
@@ -8595,6 +8620,7 @@
 				BC18C41B0E16F5CD00B34460 /* JSCallbackObject.h in Headers */,
 				BC18C41C0E16F5CD00B34460 /* JSCallbackObjectFunctions.h in Headers */,
 				657CF45919BF6662004ACBF2 /* JSCallee.h in Headers */,
+				535C24691F7A1624006EC40E /* JSCBuiltins.cpp in Headers */,
 				A7D801A91880D6A80026C39B /* JSCBuiltins.h in Headers */,
 				BC1167DA0E19BCC9008066DD /* JSCell.h in Headers */,
 				0F9749711687ADE400A4FF6A /* JSCellInlines.h in Headers */,
@@ -9515,7 +9541,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "set -e\n\ncd $SRCROOT\n\nif [ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]; then\n    BUILD_SCRIPTS_DIR=\"${SDKROOT}/usr/local/include/wtf/Scripts\"\nelse\n    BUILD_SCRIPTS_DIR=\"${BUILT_PRODUCTS_DIR}/usr/local/include/wtf/Scripts\"\nfi\n\nUnifiedSourceCppFileCount=135\nUnifiedSourceMmFileCount=135\n\n/usr/bin/env ruby \"${BUILD_SCRIPTS_DIR}/generate-unified-source-bundles.rb\" \"--derived-sources-path\" \"${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"--max-cpp-bundle-count\" \"${UnifiedSourceCppFileCount}\" \"--max-obj-c-bundle-count\" \"${UnifiedSourceMmFileCount}\" \"Sources.txt\" \"SourcesMac.txt\" > /dev/null\n";
+			shellScript = "set -e\n\ncd $SRCROOT\n\nif [ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]; then\n    BUILD_SCRIPTS_DIR=\"${SDKROOT}/usr/local/include/wtf/Scripts\"\nelse\n    BUILD_SCRIPTS_DIR=\"${BUILT_PRODUCTS_DIR}/usr/local/include/wtf/Scripts\"\nfi\n\nUnifiedSourceCppFileCount=136\nUnifiedSourceMmFileCount=2\n\n/usr/bin/env ruby \"${BUILD_SCRIPTS_DIR}/generate-unified-source-bundles.rb\" \"--derived-sources-path\" \"${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"--source-tree-path\" \"${SRCROOT}\" \"--max-cpp-bundle-count\" \"${UnifiedSourceCppFileCount}\" \"--max-obj-c-bundle-count\" \"${UnifiedSourceMmFileCount}\" \"Sources.txt\" \"SourcesMac.txt\" > /dev/null\n";
 		};
 		5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */ = {
 			isa = PBXShellScriptBuildPhase;
@@ -9722,10 +9748,6 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				53F1B5481F6A157700E2D043 /* InspectorBackendDispatchers.cpp in Sources */,
-				53F1B5421F6A14A500E2D043 /* InspectorFrontendDispatchers.cpp in Sources */,
-				53F1B5431F6A14AC00E2D043 /* InspectorProtocolObjects.cpp in Sources */,
-				53F1B5441F6A14BC00E2D043 /* JSCBuiltins.cpp in Sources */,
 				536B319E1F735F160037FC33 /* LowLevelInterpreter.cpp in Sources */,
 				0FF4274A158EBE91004CB9FF /* udis86.c in Sources */,
 				0FF42740158EBE8B004CB9FF /* udis86_decode.c in Sources */,
@@ -9775,6 +9797,7 @@
 				536B311D1F71C5990037FC33 /* UnifiedSource133.cpp in Sources */,
 				536B319C1F735E7D0037FC33 /* UnifiedSource134.cpp in Sources */,
 				536B319D1F735E7D0037FC33 /* UnifiedSource135.cpp in Sources */,
+				535C246C1F7A1778006EC40E /* UnifiedSource136.cpp in Sources */,
 				536B317C1F71C5990037FC33 /* UnifiedSource14.cpp in Sources */,
 				536B317D1F71C5990037FC33 /* UnifiedSource15.cpp in Sources */,
 				536B31761F71C5990037FC33 /* UnifiedSource16.cpp in Sources */,
@@ -9870,7 +9893,6 @@
 				536B31361F71C5990037FC33 /* UnifiedSource97.cpp in Sources */,
 				536B316A1F71C5990037FC33 /* UnifiedSource98.cpp in Sources */,
 				536B31631F71C5990037FC33 /* UnifiedSource99.cpp in Sources */,
-				53F1B5451F6A14D000E2D043 /* YarrCanonicalizeUnicode.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/_javascript_Core/Scripts/lazywriter.py (222498 => 222499)


--- trunk/Source/_javascript_Core/Scripts/lazywriter.py	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/_javascript_Core/Scripts/lazywriter.py	2017-09-26 15:34:19 UTC (rev 222499)
@@ -26,6 +26,7 @@
 
 # A writer that only updates file if it actually changed.
 
+import os
 
 class LazyFileWriter:
     def __init__(self, filepath, force_output):
@@ -53,6 +54,9 @@
             pass
 
         if text_changed or self.force_output:
+            dirname = os.path.dirname(self._filepath)
+            if not os.path.isdir(dirname):
+                os.makedirs(dirname)
             out_file = open(self._filepath, "w")
             out_file.write(self._output)
             out_file.close()

Modified: trunk/Source/_javascript_Core/Sources.txt (222498 => 222499)


--- trunk/Source/_javascript_Core/Sources.txt	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/_javascript_Core/Sources.txt	2017-09-26 15:34:19 UTC (rev 222499)
@@ -545,6 +545,11 @@
 inspector/ScriptCallStackFactory.cpp
 inspector/ScriptDebugServer.cpp
 
+# Derived Sources
+inspector/InspectorBackendDispatchers.cpp
+inspector/InspectorFrontendDispatchers.cpp
+inspector/InspectorProtocolObjects.cpp
+
 inspector/agents/InspectorAgent.cpp
 inspector/agents/InspectorConsoleAgent.cpp
 inspector/agents/InspectorDebuggerAgent.cpp
@@ -915,6 +920,10 @@
 runtime/WeakSetConstructor.cpp
 runtime/WeakSetPrototype.cpp
 
+# Derived Sources
+# FIXME: We should move this to runtime but it kept breaking the Windows build in weird ways... https://bugs.webkit.org/show_bug.cgi?id=177486
+JSCBuiltins.cpp
+
 tools/CellList.cpp
 tools/CodeProfile.cpp
 tools/CodeProfiling.cpp
@@ -989,3 +998,6 @@
 yarr/YarrJIT.cpp
 yarr/YarrPattern.cpp
 yarr/YarrSyntaxChecker.cpp
+
+# Derived Sources
+yarr/YarrCanonicalizeUnicode.cpp

Deleted: trunk/Source/_javascript_Core/create_regex_tables (222498 => 222499)


--- trunk/Source/_javascript_Core/create_regex_tables	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/_javascript_Core/create_regex_tables	2017-09-26 15:34:19 UTC (rev 222499)
@@ -1,127 +0,0 @@
-# Copyright (C) 2010, 2013-2017 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 sys
-
-types = {
-    "wordchar": { "UseTable" : True, "data": ['_', ('0','9'), ('A', 'Z'), ('a','z')]},
-    "wordUnicodeIgnoreCaseChar": { "UseTable" : False, "data": ['_', ('0', '9'), ('A', 'Z'), ('a', 'z'), 0x017f, 0x212a]},
-    "nonwordchar": { "UseTable" : True, "Inverse": "wordchar", "data": ['`', (0, ord('0') - 1), (ord('9') + 1, ord('A') - 1), (ord('Z') + 1, ord('_') - 1), (ord('z') + 1, 0x10ffff)]},
-    "nonwordUnicodeIgnoreCaseChar": { "UseTable" : False, "Inverse": "wordUnicodeIgnoreCaseChar", "data": ['`', (0, ord('0') - 1), (ord('9') + 1, ord('A') - 1), (ord('Z') + 1, ord('_') - 1), (ord('z') + 1, 0x017e), (0x0180, 0x2129), (0x212b, 0x10ffff)]},
-    "newline": { "UseTable" : False, "data": ['\n', '\r', 0x2028, 0x2029]},
-    "spaces": { "UseTable" : True, "data": [' ', ('\t', '\r'), 0xa0, 0x1680, 0x180e, 0x2028, 0x2029, 0x202f, 0x205f, 0x3000, (0x2000, 0x200a), 0xfeff]},
-    "nonspaces": { "UseTable" : True, "Inverse": "spaces", "data": [(0, ord('\t') - 1), (ord('\r') + 1, ord(' ') - 1), (ord(' ') + 1, 0x009f), (0x00a1, 0x167f), (0x1681, 0x180d), (0x180f, 0x1fff), (0x200b, 0x2027), (0x202a, 0x202e), (0x2030, 0x205e), (0x2060, 0x2fff), (0x3001, 0xfefe), (0xff00, 0x10ffff)]},
-    "digits": { "UseTable" : False, "data": [('0', '9')]},
-    "nondigits": { "UseTable" : False, "Inverse": "digits", "data": [(0, ord('0') - 1), (ord('9') + 1, 0x10ffff)] }
-}
-entriesPerLine = 50
-arrays = "";
-functions = "";
-emitTables = (len(sys.argv) < 2 or sys.argv[1] != "--no-tables")
-
-for name, classes in types.items():
-    ranges = [];
-    size = 0;
-    for _class in classes["data"]:
-        if type(_class) == str:
-            ranges.append((ord(_class), ord(_class)))
-        elif type(_class) == int:
-            ranges.append((_class, _class))
-        else:
-            (min, max) = _class;
-            if type(min) == str:
-                min = ord(min)
-            if type(max) == str:
-                max = ord(max)
-            if max > 0x7f and min <= 0x7f:
-                ranges.append((min, 0x7f))
-                min = 0x80
-            ranges.append((min,max))
-    ranges.sort();
-    
-    if emitTables and classes["UseTable"] and (not "Inverse" in classes):
-        array = ("static const char _%sData[65536] = {\n" % name);
-        i = 0
-        for (min,max) in ranges:
-            while i < min:
-                i = i + 1
-                array += ('0,')
-                if (i % entriesPerLine == 0) and (i != 0):
-                    array += ('\n')
-            while i <= max:
-                i = i + 1
-                if (i == 65536):
-                    array += ("1")
-                else:
-                    array += ('1,')
-                if (i % entriesPerLine == 0) and (i != 0):
-                    array += ('\n')
-        while i < 0xffff:
-            array += ("0,")
-            i = i + 1;
-            if (i % entriesPerLine == 0) and (i != 0):
-                array += ('\n')
-        if i == 0xffff:
-            array += ("0")
-        array += ("\n};\n\n");
-        arrays += array
-    
-    # Generate createFunction:
-    function = "";
-    function += ("std::unique_ptr<CharacterClass> %sCreate()\n" % name)
-    function += ("{\n")
-    if emitTables and classes["UseTable"]:
-        if "Inverse" in classes:
-            function += ("    auto characterClass = std::make_unique<CharacterClass>(_%sData, true);\n" % (classes["Inverse"]))
-        else:
-            function += ("    auto characterClass = std::make_unique<CharacterClass>(_%sData, false);\n" % (name))
-    else:
-        function += ("    auto characterClass = std::make_unique<CharacterClass>();\n")
-    hasNonBMPCharacters = False
-    for (min, max) in ranges:
-        if (min == max):
-            if (min > 127):
-                function += ("    characterClass->m_matchesUnicode.append(0x%04x);\n" % min)
-            else:
-                function += ("    characterClass->m_matches.append(0x%02x);\n" % min)
-            continue
-        if (min > 127) or (max > 127):
-            function += ("    characterClass->m_rangesUnicode.append(CharacterRange(0x%04x, 0x%04x));\n" % (min, max))
-        else:
-            function += ("    characterClass->m_ranges.append(CharacterRange(0x%02x, 0x%02x));\n" % (min, max))
-        if max >= 0x10000:
-            hasNonBMPCharacters = True
-    function += ("    characterClass->m_hasNonBMPCharacters = %s;\n" % ("true" if hasNonBMPCharacters else "false"))
-    function += ("    return characterClass;\n")
-    function += ("}\n\n")
-    functions += function
-
-if (len(sys.argv) > 1):
-    f = open(sys.argv[-1], "w")
-    f.write(arrays)
-    f.write(functions)
-    f.close()
-else:
-    print(arrays)
-    print(functions)
-

Deleted: trunk/Source/_javascript_Core/generateYarrCanonicalizeUnicode (222498 => 222499)


--- trunk/Source/_javascript_Core/generateYarrCanonicalizeUnicode	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/_javascript_Core/generateYarrCanonicalizeUnicode	2017-09-26 15:34:19 UTC (rev 222499)
@@ -1,200 +0,0 @@
-#! /usr/bin/python
-
-# Copyright (C) 2016 Apple Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1.  Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer. 
-# 2.  Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution. 
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# This tool processes the Unicode Character Database file CaseFolding.txt to create
-# canonicalization table as decribed in ECMAScript 6 standard in section
-# "21.2.2.8.2 Runtime Semantics: Canonicalize()", step 2.
-
-import optparse
-import re
-import sys
-from sets import Set
-
-header = """/*
-* Copyright (C) 2016 Apple Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* 1.  Redistributions of source code must retain the above copyright
-*     notice, this list of conditions and the following disclaimer. 
-* 2.  Redistributions in binary form must reproduce the above copyright
-*     notice, this list of conditions and the following disclaimer in the
-*     documentation and/or other materials provided with the distribution. 
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-// DO NO EDIT! - This file was generated by generateYarrCanonicalizeUnicode
-
-#include "config.h"
-#include "YarrCanonicalize.h"
-
-namespace JSC { namespace Yarr {
-
-"""
-
-footer = """} } // JSC::Yarr
-"""
-
-MaxUnicode = 0x10ffff
-commonAndSimpleLinesRE = re.compile(r"(?P<code>[0-9A-F]+)\s*;\s*[CS]\s*;\s*(?P<mapping>[0-9A-F]+)", re.IGNORECASE)
-
-def openOrExit(path, mode):
-    try:
-        return open(path, mode)
-    except IOError as e:
-        print "I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror)
-        exit(1)
-
-class Canonicalize:
-    def __init__(self):
-        self.canonicalGroups = {};
-
-    def addMapping(self, code, mapping):
-        if mapping not in self.canonicalGroups:
-            self.canonicalGroups[mapping] = []
-        self.canonicalGroups[mapping].append(code)
-        
-    def readCaseFolding(self, file):
-        codesSeen = Set()
-        for line in file:
-            line = line.split('#', 1)[0]
-            line = line.rstrip()
-            if (not len(line)):
-                continue
-
-            fields = commonAndSimpleLinesRE.match(line)
-            if (not fields):
-                continue
-
-            code = int(fields.group('code'), 16)
-            mapping = int(fields.group('mapping'), 16)
-
-            codesSeen.add(code)
-            self.addMapping(code, mapping)
-
-        for i in range(MaxUnicode + 1):
-            if i in codesSeen:
-                continue;
-
-            self.addMapping(i, i)
-
-    def createTables(self, file):
-        typeInfo = [""] * (MaxUnicode + 1)
-        characterSets = []
-
-        for mapping in sorted(self.canonicalGroups.keys()):
-            characters = self.canonicalGroups[mapping]
-            if len(characters) == 1:
-                typeInfo[characters[0]] = "CanonicalizeUnique:0"
-            else:
-                characters.sort()
-                if len(characters) > 2:
-                    for ch in characters:
-                        typeInfo[ch] = "CanonicalizeSet:%d" % len(characterSets)
-                    characterSets.append(characters)
-                else:
-                    low = characters[0]
-                    high = characters[1]
-                    delta = high - low
-                    if delta == 1:
-                        type = "CanonicalizeAlternatingUnaligned:0" if low & 1 else "CanonicalizeAlternatingAligned:0"
-                        typeInfo[low] = type
-                        typeInfo[high] = type
-                    else:
-                        typeInfo[low] = "CanonicalizeRangeLo:%d" % delta
-                        typeInfo[high] = "CanonicalizeRangeHi:%d" % delta
-
-        rangeInfo = []
-        end = 0
-        while end <= MaxUnicode:
-            begin = end
-            type = typeInfo[end]
-            while end < MaxUnicode and typeInfo[end + 1] == type:
-                end = end + 1
-            rangeInfo.append({"begin": begin, "end": end, "type": type})
-            end = end + 1
-        
-        for i in range(len(characterSets)):
-            characters = ""
-            set = characterSets[i]
-            for ch in set:
-                characters = characters + "0x{character:04x}, ".format(character=ch)
-            file.write("const UChar32 unicodeCharacterSet{index:d}[] = {{ {characters}0 }};\n".format(index=i, characters=characters))
-
-        file.write("\n")
-        file.write("static const size_t UNICODE_CANONICALIZATION_SETS = {setCount:d};\n".format(setCount=len(characterSets)))
-        file.write("const UChar32* const unicodeCharacterSetInfo[UNICODE_CANONICALIZATION_SETS] = {\n")
-
-        for i in range(len(characterSets)):
-            file.write("    unicodeCharacterSet{setNumber:d},\n".format(setNumber=i))
-
-        file.write("};\n")
-        file.write("\n")
-        file.write("const size_t UNICODE_CANONICALIZATION_RANGES = {rangeCount:d};\n".format(rangeCount=len(rangeInfo)))
-        file.write("const CanonicalizationRange unicodeRangeInfo[UNICODE_CANONICALIZATION_RANGES] = {\n")
-
-        for info in rangeInfo:
-            typeAndValue = info["type"].split(":")
-            file.write("    {{ 0x{begin:04x}, 0x{end:04x}, 0x{value:04x}, {type} }},\n".format(begin=info["begin"], end=info["end"], value=int(typeAndValue[1]), type=typeAndValue[0]))
-
-        file.write("};\n")
-        file.write("\n")
-
-        
-if __name__ == "__main__":
-    parser = optparse.OptionParser(usage = "usage: %prog  <CaseFolding.txt> <YarrCanonicalizeUnicode.h>")
-    (options, args) = parser.parse_args()
-
-    if len(args) != 2:
-        parser.error("<CaseFolding.txt> <YarrCanonicalizeUnicode.h>")
-
-    caseFoldingTxtPath = args[0]
-    canonicalizeHPath = args[1]
-    caseFoldingTxtFile = openOrExit(caseFoldingTxtPath, "r")
-    canonicalizeHFile = openOrExit(canonicalizeHPath, "wb")
-
-    canonicalize = Canonicalize()
-    canonicalize.readCaseFolding(caseFoldingTxtFile)
-
-    canonicalizeHFile.write(header);
-    canonicalize.createTables(canonicalizeHFile)
-    canonicalizeHFile.write(footer);
-
-    caseFoldingTxtFile.close()
-    canonicalizeHFile.close()
-
-    exit(0)

Modified: trunk/Source/_javascript_Core/inspector/scripts/generate-inspector-protocol-bindings.py (222498 => 222499)


--- trunk/Source/_javascript_Core/inspector/scripts/generate-inspector-protocol-bindings.py	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/_javascript_Core/inspector/scripts/generate-inspector-protocol-bindings.py	2017-09-26 15:34:19 UTC (rev 222499)
@@ -27,7 +27,7 @@
 # This script generates JS, Objective C, and C++ bindings for the inspector protocol.
 # Generators for individual files are located in the codegen/ directory.
 
-import os.path
+import os
 import re
 import sys
 import string
@@ -103,6 +103,9 @@
             pass
 
         if text_changed or self.force_output:
+            dirname = os.path.dirname(self._filepath)
+            if not os.path.isdir(dirname):
+                os.makedirs(dirname)
             out_file = open(self._filepath, "w")
             out_file.write(self._output)
             out_file.close()

Copied: trunk/Source/_javascript_Core/yarr/create_regex_tables (from rev 222498, trunk/Source/_javascript_Core/create_regex_tables) (0 => 222499)


--- trunk/Source/_javascript_Core/yarr/create_regex_tables	                        (rev 0)
+++ trunk/Source/_javascript_Core/yarr/create_regex_tables	2017-09-26 15:34:19 UTC (rev 222499)
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2010, 2013-2017 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 os
+import sys
+
+types = {
+    "wordchar": { "UseTable" : True, "data": ['_', ('0','9'), ('A', 'Z'), ('a','z')]},
+    "wordUnicodeIgnoreCaseChar": { "UseTable" : False, "data": ['_', ('0', '9'), ('A', 'Z'), ('a', 'z'), 0x017f, 0x212a]},
+    "nonwordchar": { "UseTable" : True, "Inverse": "wordchar", "data": ['`', (0, ord('0') - 1), (ord('9') + 1, ord('A') - 1), (ord('Z') + 1, ord('_') - 1), (ord('z') + 1, 0x10ffff)]},
+    "nonwordUnicodeIgnoreCaseChar": { "UseTable" : False, "Inverse": "wordUnicodeIgnoreCaseChar", "data": ['`', (0, ord('0') - 1), (ord('9') + 1, ord('A') - 1), (ord('Z') + 1, ord('_') - 1), (ord('z') + 1, 0x017e), (0x0180, 0x2129), (0x212b, 0x10ffff)]},
+    "newline": { "UseTable" : False, "data": ['\n', '\r', 0x2028, 0x2029]},
+    "spaces": { "UseTable" : True, "data": [' ', ('\t', '\r'), 0xa0, 0x1680, 0x180e, 0x2028, 0x2029, 0x202f, 0x205f, 0x3000, (0x2000, 0x200a), 0xfeff]},
+    "nonspaces": { "UseTable" : True, "Inverse": "spaces", "data": [(0, ord('\t') - 1), (ord('\r') + 1, ord(' ') - 1), (ord(' ') + 1, 0x009f), (0x00a1, 0x167f), (0x1681, 0x180d), (0x180f, 0x1fff), (0x200b, 0x2027), (0x202a, 0x202e), (0x2030, 0x205e), (0x2060, 0x2fff), (0x3001, 0xfefe), (0xff00, 0x10ffff)]},
+    "digits": { "UseTable" : False, "data": [('0', '9')]},
+    "nondigits": { "UseTable" : False, "Inverse": "digits", "data": [(0, ord('0') - 1), (ord('9') + 1, 0x10ffff)] }
+}
+entriesPerLine = 50
+arrays = "";
+functions = "";
+emitTables = (len(sys.argv) < 2 or sys.argv[1] != "--no-tables")
+
+for name, classes in types.items():
+    ranges = [];
+    size = 0;
+    for _class in classes["data"]:
+        if type(_class) == str:
+            ranges.append((ord(_class), ord(_class)))
+        elif type(_class) == int:
+            ranges.append((_class, _class))
+        else:
+            (min, max) = _class;
+            if type(min) == str:
+                min = ord(min)
+            if type(max) == str:
+                max = ord(max)
+            if max > 0x7f and min <= 0x7f:
+                ranges.append((min, 0x7f))
+                min = 0x80
+            ranges.append((min,max))
+    ranges.sort();
+    
+    if emitTables and classes["UseTable"] and (not "Inverse" in classes):
+        array = ("static const char _%sData[65536] = {\n" % name);
+        i = 0
+        for (min,max) in ranges:
+            while i < min:
+                i = i + 1
+                array += ('0,')
+                if (i % entriesPerLine == 0) and (i != 0):
+                    array += ('\n')
+            while i <= max:
+                i = i + 1
+                if (i == 65536):
+                    array += ("1")
+                else:
+                    array += ('1,')
+                if (i % entriesPerLine == 0) and (i != 0):
+                    array += ('\n')
+        while i < 0xffff:
+            array += ("0,")
+            i = i + 1;
+            if (i % entriesPerLine == 0) and (i != 0):
+                array += ('\n')
+        if i == 0xffff:
+            array += ("0")
+        array += ("\n};\n\n");
+        arrays += array
+    
+    # Generate createFunction:
+    function = "";
+    function += ("std::unique_ptr<CharacterClass> %sCreate()\n" % name)
+    function += ("{\n")
+    if emitTables and classes["UseTable"]:
+        if "Inverse" in classes:
+            function += ("    auto characterClass = std::make_unique<CharacterClass>(_%sData, true);\n" % (classes["Inverse"]))
+        else:
+            function += ("    auto characterClass = std::make_unique<CharacterClass>(_%sData, false);\n" % (name))
+    else:
+        function += ("    auto characterClass = std::make_unique<CharacterClass>();\n")
+    hasNonBMPCharacters = False
+    for (min, max) in ranges:
+        if (min == max):
+            if (min > 127):
+                function += ("    characterClass->m_matchesUnicode.append(0x%04x);\n" % min)
+            else:
+                function += ("    characterClass->m_matches.append(0x%02x);\n" % min)
+            continue
+        if (min > 127) or (max > 127):
+            function += ("    characterClass->m_rangesUnicode.append(CharacterRange(0x%04x, 0x%04x));\n" % (min, max))
+        else:
+            function += ("    characterClass->m_ranges.append(CharacterRange(0x%02x, 0x%02x));\n" % (min, max))
+        if max >= 0x10000:
+            hasNonBMPCharacters = True
+    function += ("    characterClass->m_hasNonBMPCharacters = %s;\n" % ("true" if hasNonBMPCharacters else "false"))
+    function += ("    return characterClass;\n")
+    function += ("}\n\n")
+    functions += function
+
+if (len(sys.argv) > 1):
+    path = sys.argv[-1]
+    dirname = os.path.dirname(path)
+    if not os.path.isdir(dirname):
+        os.makedirs(dirname)
+    f = open(path, "w")
+    f.write(arrays)
+    f.write(functions)
+    f.close()
+else:
+    print(arrays)
+    print(functions)
+

Copied: trunk/Source/_javascript_Core/yarr/generateYarrCanonicalizeUnicode (from rev 222498, trunk/Source/_javascript_Core/generateYarrCanonicalizeUnicode) (0 => 222499)


--- trunk/Source/_javascript_Core/yarr/generateYarrCanonicalizeUnicode	                        (rev 0)
+++ trunk/Source/_javascript_Core/yarr/generateYarrCanonicalizeUnicode	2017-09-26 15:34:19 UTC (rev 222499)
@@ -0,0 +1,204 @@
+#! /usr/bin/python
+
+# Copyright (C) 2016 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer. 
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution. 
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# This tool processes the Unicode Character Database file CaseFolding.txt to create
+# canonicalization table as decribed in ECMAScript 6 standard in section
+# "21.2.2.8.2 Runtime Semantics: Canonicalize()", step 2.
+
+import optparse
+import os
+import re
+import sys
+from sets import Set
+
+header = """/*
+* Copyright (C) 2016 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* 1.  Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer. 
+* 2.  Redistributions in binary form must reproduce the above copyright
+*     notice, this list of conditions and the following disclaimer in the
+*     documentation and/or other materials provided with the distribution. 
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+// DO NO EDIT! - This file was generated by generateYarrCanonicalizeUnicode
+
+#include "config.h"
+#include "YarrCanonicalize.h"
+
+namespace JSC { namespace Yarr {
+
+"""
+
+footer = """} } // JSC::Yarr
+"""
+
+MaxUnicode = 0x10ffff
+commonAndSimpleLinesRE = re.compile(r"(?P<code>[0-9A-F]+)\s*;\s*[CS]\s*;\s*(?P<mapping>[0-9A-F]+)", re.IGNORECASE)
+
+def openOrExit(path, mode):
+    try:
+        dirname = os.path.dirname(path)
+        if not os.path.isdir(dirname):
+            os.makedirs(dirname)
+        return open(path, mode)
+    except IOError as e:
+        print "I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror)
+        exit(1)
+
+class Canonicalize:
+    def __init__(self):
+        self.canonicalGroups = {};
+
+    def addMapping(self, code, mapping):
+        if mapping not in self.canonicalGroups:
+            self.canonicalGroups[mapping] = []
+        self.canonicalGroups[mapping].append(code)
+        
+    def readCaseFolding(self, file):
+        codesSeen = Set()
+        for line in file:
+            line = line.split('#', 1)[0]
+            line = line.rstrip()
+            if (not len(line)):
+                continue
+
+            fields = commonAndSimpleLinesRE.match(line)
+            if (not fields):
+                continue
+
+            code = int(fields.group('code'), 16)
+            mapping = int(fields.group('mapping'), 16)
+
+            codesSeen.add(code)
+            self.addMapping(code, mapping)
+
+        for i in range(MaxUnicode + 1):
+            if i in codesSeen:
+                continue;
+
+            self.addMapping(i, i)
+
+    def createTables(self, file):
+        typeInfo = [""] * (MaxUnicode + 1)
+        characterSets = []
+
+        for mapping in sorted(self.canonicalGroups.keys()):
+            characters = self.canonicalGroups[mapping]
+            if len(characters) == 1:
+                typeInfo[characters[0]] = "CanonicalizeUnique:0"
+            else:
+                characters.sort()
+                if len(characters) > 2:
+                    for ch in characters:
+                        typeInfo[ch] = "CanonicalizeSet:%d" % len(characterSets)
+                    characterSets.append(characters)
+                else:
+                    low = characters[0]
+                    high = characters[1]
+                    delta = high - low
+                    if delta == 1:
+                        type = "CanonicalizeAlternatingUnaligned:0" if low & 1 else "CanonicalizeAlternatingAligned:0"
+                        typeInfo[low] = type
+                        typeInfo[high] = type
+                    else:
+                        typeInfo[low] = "CanonicalizeRangeLo:%d" % delta
+                        typeInfo[high] = "CanonicalizeRangeHi:%d" % delta
+
+        rangeInfo = []
+        end = 0
+        while end <= MaxUnicode:
+            begin = end
+            type = typeInfo[end]
+            while end < MaxUnicode and typeInfo[end + 1] == type:
+                end = end + 1
+            rangeInfo.append({"begin": begin, "end": end, "type": type})
+            end = end + 1
+        
+        for i in range(len(characterSets)):
+            characters = ""
+            set = characterSets[i]
+            for ch in set:
+                characters = characters + "0x{character:04x}, ".format(character=ch)
+            file.write("const UChar32 unicodeCharacterSet{index:d}[] = {{ {characters}0 }};\n".format(index=i, characters=characters))
+
+        file.write("\n")
+        file.write("static const size_t UNICODE_CANONICALIZATION_SETS = {setCount:d};\n".format(setCount=len(characterSets)))
+        file.write("const UChar32* const unicodeCharacterSetInfo[UNICODE_CANONICALIZATION_SETS] = {\n")
+
+        for i in range(len(characterSets)):
+            file.write("    unicodeCharacterSet{setNumber:d},\n".format(setNumber=i))
+
+        file.write("};\n")
+        file.write("\n")
+        file.write("const size_t UNICODE_CANONICALIZATION_RANGES = {rangeCount:d};\n".format(rangeCount=len(rangeInfo)))
+        file.write("const CanonicalizationRange unicodeRangeInfo[UNICODE_CANONICALIZATION_RANGES] = {\n")
+
+        for info in rangeInfo:
+            typeAndValue = info["type"].split(":")
+            file.write("    {{ 0x{begin:04x}, 0x{end:04x}, 0x{value:04x}, {type} }},\n".format(begin=info["begin"], end=info["end"], value=int(typeAndValue[1]), type=typeAndValue[0]))
+
+        file.write("};\n")
+        file.write("\n")
+
+        
+if __name__ == "__main__":
+    parser = optparse.OptionParser(usage = "usage: %prog  <CaseFolding.txt> <YarrCanonicalizeUnicode.h>")
+    (options, args) = parser.parse_args()
+
+    if len(args) != 2:
+        parser.error("<CaseFolding.txt> <YarrCanonicalizeUnicode.h>")
+
+    caseFoldingTxtPath = args[0]
+    canonicalizeHPath = args[1]
+    caseFoldingTxtFile = openOrExit(caseFoldingTxtPath, "r")
+    canonicalizeHFile = openOrExit(canonicalizeHPath, "wb")
+
+    canonicalize = Canonicalize()
+    canonicalize.readCaseFolding(caseFoldingTxtFile)
+
+    canonicalizeHFile.write(header);
+    canonicalize.createTables(canonicalizeHFile)
+    canonicalizeHFile.write(footer);
+
+    caseFoldingTxtFile.close()
+    canonicalizeHFile.close()
+
+    exit(0)

Modified: trunk/Source/WTF/ChangeLog (222498 => 222499)


--- trunk/Source/WTF/ChangeLog	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/WTF/ChangeLog	2017-09-26 15:34:19 UTC (rev 222499)
@@ -1,3 +1,23 @@
+2017-09-24  Keith Miller  <[email protected]>
+
+        JSC build should use unified sources for derived sources
+        https://bugs.webkit.org/show_bug.cgi?id=177421
+
+        Reviewed by JF Bastien.
+
+        The script now needs to determine if a file is from a derived
+        source. This is only relevant for the CMake build since the
+        script needs to provide a list of the bundled source files. If the
+        script does not provide the full path for derived sources then
+        CMake will be unable to find them and the build will fail.
+
+        Additionally, I move the error message for the Xcode build outside
+        the main loop. This means that the error message will contain all
+        the files you need to add to Xcode and all those files will now be
+        written in DerivedSources so they should be easier to add.
+
+        * Scripts/generate-unified-source-bundles.rb:
+
 2017-09-26  Zan Dobersek  <[email protected]>
 
         Support building _javascript_Core with the Bionic C library

Modified: trunk/Source/WTF/Scripts/generate-unified-source-bundles.rb (222498 => 222499)


--- trunk/Source/WTF/Scripts/generate-unified-source-bundles.rb	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/WTF/Scripts/generate-unified-source-bundles.rb	2017-09-26 15:34:19 UTC (rev 222499)
@@ -29,13 +29,17 @@
 COMMENT_REGEXP = /#/
 
 def usage
-    puts "usage: #{SCRIPT_NAME} [options] -p <desination-path> <sources-file>"
+    puts "usage: #{SCRIPT_NAME} [options] <sources-file>"
     puts "--help                          (-h) Print this message"
     puts "--verbose                       (-v) Adds extra logging to stderr."
+    puts "Required arguments:"
+    puts "--source-tree-path              (-s) Path to the root of the source directory."
+    puts "--derived-sources-path          (-d) Path to the directory where the unified source files should be placed."
+    puts
+    puts "Optional arguments:"
     puts "--print-bundled-sources              Print bundled sources rather than generating sources"
     puts
     puts "Generation options:"
-    puts "--derived-sources-path          (-p) Path to the directory where the unified source files should be placed. This argument is required."
     puts "--max-cpp-bundle-count               Sets the limit on the number of cpp bundles that can be generated"
     puts "--max-obj-c-bundle-count             Sets the limit on the number of Obj-C bundles that can be generated"
     exit 1
@@ -43,6 +47,8 @@
 
 MAX_BUNDLE_SIZE = 8
 $derivedSourcesPath = nil
+$unifiedSourceOutputPath = nil
+$sourceTreePath = nil
 $verbose = false
 $mode = :GenerateBundles
 $maxCppBundleCount = 100000
@@ -54,8 +60,9 @@
 
 GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT],
                ['--verbose', '-v', GetoptLong::NO_ARGUMENT],
+               ['--derived-sources-path', '-d', GetoptLong::REQUIRED_ARGUMENT],
+               ['--source-tree-path', '-s', GetoptLong::REQUIRED_ARGUMENT],
                ['--print-bundled-sources', GetoptLong::NO_ARGUMENT],
-               ['--derived-sources-path', '-p', GetoptLong::REQUIRED_ARGUMENT],
                ['--max-cpp-bundle-count', GetoptLong::REQUIRED_ARGUMENT],
                ['--max-obj-c-bundle-count', GetoptLong::REQUIRED_ARGUMENT]).each {
     | opt, arg |
@@ -64,11 +71,15 @@
         usage
     when '--verbose'
         $verbose = true
-    when "--print-bundled-sources"
+    when '--derived-sources-path'
+        $derivedSourcesPath = Pathname.new(arg)
+        $unifiedSourceOutputPath = $derivedSourcesPath + Pathname.new("unified-sources")
+        FileUtils.mkdir($unifiedSourceOutputPath) if !$unifiedSourceOutputPath.exist?
+    when '--source-tree-path'
+        $sourceTreePath = Pathname.new(arg)
+        usage if !$sourceTreePath.exist?
+    when '--print-bundled-sources'
         $mode = :PrintBundledSources
-    when '--derived-sources-path'
-        $derivedSourcesPath = Pathname.new(arg) + Pathname.new("unified-souces")
-        FileUtils.mkdir($derivedSourcesPath) if !$derivedSourcesPath.exist?
     when '--max-cpp-bundle-count'
         $maxCppBundleCount = arg.to_i
     when '--max-obj-c-bundle-count'
@@ -76,10 +87,9 @@
     end
 }
 
-if $mode == :GenerateBundles
-    usage if !$derivedSourcesPath
-    log("putting unified sources in #{$derivedSourcesPath}")
-end
+usage if !$unifiedSourceOutputPath || !$sourceTreePath
+log("putting unified sources in #{$unifiedSourceOutputPath}")
+
 usage if ARGV.length == 0
 $generatedSources = []
 
@@ -104,6 +114,19 @@
 
         super(file)
     end
+
+    def derived?
+        return @derived if @derived != nil
+        @derived = !($sourceTreePath + self).exist?
+    end
+
+    def display
+        if $mode == :GenerateBundles || !derived?
+            self.to_s
+        else
+            ($derivedSourcesPath + self).to_s
+        end
+    end
 end
 
 class BundleManager
@@ -117,19 +140,18 @@
         @maxCount = max
     end
 
+    def bundleFileName(number)
+        "UnifiedSource#{number}.#{extension}"
+    end
+
     def flush
         # No point in writing an empty bundle file
         return if @currentBundleText == ""
 
         @bundleCount += 1
-        bundleFileName = "UnifiedSource#{@bundleCount}.#{extension}"
+        bundleFile = $unifiedSourceOutputPath + bundleFileName(@bundleCount)
+        $generatedSources << bundleFile
 
-        if @bundleCount > @maxCount
-            raise "number of bundles for #{extension} sources, #{@bundleCount}, exceeded limit, #{@maxCount}. Please add #{bundleFileName} to Xcode then update UnifiedSource#{extension.capitalize}FileCount"
-        end
-
-        bundleFile = $derivedSourcesPath + bundleFileName
-        $generatedSources << bundleFile
         if (!bundleFile.exist? || IO::read(bundleFile) != @currentBundleText)
             log("writing bundle #{bundleFile} with: \n#{@currentBundleText}")
             IO::write(bundleFile, @currentBundleText)
@@ -183,7 +205,6 @@
 
     log("found #{sources.length} source files in #{sourcesFile}")
 
-    currentDirectory = nil
     sources.sort.each {
         | file |
 
@@ -199,7 +220,21 @@
     $bundleManagers.each_value { |x| x.flush } if $mode == :GenerateBundles
 }
 
+$bundleManagers.each_value {
+    | manager |
+
+    maxCount = manager.maxCount
+    bundleCount = manager.bundleCount
+    extension = manager.extension
+    if bundleCount > maxCount
+        filesToAdd = ((maxCount+1)..bundleCount).map { |x| manager.bundleFileName(x) }.join(", ")
+        raise "number of bundles for #{extension} sources, #{bundleCount}, exceeded limit, #{maxCount}. Please add #{filesToAdd} to Xcode then update UnifiedSource#{extension.capitalize}FileCount"
+    end
+}
+
 # We use stdout to report our unified source list to CMake.
 # Add trailing semicolon since CMake seems dislikes not having it.
 # Also, make sure we use print instead of puts because CMake will think the \n is a source file and fail to build.
+
+$generatedSources.map! { |path| path.display } if $mode == :PrintBundledSources
 print($generatedSources.join(";") + ";")

Modified: trunk/Source/cmake/WebKitMacros.cmake (222498 => 222499)


--- trunk/Source/cmake/WebKitMacros.cmake	2017-09-26 09:48:23 UTC (rev 222498)
+++ trunk/Source/cmake/WebKitMacros.cmake	2017-09-26 15:34:19 UTC (rev 222499)
@@ -17,6 +17,8 @@
     endif ()
 
     execute_process(COMMAND ${RUBY_EXECUTABLE} ${WTF_SCRIPTS_DIR}/generate-unified-source-bundles.rb
+        "--derived-sources-path" "${DERIVED_SOURCES_DIR}/${_framework}"
+        "--source-tree-path" ${CMAKE_CURRENT_SOURCE_DIR}
         "--print-bundled-sources"
         ${CMAKE_CURRENT_SOURCE_DIR}/Sources.txt
         ${_platformSourcesFile}
@@ -35,6 +37,7 @@
 
     execute_process(COMMAND ${RUBY_EXECUTABLE} ${WTF_SCRIPTS_DIR}/generate-unified-source-bundles.rb
         "--derived-sources-path" "${DERIVED_SOURCES_DIR}/${_framework}"
+        "--source-tree-path" ${CMAKE_CURRENT_SOURCE_DIR}
         ${CMAKE_CURRENT_SOURCE_DIR}/Sources.txt
         ${_platformSourcesFile}
         RESULT_VARIABLE  _resultTmp
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to