generate-js-builtins.js should support @internal annotation
[WebKit-https.git] / Source / JavaScriptCore / Scripts / tests / builtins / expected / WebCore-GuardedBuiltin-Separate.js-result
1 ### Begin File: GuardedBuiltinBuiltins.h
2 /*
3  * Copyright (c) 2015 Canon Inc. All rights reserved.
4  * 
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 
14  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24  * THE POSSIBILITY OF SUCH DAMAGE.
25  * 
26  */
27
28 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
29 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
30
31 #ifndef GuardedBuiltinBuiltins_h
32 #define GuardedBuiltinBuiltins_h
33
34 #if ENABLE(STREAMS_API)
35
36 #include <builtins/BuiltinUtils.h>
37 #include <bytecode/UnlinkedFunctionExecutable.h>
38 #include <runtime/Identifier.h>
39 #include <runtime/JSFunction.h>
40
41 namespace JSC {
42 class FunctionExecutable;
43 }
44
45 namespace WebCore {
46
47 /* GuardedBuiltin */
48 extern const char* s_guardedBuiltinIsReadableStreamLockedCode;
49 extern const int s_guardedBuiltinIsReadableStreamLockedCodeLength;
50 extern const JSC::ConstructAbility s_guardedBuiltinIsReadableStreamLockedCodeConstructAbility;
51
52 #define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_DATA(macro) \
53     macro(isReadableStreamLocked, guardedBuiltinIsReadableStreamLocked, 1) \
54
55 #define WEBCORE_BUILTIN_GUARDEDBUILTIN_ISREADABLESTREAMLOCKED 1
56
57 #define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(macro) \
58     macro(guardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_guardedBuiltinIsReadableStreamLockedCodeLength) \
59
60 #define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
61     macro(isReadableStreamLocked) \
62
63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
64     JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
65
66 WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
67 #undef DECLARE_BUILTIN_GENERATOR
68
69 #define WEBCORE_BUILTIN_GUARDEDBUILTIN_EXISTS(object, func) defined WEBCORE_BUILTIN_ ## object ## _ ## func
70
71 class GuardedBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner {
72 public:
73     explicit GuardedBuiltinBuiltinsWrapper(JSC::VM* vm)
74         : m_vm(*vm)
75         WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
76 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length)))
77         WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
78 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
79     {
80     }
81
82 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
83     JSC::UnlinkedFunctionExecutable* name##Executable(); \
84     const JSC::SourceCode& name##Source() const { return m_##name##Source; }
85     WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
86 #undef EXPOSE_BUILTIN_EXECUTABLES
87
88     WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
89
90     void exportNames();
91
92 private:
93     JSC::VM& m_vm;
94
95     WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
96
97 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
98     JSC::SourceCode m_##name##Source;\
99     JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
100     WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
101 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
102
103 };
104
105 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
106 inline JSC::UnlinkedFunctionExecutable* GuardedBuiltinBuiltinsWrapper::name##Executable() \
107 {\
108     if (!m_##name##Executable)\
109         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
110     return m_##name##Executable.get();\
111 }
112 WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
113 #undef DEFINE_BUILTIN_EXECUTABLES
114
115 inline void GuardedBuiltinBuiltinsWrapper::exportNames()
116 {
117 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
118     WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
119 #undef EXPORT_FUNCTION_NAME
120 }
121
122 } // namespace WebCore
123
124 #endif // ENABLE(STREAMS_API)
125
126 #endif // GuardedBuiltinBuiltins_h
127
128 ### End File: GuardedBuiltinBuiltins.h
129
130 ### Begin File: GuardedBuiltinBuiltins.cpp
131 /*
132  * Copyright (c) 2015 Canon Inc. All rights reserved.
133  * 
134  * Redistribution and use in source and binary forms, with or without
135  * modification, are permitted provided that the following conditions
136  * are met:
137  * 1. Redistributions of source code must retain the above copyright
138  *    notice, this list of conditions and the following disclaimer.
139  * 2. Redistributions in binary form must reproduce the above copyright
140  *    notice, this list of conditions and the following disclaimer in the
141  *    documentation and/or other materials provided with the distribution.
142  * 
143  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
144  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
145  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
146  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
147  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
148  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
149  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
150  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
151  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
152  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
153  * THE POSSIBILITY OF SUCH DAMAGE.
154  * 
155  */
156
157 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
158 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
159
160 #include "config.h"
161 #include "GuardedBuiltinBuiltins.h"
162
163 #if ENABLE(STREAMS_API)
164
165 #include "WebCoreJSClientData.h"
166 #include <runtime/Executable.h>
167 #include <runtime/JSCJSValueInlines.h>
168 #include <runtime/JSCellInlines.h>
169 #include <runtime/StructureInlines.h>
170 #include <runtime/VM.h>
171
172 namespace WebCore {
173
174 const JSC::ConstructAbility s_guardedBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
175 const int s_guardedBuiltinIsReadableStreamLockedCodeLength = 71;
176 const char* s_guardedBuiltinIsReadableStreamLockedCode =
177     "(function (stream)\n" \
178     "{\n" \
179     "   \"use strict\";\n" \
180     "\n" \
181     "    return !!stream.@reader;\n" \
182     "})\n" \
183 ;
184
185
186 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
187 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
188 {\
189     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
190     return clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Source()); \
191 }
192 WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
193 #undef DEFINE_BUILTIN_GENERATOR
194
195
196 } // namespace WebCore
197
198 #endif // ENABLE(STREAMS_API)
199
200 ### End File: GuardedBuiltinBuiltins.cpp