3e2acdefe995473a2a817736d792612ac436fda0
[WebKit-https.git] / Source / JavaScriptCore / Scripts / tests / builtins / expected / WebCore-AnotherGuardedInternalBuiltin-Separate.js-result
1 ### Begin File: AnotherGuardedInternalBuiltinBuiltins.h
2 /*
3  * Copyright (c) 2016 Apple 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 #pragma once
32
33 #if ENABLE(FETCH_API)
34
35 #include <JavaScriptCore/BuiltinUtils.h>
36 #include <JavaScriptCore/Identifier.h>
37 #include <JavaScriptCore/JSFunction.h>
38 #include <JavaScriptCore/UnlinkedFunctionExecutable.h>
39
40 namespace JSC {
41 class FunctionExecutable;
42 }
43
44 namespace WebCore {
45
46 /* AnotherGuardedInternalBuiltin */
47 extern const char* s_anotherGuardedInternalBuiltinLetsFetchCode;
48 extern const int s_anotherGuardedInternalBuiltinLetsFetchCodeLength;
49 extern const JSC::ConstructAbility s_anotherGuardedInternalBuiltinLetsFetchCodeConstructAbility;
50
51 #define WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_DATA(macro) \
52     macro(letsFetch, anotherGuardedInternalBuiltinLetsFetch, 0) \
53
54 #define WEBCORE_BUILTIN_ANOTHERGUARDEDINTERNALBUILTIN_LETSFETCH 1
55
56 #define WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(macro) \
57     macro(anotherGuardedInternalBuiltinLetsFetchCode, letsFetch, static_cast<const char*>(nullptr), s_anotherGuardedInternalBuiltinLetsFetchCodeLength) \
58
59 #define WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
60     macro(letsFetch) \
61
62 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
63     JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
64
65 WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
66 #undef DECLARE_BUILTIN_GENERATOR
67
68 class AnotherGuardedInternalBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner {
69 public:
70     explicit AnotherGuardedInternalBuiltinBuiltinsWrapper(JSC::VM* vm)
71         : m_vm(*vm)
72         WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
73 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
74         WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
75 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
76     {
77     }
78
79 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
80     JSC::UnlinkedFunctionExecutable* name##Executable(); \
81     const JSC::SourceCode& name##Source() const { return m_##name##Source; }
82     WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
83 #undef EXPOSE_BUILTIN_EXECUTABLES
84
85     WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
86
87     void exportNames();
88
89 private:
90     JSC::VM& m_vm;
91
92     WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
93
94 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \
95     JSC::SourceCode m_##name##Source;\
96     JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
97     WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
98 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
99
100 };
101
102 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
103 inline JSC::UnlinkedFunctionExecutable* AnotherGuardedInternalBuiltinBuiltinsWrapper::name##Executable() \
104 {\
105     if (!m_##name##Executable) {\
106         JSC::Identifier executableName = functionName##PublicName();\
107         if (overriddenName)\
108             executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\
109         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\
110     }\
111     return m_##name##Executable.get();\
112 }
113 WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
114 #undef DEFINE_BUILTIN_EXECUTABLES
115
116 inline void AnotherGuardedInternalBuiltinBuiltinsWrapper::exportNames()
117 {
118 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
119     WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
120 #undef EXPORT_FUNCTION_NAME
121 }
122
123 class AnotherGuardedInternalBuiltinBuiltinFunctions {
124 public:
125     explicit AnotherGuardedInternalBuiltinBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
126
127     void init(JSC::JSGlobalObject&);
128     void visit(JSC::SlotVisitor&);
129
130 public:
131     JSC::VM& m_vm;
132
133 #define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
134     JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
135     WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
136 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
137 };
138
139 inline void AnotherGuardedInternalBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
140 {
141 #define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\
142     m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject));
143     WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION)
144 #undef EXPORT_FUNCTION
145 }
146
147 inline void AnotherGuardedInternalBuiltinBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
148 {
149 #define VISIT_FUNCTION(name) visitor.append(m_##name##Function);
150     WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
151 #undef VISIT_FUNCTION
152 }
153
154
155 } // namespace WebCore
156
157 #endif // ENABLE(FETCH_API)
158 ### End File: AnotherGuardedInternalBuiltinBuiltins.h
159
160 ### Begin File: AnotherGuardedInternalBuiltinBuiltins.cpp
161 /*
162  * Copyright (c) 2016 Apple Inc. All rights reserved.
163  * 
164  * Redistribution and use in source and binary forms, with or without
165  * modification, are permitted provided that the following conditions
166  * are met:
167  * 1. Redistributions of source code must retain the above copyright
168  *    notice, this list of conditions and the following disclaimer.
169  * 2. Redistributions in binary form must reproduce the above copyright
170  *    notice, this list of conditions and the following disclaimer in the
171  *    documentation and/or other materials provided with the distribution.
172  * 
173  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
174  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
175  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
176  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
177  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
178  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
179  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
180  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
181  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
182  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
183  * THE POSSIBILITY OF SUCH DAMAGE.
184  * 
185  */
186
187 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
188 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
189
190 #include "config.h"
191 #include "AnotherGuardedInternalBuiltinBuiltins.h"
192
193 #if ENABLE(FETCH_API)
194
195 #include "WebCoreJSClientData.h"
196 #include <JavaScriptCore/HeapInlines.h>
197 #include <JavaScriptCore/IdentifierInlines.h>
198 #include <JavaScriptCore/Intrinsic.h>
199 #include <JavaScriptCore/JSCJSValueInlines.h>
200 #include <JavaScriptCore/JSCellInlines.h>
201 #include <JavaScriptCore/StructureInlines.h>
202 #include <JavaScriptCore/VM.h>
203
204 namespace WebCore {
205
206 const JSC::ConstructAbility s_anotherGuardedInternalBuiltinLetsFetchCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
207 const int s_anotherGuardedInternalBuiltinLetsFetchCodeLength = 83;
208 static const JSC::Intrinsic s_anotherGuardedInternalBuiltinLetsFetchCodeIntrinsic = JSC::NoIntrinsic;
209 const char* s_anotherGuardedInternalBuiltinLetsFetchCode =
210     "(function ()\n" \
211     "{\n" \
212     "   \"use strict\";\n" \
213     "\n" \
214     "    return @fetchRequest(new @Request(\"yes\"));\n" \
215     "})\n" \
216 ;
217
218
219 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
220 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
221 {\
222     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
223     return clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
224 }
225 WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
226 #undef DEFINE_BUILTIN_GENERATOR
227
228
229 } // namespace WebCore
230
231 #endif // ENABLE(FETCH_API)
232
233 ### End File: AnotherGuardedInternalBuiltinBuiltins.cpp