generate-js-builtins.js should support @internal annotation
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 8 Nov 2015 11:40:35 +0000 (11:40 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 8 Nov 2015 11:40:35 +0000 (11:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150929

Reviewed by Darin Adler.

Source/JavaScriptCore:

* Scripts/builtins/builtins_generate_separate_header.py:
(BuiltinsSeparateHeaderGenerator.generate_output): Generate internal boilerplate code only if @internal annotation is available.
* Scripts/builtins/builtins_templates.py: Split boilerplate in two templates (one that is used for all built-ins and one dedicated to internals).
* Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result: Removed internal boilerplate.
* Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result: Ditto.
* Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result: Ditto.

Source/WebCore:

No change in behavior.

* Modules/streams/ReadableStreamInternals.js: Renamed @internals to @internal.
* Modules/streams/StreamInternals.js: Ditto.
* Modules/streams/WritableStreamInternals.js: Ditto.

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py
Source/JavaScriptCore/Scripts/builtins/builtins_templates.py
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result
Source/WebCore/ChangeLog
Source/WebCore/Modules/streams/ReadableStreamInternals.js
Source/WebCore/Modules/streams/StreamInternals.js
Source/WebCore/Modules/streams/WritableStreamInternals.js

index 082b0a6..37daf19 100644 (file)
@@ -1,3 +1,17 @@
+2015-11-08  Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        generate-js-builtins.js should support @internal annotation
+        https://bugs.webkit.org/show_bug.cgi?id=150929
+
+        Reviewed by Darin Adler.
+
+        * Scripts/builtins/builtins_generate_separate_header.py:
+        (BuiltinsSeparateHeaderGenerator.generate_output): Generate internal boilerplate code only if @internal annotation is available.
+        * Scripts/builtins/builtins_templates.py: Split boilerplate in two templates (one that is used for all built-ins and one dedicated to internals).
+        * Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result: Removed internal boilerplate.
+        * Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result: Ditto.
+        * Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result: Ditto.
+
 2015-11-08  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [ES6] Minimize ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX ifdefs
 2015-11-08  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [ES6] Minimize ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX ifdefs
index 4af0216..b72a94b 100644 (file)
@@ -74,6 +74,8 @@ class BuiltinsSeparateHeaderGenerator(BuiltinsGenerator):
         sections.append(Template(Templates.SeparateHeaderStaticMacros).substitute(args))
         if self.model().framework is Frameworks.WebCore:
             sections.append(Template(Templates.SeparateHeaderWrapperBoilerplate).substitute(args))
         sections.append(Template(Templates.SeparateHeaderStaticMacros).substitute(args))
         if self.model().framework is Frameworks.WebCore:
             sections.append(Template(Templates.SeparateHeaderWrapperBoilerplate).substitute(args))
+            if self.object.annotations.get('internal'):
+                sections.append(Template(Templates.SeparateHeaderInternalFunctionsBoilerplate).substitute(args))
         sections.append(Template(Templates.NamespaceBottom).substitute(args))
         if conditional_guard is not None:
             sections.append("#endif // %s" % conditional_guard)
         sections.append(Template(Templates.NamespaceBottom).substitute(args))
         if conditional_guard is not None:
             sections.append("#endif // %s" % conditional_guard)
index 5c340b2..4b7fcae 100644 (file)
@@ -184,9 +184,10 @@ inline void ${objectName}BuiltinsWrapper::exportNames()
 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
     ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
 #undef EXPORT_FUNCTION_NAME
 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
     ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
 #undef EXPORT_FUNCTION_NAME
-}
+}""")
 
 
-class ${objectName}BuiltinFunctions {
+    SeparateHeaderInternalFunctionsBoilerplate = (
+    """class ${objectName}BuiltinFunctions {
 public:
     explicit ${objectName}BuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
 
 public:
     explicit ${objectName}BuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
 
index 83aed96..fdaf930 100644 (file)
@@ -119,38 +119,6 @@ inline void ArbitraryConditionalGuardBuiltinsWrapper::exportNames()
 #undef EXPORT_FUNCTION_NAME
 }
 
 #undef EXPORT_FUNCTION_NAME
 }
 
-class ArbitraryConditionalGuardBuiltinFunctions {
-public:
-    explicit ArbitraryConditionalGuardBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
-
-    void init(JSC::JSGlobalObject&);
-    void visit(JSC::SlotVisitor&);
-
-public:
-    JSC::VM& m_vm;
-
-#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
-    JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
-    WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
-#undef DECLARE_BUILTIN_SOURCE_MEMBERS
-};
-
-inline void ArbitraryConditionalGuardBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
-{
-#define EXPORT_FUNCTION(codeName, functionName, length)\
-    m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
-    WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(EXPORT_FUNCTION)
-#undef EXPORT_FUNCTION
-}
-
-inline void ArbitraryConditionalGuardBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
-{
-#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
-    WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
-#undef VISIT_FUNCTION
-}
-
-
 } // namespace WebCore
 
 #endif // ENABLE(STREAMS_API) || USE(CF)
 } // namespace WebCore
 
 #endif // ENABLE(STREAMS_API) || USE(CF)
index fdb5403..4d46302 100644 (file)
@@ -119,38 +119,6 @@ inline void GuardedBuiltinBuiltinsWrapper::exportNames()
 #undef EXPORT_FUNCTION_NAME
 }
 
 #undef EXPORT_FUNCTION_NAME
 }
 
-class GuardedBuiltinBuiltinFunctions {
-public:
-    explicit GuardedBuiltinBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
-
-    void init(JSC::JSGlobalObject&);
-    void visit(JSC::SlotVisitor&);
-
-public:
-    JSC::VM& m_vm;
-
-#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
-    JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
-    WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
-#undef DECLARE_BUILTIN_SOURCE_MEMBERS
-};
-
-inline void GuardedBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
-{
-#define EXPORT_FUNCTION(codeName, functionName, length)\
-    m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
-    WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION)
-#undef EXPORT_FUNCTION
-}
-
-inline void GuardedBuiltinBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
-{
-#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
-    WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
-#undef VISIT_FUNCTION
-}
-
-
 } // namespace WebCore
 
 #endif // ENABLE(STREAMS_API)
 } // namespace WebCore
 
 #endif // ENABLE(STREAMS_API)
index adc7b46..e269b59 100644 (file)
@@ -117,38 +117,6 @@ inline void UnguardedBuiltinBuiltinsWrapper::exportNames()
 #undef EXPORT_FUNCTION_NAME
 }
 
 #undef EXPORT_FUNCTION_NAME
 }
 
-class UnguardedBuiltinBuiltinFunctions {
-public:
-    explicit UnguardedBuiltinBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
-
-    void init(JSC::JSGlobalObject&);
-    void visit(JSC::SlotVisitor&);
-
-public:
-    JSC::VM& m_vm;
-
-#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
-    JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
-    WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
-#undef DECLARE_BUILTIN_SOURCE_MEMBERS
-};
-
-inline void UnguardedBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
-{
-#define EXPORT_FUNCTION(codeName, functionName, length)\
-    m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
-    WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION)
-#undef EXPORT_FUNCTION
-}
-
-inline void UnguardedBuiltinBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
-{
-#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
-    WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
-#undef VISIT_FUNCTION
-}
-
-
 } // namespace WebCore
 
 #endif // UnguardedBuiltinBuiltins_h
 } // namespace WebCore
 
 #endif // UnguardedBuiltinBuiltins_h
index ed539ab..812fed4 100644 (file)
@@ -1,3 +1,16 @@
+2015-11-08  Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        generate-js-builtins.js should support @internal annotation
+        https://bugs.webkit.org/show_bug.cgi?id=150929
+
+        Reviewed by Darin Adler.
+
+        No change in behavior.
+
+        * Modules/streams/ReadableStreamInternals.js: Renamed @internals to @internal.
+        * Modules/streams/StreamInternals.js: Ditto.
+        * Modules/streams/WritableStreamInternals.js: Ditto.
+
 2015-11-07  Simon Fraser  <simon.fraser@apple.com>
 
         Remove ColorSpace argument to all the drawing calls
 2015-11-07  Simon Fraser  <simon.fraser@apple.com>
 
         Remove ColorSpace argument to all the drawing calls
index 000c0a6..c4341ed 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 // @conditional=ENABLE(STREAMS_API)
  */
 
 // @conditional=ENABLE(STREAMS_API)
-// @internals
+// @internal
 
 function privateInitializeReadableStreamReader(stream)
 {
 
 function privateInitializeReadableStreamReader(stream)
 {
index 09797bb..630408f 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 // @conditional=ENABLE(STREAMS_API)
  */
 
 // @conditional=ENABLE(STREAMS_API)
-// @internals
+// @internal
 
 function invokeOrNoop(object, key, args)
 {
 
 function invokeOrNoop(object, key, args)
 {
index 3cdf92b..5fe3732 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 // @conditional=ENABLE(STREAMS_API)
  */
 
 // @conditional=ENABLE(STREAMS_API)
-// @internals
+// @internal
 
 function isWritableStream(stream)
 {
 
 function isWritableStream(stream)
 {