Builtins generator should emit ENABLE(FEATURE) guards based on @conditional annotation
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Oct 2015 20:00:36 +0000 (20:00 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Oct 2015 20:00:36 +0000 (20:00 +0000)
commitb6c9afd36d532e1926b5715467a9102fa38f2b60
tree21a6bea100bfdf9f739a7f404c3d3236227d364a
parent0bb6bf0fdab5dbefa5cc61f95ad5ab99b5ae57a9
Builtins generator should emit ENABLE(FEATURE) guards based on @conditional annotation
https://bugs.webkit.org/show_bug.cgi?id=150536

Reviewed by Yusuke Suzuki.

Source/JavaScriptCore:

Scan JS builtin files for @key=value and @flag annotations in single-line comments.
For @conditional=CONDITIONAL, emit CONDITIONAL guards around the relevant object's code.

Generate primary header includes separately from secondary header includes so we can
put the guard between the two header groups, as is customary in WebKit C++ code.

New tests:

Scripts/tests/builtins/WebCore-ArbitraryConditionalGuard-Separate.js
Scripts/tests/builtins/WebCore-DuplicateFlagAnnotation-Separate.js
Scripts/tests/builtins/WebCore-DuplicateKeyValueAnnotation-Separate.js

* Scripts/builtins/builtins_generate_combined_implementation.py:
(BuiltinsCombinedImplementationGenerator.generate_output):
(BuiltinsCombinedImplementationGenerator.generate_secondary_header_includes):
(BuiltinsCombinedImplementationGenerator.generate_header_includes): Deleted.
* Scripts/builtins/builtins_generate_separate_header.py:
(BuiltinsSeparateHeaderGenerator.generate_output):
(generate_secondary_header_includes):
(generate_header_includes): Deleted.
* Scripts/builtins/builtins_generate_separate_implementation.py:
(BuiltinsSeparateImplementationGenerator.generate_output):
(BuiltinsSeparateImplementationGenerator.generate_secondary_header_includes):
(BuiltinsSeparateImplementationGenerator.generate_header_includes): Deleted.
* Scripts/builtins/builtins_generate_separate_wrapper.py:
(BuiltinsSeparateWrapperGenerator.generate_output):
(BuiltinsSeparateWrapperGenerator.generate_secondary_header_includes):
(BuiltinsSeparateWrapperGenerator.generate_header_includes): Deleted.
* Scripts/builtins/builtins_generator.py:
(BuiltinsGenerator.generate_includes_from_entries):
(BuiltinsGenerator):
(BuiltinsGenerator.generate_primary_header_includes):
* Scripts/builtins/builtins_model.py:
(BuiltinObject.__init__):
(BuiltinsCollection.parse_builtins_file):
(BuiltinsCollection._parse_annotations):
* Scripts/tests/builtins/WebCore-ArbitraryConditionalGuard-Separate.js: Added.
* Scripts/tests/builtins/WebCore-DuplicateFlagAnnotation-Separate.js: Added.
* Scripts/tests/builtins/WebCore-DuplicateKeyValueAnnotation-Separate.js: Added.
* Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js: Simplify.
* Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js: Simplify.
* Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js: Simplify.
* Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result: Added.
* Scripts/tests/builtins/expected/WebCore-DuplicateFlagAnnotation-Separate.js-error: Added.
* Scripts/tests/builtins/expected/WebCore-DuplicateKeyValueAnnotation-Separate.js-error: Added.
* Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result:
* Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result:
* Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result:
* Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result:

Source/WebCore:

Replace @optional=FEATURE with @conditional=ENABLE(FEATURE) in builtins files.

* Modules/streams/ByteLengthQueuingStrategy.js:
* Modules/streams/CountQueuingStrategy.js:
* Modules/streams/ReadableStream.js:
* Modules/streams/ReadableStreamController.js:
* Modules/streams/ReadableStreamInternals.js:
* Modules/streams/ReadableStreamReader.js:
* Modules/streams/StreamInternals.js:
* Modules/streams/WritableStream.js:
* Modules/streams/WritableStreamInternals.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_implementation.py
Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py
Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_implementation.py
Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_wrapper.py
Source/JavaScriptCore/Scripts/builtins/builtins_generator.py
Source/JavaScriptCore/Scripts/builtins/builtins_model.py
Source/JavaScriptCore/Scripts/tests/builtins/WebCore-ArbitraryConditionalGuard-Separate.js [new file with mode: 0644]
Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateFlagAnnotation-Separate.js [new file with mode: 0644]
Source/JavaScriptCore/Scripts/tests/builtins/WebCore-DuplicateKeyValueAnnotation-Separate.js [new file with mode: 0644]
Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedBuiltin-Separate.js
Source/JavaScriptCore/Scripts/tests/builtins/WebCore-GuardedInternalBuiltin-Separate.js
Source/JavaScriptCore/Scripts/tests/builtins/WebCore-UnguardedBuiltin-Separate.js
Source/JavaScriptCore/Scripts/tests/builtins/WebCore-xmlCasingTest-Separate.js
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result [new file with mode: 0644]
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateFlagAnnotation-Separate.js-error [new file with mode: 0644]
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-DuplicateKeyValueAnnotation-Separate.js-error [new file with mode: 0644]
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result
Source/WebCore/ChangeLog
Source/WebCore/Modules/streams/ByteLengthQueuingStrategy.js
Source/WebCore/Modules/streams/CountQueuingStrategy.js
Source/WebCore/Modules/streams/ReadableStream.js
Source/WebCore/Modules/streams/ReadableStreamController.js
Source/WebCore/Modules/streams/ReadableStreamInternals.js
Source/WebCore/Modules/streams/ReadableStreamReader.js
Source/WebCore/Modules/streams/StreamInternals.js
Source/WebCore/Modules/streams/WritableStream.js
Source/WebCore/Modules/streams/WritableStreamInternals.js