Unreviewed, rolling out r221327.
[WebKit-https.git] / Source / JavaScriptCore / Scripts / tests / builtins / expected / WebCore-GuardedInternalBuiltin-Separate.js-result
1 ### Begin File: GuardedInternalBuiltinBuiltins.h
2 /*
3  * Copyright (c) 2015 Canon Inc. All rights reserved.
4  * Copyright (c) 2016 Apple Inc. All rights reserved.
5  * 
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 
15  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
19  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25  * THE POSSIBILITY OF SUCH DAMAGE.
26  * 
27  */
28
29 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
30 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
31
32 #pragma once
33
34 #if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_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 /* GuardedInternalBuiltin */
48 extern const char* s_guardedInternalBuiltinIsReadableStreamLockedCode;
49 extern const int s_guardedInternalBuiltinIsReadableStreamLockedCodeLength;
50 extern const JSC::ConstructAbility s_guardedInternalBuiltinIsReadableStreamLockedCodeConstructAbility;
51
52 #define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_DATA(macro) \
53     macro(isReadableStreamLocked, guardedInternalBuiltinIsReadableStreamLocked, 1) \
54
55 #define WEBCORE_BUILTIN_GUARDEDINTERNALBUILTIN_ISREADABLESTREAMLOCKED 1
56
57 #define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(macro) \
58     macro(guardedInternalBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_guardedInternalBuiltinIsReadableStreamLockedCodeLength) \
59
60 #define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_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_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
67 #undef DECLARE_BUILTIN_GENERATOR
68
69 class GuardedInternalBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner {
70 public:
71     explicit GuardedInternalBuiltinBuiltinsWrapper(JSC::VM* vm)
72         : m_vm(*vm)
73         WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
74 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
75         WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
76 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
77     {
78     }
79
80 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
81     JSC::UnlinkedFunctionExecutable* name##Executable(); \
82     const JSC::SourceCode& name##Source() const { return m_##name##Source; }
83     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
84 #undef EXPOSE_BUILTIN_EXECUTABLES
85
86     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
87
88     void exportNames();
89
90 private:
91     JSC::VM& m_vm;
92
93     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
94
95 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
96     JSC::SourceCode m_##name##Source;\
97     JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
98     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
99 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
100
101 };
102
103 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
104 inline JSC::UnlinkedFunctionExecutable* GuardedInternalBuiltinBuiltinsWrapper::name##Executable() \
105 {\
106     if (!m_##name##Executable)\
107         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
108     return m_##name##Executable.get();\
109 }
110 WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
111 #undef DEFINE_BUILTIN_EXECUTABLES
112
113 inline void GuardedInternalBuiltinBuiltinsWrapper::exportNames()
114 {
115 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
116     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
117 #undef EXPORT_FUNCTION_NAME
118 }
119
120 class GuardedInternalBuiltinBuiltinFunctions {
121 public:
122     explicit GuardedInternalBuiltinBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
123
124     void init(JSC::JSGlobalObject&);
125     void visit(JSC::SlotVisitor&);
126
127 public:
128     JSC::VM& m_vm;
129
130 #define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
131     JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
132     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
133 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
134 };
135
136 inline void GuardedInternalBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
137 {
138 #define EXPORT_FUNCTION(codeName, functionName, length)\
139     m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
140     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION)
141 #undef EXPORT_FUNCTION
142 }
143
144 inline void GuardedInternalBuiltinBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
145 {
146 #define VISIT_FUNCTION(name) visitor.append(m_##name##Function);
147     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
148 #undef VISIT_FUNCTION
149 }
150
151
152 } // namespace WebCore
153
154 #endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API)
155 ### End File: GuardedInternalBuiltinBuiltins.h
156
157 ### Begin File: GuardedInternalBuiltinBuiltins.cpp
158 /*
159  * Copyright (c) 2015 Canon Inc. All rights reserved.
160  * Copyright (c) 2016 Apple Inc. All rights reserved.
161  * 
162  * Redistribution and use in source and binary forms, with or without
163  * modification, are permitted provided that the following conditions
164  * are met:
165  * 1. Redistributions of source code must retain the above copyright
166  *    notice, this list of conditions and the following disclaimer.
167  * 2. Redistributions in binary form must reproduce the above copyright
168  *    notice, this list of conditions and the following disclaimer in the
169  *    documentation and/or other materials provided with the distribution.
170  * 
171  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
172  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
173  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
174  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
175  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
176  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
177  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
178  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
179  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
180  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
181  * THE POSSIBILITY OF SUCH DAMAGE.
182  * 
183  */
184
185 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
186 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
187
188 #include "config.h"
189 #include "GuardedInternalBuiltinBuiltins.h"
190
191 #if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API)
192
193 #include "WebCoreJSClientData.h"
194 #include <heap/HeapInlines.h>
195 #include <runtime/Intrinsic.h>
196 #include <runtime/JSCJSValueInlines.h>
197 #include <runtime/JSCellInlines.h>
198 #include <runtime/StructureInlines.h>
199 #include <runtime/VM.h>
200
201 namespace WebCore {
202
203 const JSC::ConstructAbility s_guardedInternalBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
204 const int s_guardedInternalBuiltinIsReadableStreamLockedCodeLength = 70;
205 static const JSC::Intrinsic s_guardedInternalBuiltinIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic;
206 const char* s_guardedInternalBuiltinIsReadableStreamLockedCode =
207     "(function (stream)\n" \
208     "{\n" \
209     "   \"use strict\";\n" \
210     "    return !!stream.@reader;\n" \
211     "})\n" \
212 ;
213
214
215 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
216 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
217 {\
218     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
219     return clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \
220 }
221 WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
222 #undef DEFINE_BUILTIN_GENERATOR
223
224
225 } // namespace WebCore
226
227 #endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API)
228
229 ### End File: GuardedInternalBuiltinBuiltins.cpp