Automate WebCore JS builtins generation and build system
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Oct 2015 12:52:33 +0000 (12:52 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Oct 2015 12:52:33 +0000 (12:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149751

Reviewed by Darin Adler.

Source/JavaScriptCore:

* generate-js-builtins: updating the part related to WebCore JS binding.

Source/WebCore:

Adding annotations to JS files to know whether they should be under a compilation flag and
whether they are JS internals or JS tied to WebIDL.
If a file is said as JS internals, all function names are exported automatically.
Added auto generation of WebCoreJSBuiltins.cpp
Added auto generation of JSBuiltinFunctions class inside WebCoreJSBuiltins that takes the role of
WebCoreJSClientData as wrapper for builtins. Renamed WebCoreJSClientData to JSClientData.
Added auto generation of PrivateWebCoreJSBuiltins that is a wrapper around all private functions, used by
JSDOMWindowBase. The class is named JSBuiltinInternalFunctions.

The remaining manual part for private functions is the pairing between private identifiers and
the private JS functions within JSDOMWindowBase::finishCreation.

Covered by existing tests.

* CMakeLists.txt:
* DerivedSources.make:
* Modules/streams/ByteLengthQueuingStrategy.js:
* Modules/streams/CountQueuingStrategy.js:
* Modules/streams/ReadableStream.js:
* Modules/streams/ReadableStreamInternals.js:
* WebCore.order:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/DOMWrapperWorld.cpp:
(WebCore::DOMWrapperWorld::DOMWrapperWorld):
(WebCore::DOMWrapperWorld::~DOMWrapperWorld):
(WebCore::normalWorld):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::JSDOMWindowBase):
(WebCore::JSDOMWindowBase::finishCreation):
(WebCore::JSDOMWindowBase::visitChildren):
(WebCore::JSDOMWindowBase::fireFrameClearedWatchpointsForWindow):
* bindings/js/JSDOMWindowBase.h:
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::getAllWorlds):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::transferArrayBuffers):
* bindings/js/WebCoreJSClientData.h:
(WebCore::JSClientData::JSClientData):
(WebCore::JSClientData::~JSClientData):
(WebCore::JSClientData::builtinFunctions):
(WebCore::initNormalWorldClientData):
(WebCore::WebCoreJSClientData::WebCoreJSClientData): Deleted.
(WebCore::WebCoreJSClientData::~WebCoreJSClientData): Deleted.
(WebCore::WebCoreJSClientData::readableStreamBuiltins): Deleted.
(WebCore::WebCoreJSClientData::readableStreamControllerBuiltins): Deleted.
(WebCore::WebCoreJSClientData::readableStreamInternalsBuiltins): Deleted.
(WebCore::WebCoreJSClientData::readableStreamReaderBuiltins): Deleted.
(WebCore::WebCoreJSClientData::byteLengthQueuingStrategyBuiltins): Deleted.
(WebCore::WebCoreJSClientData::countQueuingStrategyBuiltins): Deleted.
* generate-js-builtins-allinone: Added.
(retrieveGenerationParameters):
(retrieveFilesWithParameters):
(retrieveFilesWithParameters.FileInput):
(writeConditional):
(JSBuiltinFunctions):
(Private):
(JSBuiltinInternalFunctions):
(copytempfile):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190664 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/generate-js-builtins
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/streams/ByteLengthQueuingStrategy.js
Source/WebCore/Modules/streams/CountQueuingStrategy.js
Source/WebCore/Modules/streams/ReadableStream.js
Source/WebCore/Modules/streams/ReadableStreamInternals.js
Source/WebCore/WebCore.order
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/DOMWrapperWorld.cpp
Source/WebCore/bindings/js/JSDOMWindowBase.cpp
Source/WebCore/bindings/js/JSDOMWindowBase.h
Source/WebCore/bindings/js/ScriptController.cpp
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/bindings/js/WebCoreJSClientData.h
Source/WebCore/generate-js-builtins-allinone [new file with mode: 0644]

index 90475f6..a535be4 100644 (file)
@@ -1,3 +1,12 @@
+2015-10-07  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        Automate WebCore JS builtins generation and build system
+        https://bugs.webkit.org/show_bug.cgi?id=149751
+
+        Reviewed by Darin Adler.
+
+        * generate-js-builtins: updating the part related to WebCore JS binding.
+
 2015-10-06  Mark Lam  <mark.lam@apple.com>
 
         Factoring out op_sub baseline code generation into JITSubGenerator.
index b2841f4..a9de1d8 100644 (file)
@@ -314,8 +314,8 @@ if (namespace == "JSC"):
 else:
     builtinName = scopeName[0].lower() + scopeName[1:]
     builtinsImplementation.write("""{\\
-    WebCoreJSClientData* clientData = static_cast<WebCoreJSClientData*>(vm.clientData); \\
-    return clientData->%s().codeName##Executable()->link(vm, clientData->%s().codeName##Source()); \\
+    JSClientData* clientData = static_cast<JSClientData*>(vm.clientData); \\
+    return clientData->builtinFunctions().%s().codeName##Executable()->link(vm, clientData->builtinFunctions().%s().codeName##Source()); \\
 """% (builtinName, builtinName))
 
 builtinsImplementation.write("""}
index b455bc8..3adb23f 100644 (file)
@@ -1242,7 +1242,6 @@ set(WebCore_SOURCES
     bindings/js/ScriptGlobalObject.cpp
     bindings/js/ScriptState.cpp
     bindings/js/SerializedScriptValue.cpp
-    bindings/js/WebCoreJSBuiltins.cpp
     bindings/js/WebCoreTypedArrayController.cpp
     bindings/js/WorkerScriptController.cpp
     bindings/js/WorkerScriptDebugServer.cpp
@@ -3593,6 +3592,17 @@ foreach (_builtinjs ${WEBCORE_JS_BUILTINS})
     )
     ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/bindings/js/WebCoreJSBuiltins.cpp ${_name}Builtins.cpp)
 endforeach ()
+add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/PrivateWebCoreJSBuiltins.h ${DERIVED_SOURCES_WEBCORE_DIR}/WebCoreJSBuiltins.h ${DERIVED_SOURCES_WEBCORE_DIR}/WebCoreJSBuiltins.cpp
+    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/generate-js-builtins-allinone
+    DEPENDS ${WebCore_GENERATE_JS_BUILTINS_SCRIPTS_DIR}/generate-js-builtins
+    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate-js-builtins-allinone ${WEBCORE_JS_BUILTINS} --output_dir ${DERIVED_SOURCES_WEBCORE_DIR}
+    VERBATIM)
+list(APPEND WebCore_SOURCES
+    ${DERIVED_SOURCES_WEBCORE_DIR}/PrivateWebCoreJSBuiltins.h
+    ${DERIVED_SOURCES_WEBCORE_DIR}/WebCoreJSBuiltins.h
+    ${DERIVED_SOURCES_WEBCORE_DIR}/WebCoreJSBuiltins.cpp
+)
 
 ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/html/HTMLTreeBuilder.cpp MathMLNames.cpp)
 
index 14439d1..853dd1b 100644 (file)
@@ -1,3 +1,70 @@
+2015-10-07  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        Automate WebCore JS builtins generation and build system
+        https://bugs.webkit.org/show_bug.cgi?id=149751
+
+        Reviewed by Darin Adler.
+
+        Adding annotations to JS files to know whether they should be under a compilation flag and
+        whether they are JS internals or JS tied to WebIDL.
+        If a file is said as JS internals, all function names are exported automatically.
+        Added auto generation of WebCoreJSBuiltins.cpp
+        Added auto generation of JSBuiltinFunctions class inside WebCoreJSBuiltins that takes the role of
+        WebCoreJSClientData as wrapper for builtins. Renamed WebCoreJSClientData to JSClientData.
+        Added auto generation of PrivateWebCoreJSBuiltins that is a wrapper around all private functions, used by
+        JSDOMWindowBase. The class is named JSBuiltinInternalFunctions.
+
+        The remaining manual part for private functions is the pairing between private identifiers and
+        the private JS functions within JSDOMWindowBase::finishCreation.
+
+        Covered by existing tests.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Modules/streams/ByteLengthQueuingStrategy.js:
+        * Modules/streams/CountQueuingStrategy.js:
+        * Modules/streams/ReadableStream.js:
+        * Modules/streams/ReadableStreamInternals.js:
+        * WebCore.order:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/DOMWrapperWorld.cpp:
+        (WebCore::DOMWrapperWorld::DOMWrapperWorld):
+        (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
+        (WebCore::normalWorld):
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::JSDOMWindowBase):
+        (WebCore::JSDOMWindowBase::finishCreation):
+        (WebCore::JSDOMWindowBase::visitChildren):
+        (WebCore::JSDOMWindowBase::fireFrameClearedWatchpointsForWindow):
+        * bindings/js/JSDOMWindowBase.h:
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::getAllWorlds):
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::SerializedScriptValue::transferArrayBuffers):
+        * bindings/js/WebCoreJSClientData.h:
+        (WebCore::JSClientData::JSClientData):
+        (WebCore::JSClientData::~JSClientData):
+        (WebCore::JSClientData::builtinFunctions):
+        (WebCore::initNormalWorldClientData):
+        (WebCore::WebCoreJSClientData::WebCoreJSClientData): Deleted.
+        (WebCore::WebCoreJSClientData::~WebCoreJSClientData): Deleted.
+        (WebCore::WebCoreJSClientData::readableStreamBuiltins): Deleted.
+        (WebCore::WebCoreJSClientData::readableStreamControllerBuiltins): Deleted.
+        (WebCore::WebCoreJSClientData::readableStreamInternalsBuiltins): Deleted.
+        (WebCore::WebCoreJSClientData::readableStreamReaderBuiltins): Deleted.
+        (WebCore::WebCoreJSClientData::byteLengthQueuingStrategyBuiltins): Deleted.
+        (WebCore::WebCoreJSClientData::countQueuingStrategyBuiltins): Deleted.
+        * generate-js-builtins-allinone: Added.
+        (retrieveGenerationParameters):
+        (retrieveFilesWithParameters):
+        (retrieveFilesWithParameters.FileInput):
+        (writeConditional):
+        (JSBuiltinFunctions):
+        (Private):
+        (JSBuiltinInternalFunctions):
+        (copytempfile):
+
 2015-10-05  Sergio Villar Senin  <svillar@igalia.com>
 
         [css-grid] Implement grid gutters
index 46654f2..a5967e7 100644 (file)
@@ -1260,9 +1260,12 @@ WEBCORE_JS_BUILTINS = \
     $(WebCore)/Modules/streams/ReadableStreamReader.js \
 #
 
-all : $(WEBCORE_JS_BUILTINS:%.js=%Builtins.cpp)
+all : WebCoreJSBuiltins.cpp $(WEBCORE_JS_BUILTINS:%.js=%Builtins.cpp)
 
-%Builtins.cpp: %.js
+WebCoreJSBuiltins.cpp: $(WEBCORE_JS_BUILTINS) $(WebCore)/generate-js-builtins-allinone
+       $(PYTHON) $(WebCore)/generate-js-builtins-allinone $(WEBCORE_JS_BUILTINS)  --output_dir .
+
+%Builtins.cpp: %.js $(WebCore)/generate-js-builtins
        $(PYTHON) $(WebCore)/generate-js-builtins --input $< --generate_js_builtins_path $(GenerateJSBuiltinsScripts)
 
 # ------------------------
index a826736..f948125 100644 (file)
@@ -24,6 +24,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// @optional=STREAMS_API
+
 function size(chunk)
 {
     "use strict";
index 911737d..44d630b 100644 (file)
@@ -23,6 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// @optional=STREAMS_API
+
 function size()
 {
     "use strict";
index d36693a..d1f1af0 100644 (file)
@@ -97,6 +97,8 @@ function getReader()
     return new @ReadableStreamReader(this);
 }
 
+// @optional=STREAMS_API
+
 function pipeThrough(streams, options)
 {
     "use strict";
index ebd7f99..6d8fe66 100644 (file)
@@ -71,6 +71,9 @@ function privateInitializeReadableStreamController(stream)
     return this;
 }
 
+// @optional=STREAMS_API
+// @internals
+
 function teeReadableStream(stream, shouldClone)
 {
     "use strict";
index 19a180d..103a18b 100644 (file)
@@ -24723,7 +24723,7 @@ __ZN7WebCoreL24JSDOMURLConstructorTableE
 __ZZN7WebCore12wrapperOwnerEPNS_15DOMWrapperWorldEPNS_6DOMURLEE13jsDOMURLOwner
 __ZGVZN7WebCore12wrapperOwnerEPNS_15DOMWrapperWorldEPNS_6DOMURLEE13jsDOMURLOwner
 __ZN7WebCoreL27JSDOMWindowConstructorTableE
-__ZTVN7WebCore19WebCoreJSClientDataE
+__ZTVN7WebCore19JSClientDataE
 __ZN7WebCoreL40JSDynamicsCompressorNodeConstructorTableE
 __ZN7WebCoreL38JSDynamicsCompressorNodePrototypeTableE
 __ZN7WebCoreL29JSDynamicsCompressorNodeTableE
index 9492e06..6e8589c 100644 (file)
     <ClCompile />
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\WebCoreJSBuiltins.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\ColorData.cpp" />
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\CSSGrammar.cpp">
       <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="..\bindings\js\WebCoreJSBuiltins.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
-    </ClCompile>
     <ClCompile Include="..\bindings\js\WorkerScriptController.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
index e2ebe95..20db045 100644 (file)
                40ECAE7E16B8B67200C36103 /* JSDOMError.h in Headers */ = {isa = PBXBuildFile; fileRef = 40ECAE7D16B8B67200C36103 /* JSDOMError.h */; };
                40ECAE8116B8B68A00C36103 /* JSDOMError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 40ECAE8016B8B68A00C36103 /* JSDOMError.cpp */; };
                410B7E721045FAB000D8224F /* JSMessageEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */; };
-               411A90421BBAB47A000CF156 /* WebCoreJSBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 411A90411BBAB46D000CF156 /* WebCoreJSBuiltins.cpp */; };
                4123081B138C429700BCCFCA /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93F19B1A08245E5A001E9ABC /* WebCore.framework */; };
                41230913138C42FF00BCCFCA /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8216299029F4FB501000131 /* JavaScriptCore.framework */; };
                4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */; };
                416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */; };
                416E6FE81BBD12DF000A6043 /* ReadableStreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
                416E6FE91BBD12E5000A6043 /* ReadableStreamBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               416E6FEA1BBD1684000A6043 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8071BB3110D00B764D9 /* ReadableStreamInternalsBuiltinsWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               416E6FEA1BBD1684000A6044 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8071BB3110D00B764DA /* ReadableStreamInternalsBuiltinsWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               416E6FEA1BBD1684000A6043 /* PrivateWebCoreJSBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8071BB3110D00B764D9 /* PrivateWebCoreJSBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
                417253AA1354BBBC00360F2A /* MediaControlElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 417253A81354BBBC00360F2A /* MediaControlElements.cpp */; };
                417253AB1354BBBC00360F2A /* MediaControlElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 417253A91354BBBC00360F2A /* MediaControlElements.h */; };
                417DA6D913734E6E007C57FB /* Internals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 417DA4CF13734326007C57FB /* Internals.cpp */; };
                7C48A6D0191C9D6500026674 /* WebKitNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C48A6CE191C9D6500026674 /* WebKitNamespace.cpp */; };
                7C48A6D1191C9D6500026674 /* WebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C48A6CF191C9D6500026674 /* WebKitNamespace.h */; };
                7C4902A218B825F8007D9298 /* DOMWheelEventInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85989DCA0ACC8BBD00A0BC51 /* DOMWheelEventInternal.h */; };
+               7C4C96DC1AD4483500365A51 /* WebCoreJSBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96D81AD4483500365A51 /* WebCoreJSBuiltins.cpp */; };
                7C4C96DC1AD4483500365A50 /* JSReadableStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96D81AD4483500365A50 /* JSReadableStream.cpp */; };
                7C4C96DD1AD4483500365A50 /* JSReadableStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4C96D91AD4483500365A50 /* JSReadableStream.h */; };
                7C4C96DE1AD4483500365A50 /* JSReadableStreamReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96DA1AD4483500365A50 /* JSReadableStreamReader.cpp */; };
                40ECAE8016B8B68A00C36103 /* JSDOMError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMError.cpp; sourceTree = "<group>"; };
                410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageEventCustom.cpp; sourceTree = "<group>"; };
                41189EF71AD8232800B90A0D /* ReadableStreamController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStreamController.idl; sourceTree = "<group>"; };
-               411A90411BBAB46D000CF156 /* WebCoreJSBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreJSBuiltins.cpp; sourceTree = "<group>"; };
                4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; };
                4129DF811BB5B79B00322A16 /* ReadableStreamController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamController.h; sourceTree = "<group>"; };
                4129DF821BB5B7A600322A16 /* ReadableStreamReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamReader.h; sourceTree = "<group>"; };
                7C48A6CE191C9D6500026674 /* WebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitNamespace.cpp; sourceTree = "<group>"; };
                7C48A6CF191C9D6500026674 /* WebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNamespace.h; sourceTree = "<group>"; };
                7C48A6D2191C9D8E00026674 /* WebKitNamespace.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebKitNamespace.idl; sourceTree = "<group>"; };
+               7C4C96D81AD4483500365A51 /* WebCoreJSBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreJSBuiltins.cpp; sourceTree = "<group>"; };
                7C4C96D81AD4483500365A50 /* JSReadableStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStream.cpp; sourceTree = "<group>"; };
                7C4C96D91AD4483500365A50 /* JSReadableStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReadableStream.h; sourceTree = "<group>"; };
                7C4C96DA1AD4483500365A50 /* JSReadableStreamReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStreamReader.cpp; sourceTree = "<group>"; };
                9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamBuiltins.h; sourceTree = "<group>"; };
                9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamInternalsBuiltins.h; sourceTree = "<group>"; };
                9B03D8071BB3110D00B764D8 /* ReadableStreamBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamBuiltinsWrapper.h; sourceTree = "<group>"; };
-               9B03D8071BB3110D00B764D9 /* ReadableStreamInternalsBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamInternalsBuiltinsWrapper.h; sourceTree = "<group>"; };
+               9B03D8071BB3110D00B764DA /* ReadableStreamInternalsBuiltinsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamInternalsBuiltinsWrapper.h; sourceTree = "<group>"; };
+               9B03D8071BB3110D00B764D9 /* PrivateWebCoreJSBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateWebCoreJSBuiltins.h; sourceTree = "<group>"; };
                9B19B67E1B964E5200348745 /* ShadowRoot.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ShadowRoot.idl; sourceTree = "<group>"; };
                9B1AB0791648C69D0051F3F2 /* HTMLFormControlsCollection.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLFormControlsCollection.idl; sourceTree = "<group>"; };
                9B1AB07B1648C7C40051F3F2 /* JSHTMLFormControlsCollectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFormControlsCollectionCustom.cpp; sourceTree = "<group>"; };
                41A023FA1A39F13A00F722CF /* Streams */ = {
                        isa = PBXGroup;
                        children = (
+                               7C4C96D81AD4483500365A51 /* WebCoreJSBuiltins.cpp */,
                                7C4C96D81AD4483500365A50 /* JSReadableStream.cpp */,
                                7C4C96D91AD4483500365A50 /* JSReadableStream.h */,
                                6C4C96DA1AD4483500365A50 /* JSReadableStreamController.cpp */,
                                9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */,
                                9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */,
                                9B03D8071BB3110D00B764D8 /* ReadableStreamBuiltinsWrapper.h */,
-                               9B03D8071BB3110D00B764D9 /* ReadableStreamInternalsBuiltinsWrapper.h */,
+                               9B03D8071BB3110D00B764DA /* ReadableStreamInternalsBuiltinsWrapper.h */,
+                               9B03D8071BB3110D00B764D9 /* PrivateWebCoreJSBuiltins.h */,
                                43B85ED218CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp */,
                                43B85ED318CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.gperf */,
                                26AA0F9D18D2A18B00419381 /* SelectorPseudoElementTypeMap.cpp */,
                                1400D7A717136EA70077CE05 /* ScriptWrappableInlines.h */,
                                A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */,
                                A75E497410752ACB00C9B896 /* SerializedScriptValue.h */,
-                               411A90411BBAB46D000CF156 /* WebCoreJSBuiltins.cpp */,
                                BC53D910114310CC000D817E /* WebCoreJSClientData.h */,
                                0F099D0617B968A100FF84B9 /* WebCoreTypedArrayController.cpp */,
                                0F099D0717B968A100FF84B9 /* WebCoreTypedArrayController.h */,
                                FC9E0E4D16419C1E00392BE3 /* JSDOMWindowCSS.h in Headers */,
                                652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */,
                                BCBFB53D0DCD29CF0019B3E5 /* JSDOMWindowShell.h in Headers */,
-                               416E6FEA1BBD1684000A6043 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */,
+                               416E6FEA1BBD1684000A6044 /* ReadableStreamInternalsBuiltinsWrapper.h in Headers */,
+                               416E6FEA1BBD1684000A6043 /* PrivateWebCoreJSBuiltins.h in Headers */,
                                65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */,
                                FD7868BA136B999200D403DF /* JSDynamicsCompressorNode.h in Headers */,
                                65DF31FA09D1CC60000BE325 /* JSElement.h in Headers */,
                                A8EA79F30A1916DF00A8EF5F /* HTMLUListElement.cpp in Sources */,
                                E44613AA0CD6331000FADA75 /* HTMLVideoElement.cpp in Sources */,
                                839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */,
-                               411A90421BBAB47A000CF156 /* WebCoreJSBuiltins.cpp in Sources */,
                                0B8C56D40F28627F000502E1 /* HTTPHeaderMap.cpp in Sources */,
                                1AC900C31943C0FC008625B5 /* HTTPHeaderNames.cpp in Sources */,
                                514C76720CE923A1007EF3CD /* HTTPParsers.cpp in Sources */,
                                077664FC183E6B5C00133B92 /* JSQuickTimePluginReplacement.cpp in Sources */,
                                B658FFA11522EF3A00DD5595 /* JSRadioNodeList.cpp in Sources */,
                                65DF320109D1CC60000BE325 /* JSRange.cpp in Sources */,
+                               7C4C96DC1AD4483500365A51 /* WebCoreJSBuiltins.cpp in Sources */,
                                7C4C96DC1AD4483500365A50 /* JSReadableStream.cpp in Sources */,
                                6C4C96DE1AD4483500365A50 /* JSReadableStreamController.cpp in Sources */,
                                7C4C96DE1AD4483500365A50 /* JSReadableStreamReader.cpp in Sources */,
index 3dd25e1..3a9accb 100644 (file)
@@ -36,14 +36,14 @@ DOMWrapperWorld::DOMWrapperWorld(JSC::VM& vm, bool isNormal)
 {
     VM::ClientData* clientData = m_vm.clientData;
     ASSERT(clientData);
-    static_cast<WebCoreJSClientData*>(clientData)->rememberWorld(*this);
+    static_cast<JSClientData*>(clientData)->rememberWorld(*this);
 }
 
 DOMWrapperWorld::~DOMWrapperWorld()
 {
     VM::ClientData* clientData = m_vm.clientData;
     ASSERT(clientData);
-    static_cast<WebCoreJSClientData*>(clientData)->forgetWorld(*this);
+    static_cast<JSClientData*>(clientData)->forgetWorld(*this);
 
     // These items are created lazily.
     while (!m_scriptControllersWithWindowShells.isEmpty())
@@ -63,7 +63,7 @@ DOMWrapperWorld& normalWorld(JSC::VM& vm)
 {
     VM::ClientData* clientData = vm.clientData;
     ASSERT(clientData);
-    return static_cast<WebCoreJSClientData*>(clientData)->normalWorld();
+    return static_cast<JSClientData*>(clientData)->normalWorld();
 }
 
 DOMWrapperWorld& mainThreadNormalWorld()
index 9e0ff4f..531f4dd 100644 (file)
@@ -70,9 +70,7 @@ JSDOMWindowBase::JSDOMWindowBase(VM& vm, Structure* structure, PassRefPtr<DOMWin
     , m_windowCloseWatchpoints((window && window->frame()) ? IsWatched : IsInvalidated)
     , m_impl(window)
     , m_shell(shell)
-#if ENABLE(STREAMS_API)
-    , m_readableStreamFunctions(vm)
-#endif
+    , m_privateFunctions(vm)
 {
 }
 
@@ -81,23 +79,21 @@ void JSDOMWindowBase::finishCreation(VM& vm, JSDOMWindowShell* shell)
     Base::finishCreation(vm, shell);
     ASSERT(inherits(info()));
 
-#if ENABLE(STREAMS_API)
-    m_readableStreamFunctions.init(*this);
-#endif
+    m_privateFunctions.init(*this);
 
     GlobalPropertyInfo staticGlobals[] = {
         GlobalPropertyInfo(vm.propertyNames->document, jsNull(), DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->window, m_shell, DontDelete | ReadOnly),
 #if ENABLE(STREAMS_API)
-        GlobalPropertyInfo(static_cast<WebCoreJSClientData*>(vm.clientData)->builtinNames().readableStreamClosedPrivateName(), jsNumber(1), DontDelete | ReadOnly),
-        GlobalPropertyInfo(static_cast<WebCoreJSClientData*>(vm.clientData)->builtinNames().readableStreamErroredPrivateName(), jsNumber(2), DontDelete | ReadOnly),
-        GlobalPropertyInfo(static_cast<WebCoreJSClientData*>(vm.clientData)->builtinNames().readableStreamReadablePrivateName(), jsNumber(3), DontDelete | ReadOnly),
-        GlobalPropertyInfo(static_cast<WebCoreJSClientData*>(vm.clientData)->builtinNames().ReadableStreamControllerPrivateName(), createReadableStreamControllerPrivateConstructor(vm, *this), DontDelete | ReadOnly),
-        GlobalPropertyInfo(static_cast<WebCoreJSClientData*>(vm.clientData)->builtinNames().ReadableStreamReaderPrivateName(), createReadableStreamReaderPrivateConstructor(vm, *this), DontDelete | ReadOnly),
+        GlobalPropertyInfo(static_cast<JSClientData*>(vm.clientData)->builtinNames().readableStreamClosedPrivateName(), jsNumber(1), DontDelete | ReadOnly),
+        GlobalPropertyInfo(static_cast<JSClientData*>(vm.clientData)->builtinNames().readableStreamErroredPrivateName(), jsNumber(2), DontDelete | ReadOnly),
+        GlobalPropertyInfo(static_cast<JSClientData*>(vm.clientData)->builtinNames().readableStreamReadablePrivateName(), jsNumber(3), DontDelete | ReadOnly),
+        GlobalPropertyInfo(static_cast<JSClientData*>(vm.clientData)->builtinNames().ReadableStreamControllerPrivateName(), createReadableStreamControllerPrivateConstructor(vm, *this), DontDelete | ReadOnly),
+        GlobalPropertyInfo(static_cast<JSClientData*>(vm.clientData)->builtinNames().ReadableStreamReaderPrivateName(), createReadableStreamReaderPrivateConstructor(vm, *this), DontDelete | ReadOnly),
 #define DECLARE_GLOBAL_STATIC(name)\
         GlobalPropertyInfo(\
-            static_cast<WebCoreJSClientData*>(vm.clientData)->readableStreamInternalsBuiltins().name##PrivateName(),\
-            m_readableStreamFunctions.m_##name##Function.get() , DontDelete | ReadOnly),
+            static_cast<JSClientData*>(vm.clientData)->builtinFunctions().readableStreamInternalsBuiltins().name##PrivateName(), \
+            m_privateFunctions.readableStreamInternals().m_##name##Function.get() , DontDelete | ReadOnly),
         WEBCOREREADABLESTREAMINTERNALS_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_GLOBAL_STATIC)
 #undef EXPORT_FUNCTION
 #endif
@@ -111,9 +107,7 @@ void JSDOMWindowBase::visitChildren(JSCell* cell, SlotVisitor& visitor)
     JSDOMWindowBase* thisObject = jsCast<JSDOMWindowBase*>(cell);
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
-#if ENABLE(STREAMS_API)
-    thisObject->m_readableStreamFunctions.visit(visitor);
-#endif
+    thisObject->m_privateFunctions.visit(visitor);
 }
 
 void JSDOMWindowBase::destroy(JSCell* cell)
@@ -297,7 +291,7 @@ JSDOMWindow* toJSDOMWindow(JSValue value)
 void JSDOMWindowBase::fireFrameClearedWatchpointsForWindow(DOMWindow* window)
 {
     JSC::VM& vm = JSDOMWindowBase::commonVM();
-    WebCoreJSClientData* clientData = static_cast<WebCoreJSClientData*>(vm.clientData);
+    JSClientData* clientData = static_cast<JSClientData*>(vm.clientData);
     Vector<Ref<DOMWrapperWorld>> wrapperWorlds;
     clientData->getAllWorlds(wrapperWorlds);
     for (unsigned i = 0; i < wrapperWorlds.size(); ++i) {
index f40872f..94e03da 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "JSDOMBinding.h"
 #include "JSDOMGlobalObject.h"
-#include "ReadableStreamInternalsBuiltinsWrapper.h"
+#include "PrivateWebCoreJSBuiltins.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -87,9 +87,7 @@ namespace WebCore {
         RefPtr<DOMWindow> m_impl;
         JSDOMWindowShell* m_shell;
 
-#if ENABLE(STREAMS_API)
-        ReadableStreamInternalsBuiltinFunctions m_readableStreamFunctions;
-#endif
+        JSBuiltinInternalFunctions m_privateFunctions;
     };
 
     // Returns a JSDOMWindow or jsNull()
index 4b3b097..59b58ee 100644 (file)
@@ -194,7 +194,7 @@ Vector<JSC::Strong<JSDOMWindowShell>> ScriptController::windowShells()
 
 void ScriptController::getAllWorlds(Vector<Ref<DOMWrapperWorld>>& worlds)
 {
-    static_cast<WebCoreJSClientData*>(JSDOMWindow::commonVM().clientData)->getAllWorlds(worlds);
+    static_cast<JSClientData*>(JSDOMWindow::commonVM().clientData)->getAllWorlds(worlds);
 }
 
 void ScriptController::clearWindowShell(DOMWindow* newDOMWindow, bool goingIntoPageCache)
index 62ea1c1..f9a4877 100644 (file)
@@ -2634,7 +2634,7 @@ std::unique_ptr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScrip
 
     auto contents = std::make_unique<ArrayBufferContentsArray>(arrayBuffers.size());
     Vector<Ref<DOMWrapperWorld>> worlds;
-    static_cast<WebCoreJSClientData*>(exec->vm().clientData)->getAllWorlds(worlds);
+    static_cast<JSClientData*>(exec->vm().clientData)->getAllWorlds(worlds);
 
     HashSet<JSC::ArrayBuffer*> visited;
     for (size_t arrayBufferIndex = 0; arrayBufferIndex < arrayBuffers.size(); arrayBufferIndex++) {
index 870dd81..f04279a 100644 (file)
 
 #include "DOMWrapperWorld.h"
 #include "WebCoreBuiltinNames.h"
+#include "WebCoreJSBuiltins.h"
 #include "WebCoreTypedArrayController.h"
 #include <wtf/HashSet.h>
 #include <wtf/RefPtr.h>
 
-#if ENABLE(STREAMS_API)
-#include "ByteLengthQueuingStrategyBuiltinsWrapper.h"
-#include "CountQueuingStrategyBuiltinsWrapper.h"
-#include "ReadableStreamBuiltinsWrapper.h"
-#include "ReadableStreamControllerBuiltinsWrapper.h"
-#include "ReadableStreamInternalsBuiltinsWrapper.h"
-#include "ReadableStreamReaderBuiltinsWrapper.h"
-#endif
-
 namespace WebCore {
 
-class WebCoreJSClientData : public JSC::VM::ClientData {
-    WTF_MAKE_NONCOPYABLE(WebCoreJSClientData); WTF_MAKE_FAST_ALLOCATED;
+class JSClientData : public JSC::VM::ClientData {
+    WTF_MAKE_NONCOPYABLE(JSClientData); WTF_MAKE_FAST_ALLOCATED;
     friend class VMWorldIterator;
     friend void initNormalWorldClientData(JSC::VM*);
 
 public:
-    explicit WebCoreJSClientData(JSC::VM& vm)
-        : m_builtinNames(&vm)
-#if ENABLE(STREAMS_API)
-        , m_readableStreamBuiltins(&vm)
-        , m_readableStreamControllerBuiltins(&vm)
-        , m_readableStreamInternalsBuiltins(&vm)
-        , m_readableStreamReaderBuiltins(&vm)
-        , m_byteLengthQueuingStrategyBuiltins(&vm)
-        , m_countQueuingStrategyBuiltins(&vm)
-#endif
+    explicit JSClientData(JSC::VM& vm)
+        : m_builtinFunctions(vm)
+        , m_builtinNames(&vm)
     {
-#if ENABLE(STREAMS_API)
-        m_readableStreamInternalsBuiltins.exportNames();
-#endif
     }
 
-    virtual ~WebCoreJSClientData()
+    virtual ~JSClientData()
     {
         ASSERT(m_worldSet.contains(m_normalWorld.get()));
         ASSERT(m_worldSet.size() == 1);
@@ -94,35 +76,19 @@ public:
     }
 
     WebCoreBuiltinNames& builtinNames() { return m_builtinNames; }
-
-#if ENABLE(STREAMS_API)
-    ReadableStreamBuiltinsWrapper& readableStreamBuiltins() { return m_readableStreamBuiltins; }
-    ReadableStreamControllerBuiltinsWrapper& readableStreamControllerBuiltins() { return m_readableStreamControllerBuiltins; }
-    ReadableStreamInternalsBuiltinsWrapper& readableStreamInternalsBuiltins() { return m_readableStreamInternalsBuiltins; }
-    ReadableStreamReaderBuiltinsWrapper& readableStreamReaderBuiltins() { return m_readableStreamReaderBuiltins; }
-    ByteLengthQueuingStrategyBuiltinsWrapper& byteLengthQueuingStrategyBuiltins() { return m_byteLengthQueuingStrategyBuiltins; }
-    CountQueuingStrategyBuiltinsWrapper& countQueuingStrategyBuiltins() { return m_countQueuingStrategyBuiltins; }
-#endif
+    JSBuiltinFunctions& builtinFunctions() { return m_builtinFunctions; }
 
 private:
     HashSet<DOMWrapperWorld*> m_worldSet;
     RefPtr<DOMWrapperWorld> m_normalWorld;
 
+    JSBuiltinFunctions m_builtinFunctions;
     WebCoreBuiltinNames m_builtinNames;
-
-#if ENABLE(STREAMS_API)
-    ReadableStreamBuiltinsWrapper m_readableStreamBuiltins;
-    ReadableStreamControllerBuiltinsWrapper m_readableStreamControllerBuiltins;
-    ReadableStreamInternalsBuiltinsWrapper m_readableStreamInternalsBuiltins;
-    ReadableStreamReaderBuiltinsWrapper m_readableStreamReaderBuiltins;
-    ByteLengthQueuingStrategyBuiltinsWrapper m_byteLengthQueuingStrategyBuiltins;
-    CountQueuingStrategyBuiltinsWrapper m_countQueuingStrategyBuiltins;
-#endif
 };
 
 inline void initNormalWorldClientData(JSC::VM* vm)
 {
-    WebCoreJSClientData* webCoreJSClientData = new WebCoreJSClientData(*vm);
+    JSClientData* webCoreJSClientData = new JSClientData(*vm);
     vm->clientData = webCoreJSClientData; // ~VM deletes this pointer.
     webCoreJSClientData->m_normalWorld = DOMWrapperWorld::create(*vm, true);
     vm->m_typedArrayController = adoptRef(new WebCoreTypedArrayController());
diff --git a/Source/WebCore/generate-js-builtins-allinone b/Source/WebCore/generate-js-builtins-allinone
new file mode 100644 (file)
index 0000000..105b43f
--- /dev/null
@@ -0,0 +1,233 @@
+#!/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 re
+
+singleLineCommentRegExp = re.compile(r"\/\/ @.*?\n", re.MULTILINE | re.S)
+
+def retrieveGenerationParameters(input):
+    parameters = {}
+    with open(input, 'r') as input_file:
+        content = input_file.read()
+        for match in singleLineCommentRegExp.finditer(content):
+            values = content[match.start() + 4:match.end()].split('=')
+            if len(values) == 1:
+                parameters[values[0].strip()] = True
+            elif len (values) == 2:
+                parameters[values[0].strip()] = values[1].strip()
+            else:
+                print("Skipping potential generation parameter directive:" % values.join('='))
+    return parameters
+
+
+def retrieveFilesWithParameters(inputs):
+    files = []
+    class FileInput: pass
+    for input in inputs:
+        file_input = FileInput()
+        file_input.parameters = retrieveGenerationParameters(input)
+        file_input.optionalif = ("#if ENABLE(" + file_input.parameters["optional"] + ")\n") if "optional" in file_input.parameters else ""
+        file_input.optionalendif = "#endif\n" if "optional" in file_input.parameters else ""
+        file_input.filename = os.path.splitext(os.path.basename(input))[0]
+        file_input.name = file_input.filename[0].lower() + file_input.filename[1:]
+        files.append(file_input)
+    return files
+
+
+def writeConditional(writer, input_file, value):
+    writer.write(input_file.optionalif)
+    writer.write(value)
+    writer.write(input_file.optionalendif)
+
+
+parser = argparse.ArgumentParser()
+parser.add_argument('--output_dir', default='', help='output directory')
+parser.add_argument('inputs', metavar='input', nargs='+', help='path to input JS files')
+
+args = parser.parse_args()
+files = retrieveFilesWithParameters(args.inputs)
+internals_files = [ f for f in files if "internals" in f.parameters ]
+
+basename = "WebCoreJSBuiltins"
+output_base = os.path.join(args.output_dir, basename)
+private_output_base = os.path.join(args.output_dir, "Private" + basename)
+
+
+# Create writers
+builtinsHeader = open(output_base + ".h.tmp", "w")
+builtinsImplementation = open(output_base + ".cpp.tmp", "w")
+privateBuiltinsHeader = open(private_output_base + ".h.tmp", "w")
+
+preamble = """
+/* Generated by generate-js-builtins-allinone 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
+ */
+
+"""
+
+###############
+# Generation of cpp file including all JS builtin generated cpp files with optional #fdef directives as defined by @enable in JS files.
+###############
+builtinsImplementation.write(preamble)
+builtinsImplementation.write("#include \"config.h\"\n\n")
+
+# Including cpp files
+for input_file in files:
+    writeConditional(builtinsImplementation, input_file, "#include \"" + input_file.filename + "Builtins.cpp\"\n");
+
+builtinsImplementation.close()
+
+###############
+# Generation of wrapper header file defining access to all builtin functions.
+###############
+builtinsHeader.write(preamble)
+builtinsHeader.write("#ifndef " + basename + "_h\n#define " + basename + "_h\n\n")
+
+for input_file in files:
+    writeConditional(builtinsHeader, input_file, "#include \"" + input_file.filename + "BuiltinsWrapper.h\"\n");
+builtinsHeader.write("""
+
+#include <runtime/VM.h>
+
+namespace WebCore {
+
+class JSBuiltinFunctions {
+public:
+""")
+
+# Constructor
+builtinsHeader.write("    explicit JSBuiltinFunctions(JSC::VM& v)\n        : vm(v)\n");
+for input_file in files:
+    writeConditional(builtinsHeader, input_file, "        , m_" + input_file.name + "Builtins(&vm)\n");
+builtinsHeader.write("    {\n");
+for input_file in internals_files:
+    writeConditional(builtinsHeader, input_file, "        m_" + input_file.name + "Builtins.exportNames();\n");
+builtinsHeader.write("    }\n");
+
+# Getters
+for input_file in files:
+    writeConditional(builtinsHeader, input_file, "    " + input_file.filename + "BuiltinsWrapper& " + input_file.name  + "Builtins() { return m_" + input_file.name  + "Builtins;}\n");
+
+# Declarations
+builtinsHeader.write("""private:
+    JSC::VM& vm;\n""");
+for input_file in files:
+    writeConditional(builtinsHeader, input_file, "    " + input_file.filename + "BuiltinsWrapper m_" + input_file.name  + "Builtins;\n");
+
+builtinsHeader.write("""
+};
+
+}
+
+#endif
+""");
+
+builtinsHeader.close()
+
+###############
+# Generation of class wrapping all functions of JS files marked as @internals.
+###############
+privateBuiltinsHeader.write(preamble)
+privateBuiltinsHeader.write("#ifndef Private" + basename + "_h\n#define Private" + basename + "_h\n\n")
+
+# Including all necessrary wrapper headers.
+for input_file in internals_files:
+    writeConditional(privateBuiltinsHeader, input_file, "#include \"" + input_file.filename + "BuiltinsWrapper.h\"\n")
+
+# Class definition
+privateBuiltinsHeader.write("""
+namespace WebCore {
+
+class JSBuiltinInternalFunctions {
+public:
+""")
+
+# Constructor
+privateBuiltinsHeader.write("""explicit JSBuiltinInternalFunctions(JSC::VM& v)\n        : vm(v)\n""")
+for input_file in internals_files:
+    writeConditional(privateBuiltinsHeader, input_file, "        , m_" + input_file.name + "Functions(vm)\n")
+privateBuiltinsHeader.write("    { }\n\n")
+
+# Getters
+for input_file in internals_files:
+    writeConditional(privateBuiltinsHeader, input_file, "    " + input_file.filename + "BuiltinFunctions " + input_file.name + "() { return m_" + input_file.name + "Functions; }\n")
+
+# Visitor wrapper routine
+privateBuiltinsHeader.write("    void visit(JSC::SlotVisitor& visitor) {\n")
+for input_file in internals_files:
+    writeConditional(privateBuiltinsHeader, input_file, "        m_" + input_file.name + "Functions.visit(visitor);\n")
+privateBuiltinsHeader.write("    }\n")
+
+# Init wrapper routine
+privateBuiltinsHeader.write("    void init(JSC::JSGlobalObject& globalObject) {\n")
+for input_file in internals_files:
+    writeConditional(privateBuiltinsHeader, input_file, "        m_" + input_file.name + "Functions.init(globalObject);\n")
+privateBuiltinsHeader.write("    }\n")
+
+# Private member fields
+privateBuiltinsHeader.write("""
+private:
+    JSC::VM& vm;\n""")
+for input_file in internals_files:
+    writeConditional(privateBuiltinsHeader, input_file, "     " + input_file.filename + "BuiltinFunctions m_" + input_file.name + "Functions;\n")
+
+privateBuiltinsHeader.write("""
+};
+
+}
+#endif
+""")
+
+privateBuiltinsHeader.close()
+
+def copytempfile(output):
+    if (not os.path.exists(output)) or (not filecmp.cmp(output + ".tmp", output, shallow=False)):
+        if (os.path.exists(output)):
+            os.remove(output)
+        os.rename(output + ".tmp", output)
+    else:
+        os.remove(output + ".tmp")
+
+copytempfile(output_base + ".h")
+copytempfile(output_base + ".cpp")
+copytempfile(private_output_base + ".h")