Unreviewed, update the builtin test results
[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 <JavaScriptCore/BuiltinUtils.h>
37 #include <JavaScriptCore/Identifier.h>
38 #include <JavaScriptCore/JSFunction.h>
39 #include <JavaScriptCore/UnlinkedFunctionExecutable.h>
40
41 namespace JSC {
42 class FunctionExecutable;
43 }
44
45 namespace WebCore {
46
47 /* GuardedInternalBuiltin */
48 extern const char* const 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, static_cast<const char*>(nullptr), s_guardedInternalBuiltinIsReadableStreamLockedCodeLength) \
59
60 #define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
61     macro(isReadableStreamLocked) \
62
63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, 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, overriddenName, 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, overriddenName, 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, overriddenName, 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, overriddenName, length) \
104 inline JSC::UnlinkedFunctionExecutable* GuardedInternalBuiltinBuiltinsWrapper::name##Executable() \
105 {\
106     if (!m_##name##Executable) {\
107         JSC::Identifier executableName = functionName##PublicName();\
108         if (overriddenName)\
109             executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\
110         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\
111     }\
112     return m_##name##Executable.get();\
113 }
114 WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
115 #undef DEFINE_BUILTIN_EXECUTABLES
116
117 inline void GuardedInternalBuiltinBuiltinsWrapper::exportNames()
118 {
119 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
120     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
121 #undef EXPORT_FUNCTION_NAME
122 }
123
124 class GuardedInternalBuiltinBuiltinFunctions {
125 public:
126     explicit GuardedInternalBuiltinBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
127
128     void init(JSC::JSGlobalObject&);
129     void visit(JSC::SlotVisitor&);
130
131 public:
132     JSC::VM& m_vm;
133
134 #define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
135     JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
136     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
137 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
138 };
139
140 inline void GuardedInternalBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
141 {
142 #define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\
143     m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject));
144     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION)
145 #undef EXPORT_FUNCTION
146 }
147
148 inline void GuardedInternalBuiltinBuiltinFunctions::visit(JSC::SlotVisitor& visitor)
149 {
150 #define VISIT_FUNCTION(name) visitor.append(m_##name##Function);
151     WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
152 #undef VISIT_FUNCTION
153 }
154
155
156 } // namespace WebCore
157
158 #endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API)
159 ### End File: GuardedInternalBuiltinBuiltins.h
160
161 ### Begin File: GuardedInternalBuiltinBuiltins.cpp
162 /*
163  * Copyright (c) 2015 Canon Inc. All rights reserved.
164  * Copyright (c) 2016 Apple Inc. All rights reserved.
165  * 
166  * Redistribution and use in source and binary forms, with or without
167  * modification, are permitted provided that the following conditions
168  * are met:
169  * 1. Redistributions of source code must retain the above copyright
170  *    notice, this list of conditions and the following disclaimer.
171  * 2. Redistributions in binary form must reproduce the above copyright
172  *    notice, this list of conditions and the following disclaimer in the
173  *    documentation and/or other materials provided with the distribution.
174  * 
175  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
176  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
177  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
178  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
179  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
180  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
181  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
182  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
183  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
184  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
185  * THE POSSIBILITY OF SUCH DAMAGE.
186  * 
187  */
188
189 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
190 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
191
192 #include "config.h"
193 #include "GuardedInternalBuiltinBuiltins.h"
194
195 #if ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API)
196
197 #include "WebCoreJSClientData.h"
198 #include <JavaScriptCore/HeapInlines.h>
199 #include <JavaScriptCore/IdentifierInlines.h>
200 #include <JavaScriptCore/Intrinsic.h>
201 #include <JavaScriptCore/JSCJSValueInlines.h>
202 #include <JavaScriptCore/JSCellInlines.h>
203 #include <JavaScriptCore/StructureInlines.h>
204 #include <JavaScriptCore/VM.h>
205
206 namespace WebCore {
207
208 const JSC::ConstructAbility s_guardedInternalBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
209 const int s_guardedInternalBuiltinIsReadableStreamLockedCodeLength = 71;
210 static const JSC::Intrinsic s_guardedInternalBuiltinIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic;
211 const char* const s_guardedInternalBuiltinIsReadableStreamLockedCode =
212     "(function (stream)\n" \
213     "{\n" \
214     "   \"use strict\";\n" \
215     "\n" \
216     "    return !!stream.@reader;\n" \
217     "})\n" \
218 ;
219
220
221 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
222 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
223 {\
224     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
225     return clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
226 }
227 WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
228 #undef DEFINE_BUILTIN_GENERATOR
229
230
231 } // namespace WebCore
232
233 #endif // ENABLE(READABLE_STREAM_API) || ENABLE(WRITABLE_STREAM_API)
234
235 ### End File: GuardedInternalBuiltinBuiltins.cpp