Propagate the source origin as much as possible
[WebKit-https.git] / Source / JavaScriptCore / Scripts / tests / builtins / expected / WebCore-xmlCasingTest-Separate.js-result
1 ### Begin File: xmlCasingTestBuiltins.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(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 /* xmlCasingTest */
48 extern const char* s_xmlCasingTestXMLCasingTestCode;
49 extern const int s_xmlCasingTestXMLCasingTestCodeLength;
50 extern const JSC::ConstructAbility s_xmlCasingTestXMLCasingTestCodeConstructAbility;
51 extern const char* s_xmlCasingTestCssCasingTestCode;
52 extern const int s_xmlCasingTestCssCasingTestCodeLength;
53 extern const JSC::ConstructAbility s_xmlCasingTestCssCasingTestCodeConstructAbility;
54 extern const char* s_xmlCasingTestUrlCasingTestCode;
55 extern const int s_xmlCasingTestUrlCasingTestCodeLength;
56 extern const JSC::ConstructAbility s_xmlCasingTestUrlCasingTestCodeConstructAbility;
57
58 #define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_DATA(macro) \
59     macro(xmlCasingTest, xmlCasingTestXMLCasingTest, 1) \
60     macro(cssCasingTest, xmlCasingTestCssCasingTest, 2) \
61     macro(urlCasingTest, xmlCasingTestUrlCasingTest, 3) \
62
63 #define WEBCORE_BUILTIN_XMLCASINGTEST_XMLCASINGTEST 1
64 #define WEBCORE_BUILTIN_XMLCASINGTEST_CSSCASINGTEST 1
65 #define WEBCORE_BUILTIN_XMLCASINGTEST_URLCASINGTEST 1
66
67 #define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(macro) \
68     macro(xmlCasingTestXMLCasingTestCode, xmlCasingTest, s_xmlCasingTestXMLCasingTestCodeLength) \
69     macro(xmlCasingTestCssCasingTestCode, cssCasingTest, s_xmlCasingTestCssCasingTestCodeLength) \
70     macro(xmlCasingTestUrlCasingTestCode, urlCasingTest, s_xmlCasingTestUrlCasingTestCodeLength) \
71
72 #define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(macro) \
73     macro(cssCasingTest) \
74     macro(urlCasingTest) \
75     macro(xmlCasingTest) \
76
77 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
78     JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
79
80 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
81 #undef DECLARE_BUILTIN_GENERATOR
82
83 class xmlCasingTestBuiltinsWrapper : private JSC::WeakHandleOwner {
84 public:
85     explicit xmlCasingTestBuiltinsWrapper(JSC::VM* vm)
86         : m_vm(*vm)
87         WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
88 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
89         WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
90 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
91     {
92     }
93
94 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
95     JSC::UnlinkedFunctionExecutable* name##Executable(); \
96     const JSC::SourceCode& name##Source() const { return m_##name##Source; }
97     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
98 #undef EXPOSE_BUILTIN_EXECUTABLES
99
100     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
101
102     void exportNames();
103
104 private:
105     JSC::VM& m_vm;
106
107     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
108
109 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
110     JSC::SourceCode m_##name##Source;\
111     JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
112     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
113 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
114
115 };
116
117 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
118 inline JSC::UnlinkedFunctionExecutable* xmlCasingTestBuiltinsWrapper::name##Executable() \
119 {\
120     if (!m_##name##Executable)\
121         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
122     return m_##name##Executable.get();\
123 }
124 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
125 #undef DEFINE_BUILTIN_EXECUTABLES
126
127 inline void xmlCasingTestBuiltinsWrapper::exportNames()
128 {
129 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
130     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
131 #undef EXPORT_FUNCTION_NAME
132 }
133
134 class xmlCasingTestBuiltinFunctions {
135 public:
136     explicit xmlCasingTestBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
137
138     void init(JSC::JSGlobalObject&);
139     void visit(JSC::SlotVisitor&);
140
141 public:
142     JSC::VM& m_vm;
143
144 #define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
145     JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
146     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
147 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
148 };
149
150 inline void xmlCasingTestBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
151 {
152 #define EXPORT_FUNCTION(codeName, functionName, length)\
153     m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
154     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(EXPORT_FUNCTION)
155 #undef EXPORT_FUNCTION
156 }
157
158 inline void xmlCasingTestBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
159 {
160 #define VISIT_FUNCTION(name) visitor.append(m_##name##Function);
161     WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
162 #undef VISIT_FUNCTION
163 }
164
165
166 } // namespace WebCore
167
168 #endif // ENABLE(STREAMS_API)
169 ### End File: xmlCasingTestBuiltins.h
170
171 ### Begin File: xmlCasingTestBuiltins.cpp
172 /*
173  * Copyright (c) 2015 Canon Inc. All rights reserved.
174  * Copyright (c) 2016 Apple Inc. All rights reserved.
175  * 
176  * Redistribution and use in source and binary forms, with or without
177  * modification, are permitted provided that the following conditions
178  * are met:
179  * 1. Redistributions of source code must retain the above copyright
180  *    notice, this list of conditions and the following disclaimer.
181  * 2. Redistributions in binary form must reproduce the above copyright
182  *    notice, this list of conditions and the following disclaimer in the
183  *    documentation and/or other materials provided with the distribution.
184  * 
185  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
186  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
187  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
188  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
189  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
190  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
191  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
192  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
193  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
194  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
195  * THE POSSIBILITY OF SUCH DAMAGE.
196  * 
197  */
198
199 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
200 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
201
202 #include "config.h"
203 #include "xmlCasingTestBuiltins.h"
204
205 #if ENABLE(STREAMS_API)
206
207 #include "WebCoreJSClientData.h"
208 #include <heap/HeapInlines.h>
209 #include <runtime/Intrinsic.h>
210 #include <runtime/JSCJSValueInlines.h>
211 #include <runtime/JSCellInlines.h>
212 #include <runtime/StructureInlines.h>
213 #include <runtime/VM.h>
214
215 namespace WebCore {
216
217 const JSC::ConstructAbility s_xmlCasingTestXMLCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
218 const int s_xmlCasingTestXMLCasingTestCodeLength = 70;
219 static const JSC::Intrinsic s_xmlCasingTestXMLCasingTestCodeIntrinsic = JSC::NoIntrinsic;
220 const char* s_xmlCasingTestXMLCasingTestCode =
221     "(function (stream)\n" \
222     "{\n" \
223     "   \"use strict\";\n" \
224     "    return !!stream.@reader;\n" \
225     "})\n" \
226 ;
227
228 const JSC::ConstructAbility s_xmlCasingTestCssCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
229 const int s_xmlCasingTestCssCasingTestCodeLength = 401;
230 static const JSC::Intrinsic s_xmlCasingTestCssCasingTestCodeIntrinsic = JSC::NoIntrinsic;
231 const char* s_xmlCasingTestCssCasingTestCode =
232     "(function (stream, reason)\n" \
233     "{\n" \
234     "    \"use strict\";\n" \
235     "    if (stream.@state === @readableStreamClosed)\n" \
236     "        return Promise.resolve();\n" \
237     "    if (stream.@state === @readableStreamErrored)\n" \
238     "        return Promise.reject(stream.@storedError);\n" \
239     "    stream.@queue = [];\n" \
240     "    @finishClosingReadableStream(stream);\n" \
241     "    return @promiseInvokeOrNoop(stream.@underlyingSource, \"cancel\", [reason]).then(function() { });\n" \
242     "})\n" \
243 ;
244
245 const JSC::ConstructAbility s_xmlCasingTestUrlCasingTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
246 const int s_xmlCasingTestUrlCasingTestCodeLength = 337;
247 static const JSC::Intrinsic s_xmlCasingTestUrlCasingTestCodeIntrinsic = JSC::NoIntrinsic;
248 const char* s_xmlCasingTestUrlCasingTestCode =
249     "(function (object, key, args)\n" \
250     "{\n" \
251     "    \"use strict\";\n" \
252     "    try {\n" \
253     "        var method = object[key];\n" \
254     "        if (typeof method === \"undefined\")\n" \
255     "            return Promise.resolve();\n" \
256     "        var result = method.@apply(object, args);\n" \
257     "        return Promise.resolve(result);\n" \
258     "    }\n" \
259     "    catch(error) {\n" \
260     "        return Promise.reject(error);\n" \
261     "    }\n" \
262     "})\n" \
263 ;
264
265
266 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
267 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
268 {\
269     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
270     return clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \
271 }
272 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
273 #undef DEFINE_BUILTIN_GENERATOR
274
275
276 } // namespace WebCore
277
278 #endif // ENABLE(STREAMS_API)
279
280 ### End File: xmlCasingTestBuiltins.cpp