eadd07a215daf48434ecd1dc0b7eac375c39ae13
[WebKit-https.git] / Source / JavaScriptCore / Scripts / tests / builtins / expected / WebCore-ArbitraryConditionalGuard-Separate.js-result
1 ### Begin File: ArbitraryConditionalGuardBuiltins.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) || USE(CF)
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 /* ArbitraryConditionalGuard */
48 extern const char* s_arbitraryConditionalGuardIsReadableStreamLockedCode;
49 extern const int s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength;
50 extern const JSC::ConstructAbility s_arbitraryConditionalGuardIsReadableStreamLockedCodeConstructAbility;
51
52 #define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_DATA(macro) \
53     macro(isReadableStreamLocked, arbitraryConditionalGuardIsReadableStreamLocked, 1) \
54
55 #define WEBCORE_BUILTIN_ARBITRARYCONDITIONALGUARD_ISREADABLESTREAMLOCKED 1
56
57 #define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(macro) \
58     macro(arbitraryConditionalGuardIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength) \
59
60 #define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_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_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
67 #undef DECLARE_BUILTIN_GENERATOR
68
69 class ArbitraryConditionalGuardBuiltinsWrapper : private JSC::WeakHandleOwner {
70 public:
71     explicit ArbitraryConditionalGuardBuiltinsWrapper(JSC::VM* vm)
72         : m_vm(*vm)
73         WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_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_ARBITRARYCONDITIONALGUARD_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_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
84 #undef EXPOSE_BUILTIN_EXECUTABLES
85
86     WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
87
88     void exportNames();
89
90 private:
91     JSC::VM& m_vm;
92
93     WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_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_ARBITRARYCONDITIONALGUARD_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* ArbitraryConditionalGuardBuiltinsWrapper::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_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
115 #undef DEFINE_BUILTIN_EXECUTABLES
116
117 inline void ArbitraryConditionalGuardBuiltinsWrapper::exportNames()
118 {
119 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
120     WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
121 #undef EXPORT_FUNCTION_NAME
122 }
123
124 } // namespace WebCore
125
126 #endif // ENABLE(STREAMS_API) || USE(CF)
127 ### End File: ArbitraryConditionalGuardBuiltins.h
128
129 ### Begin File: ArbitraryConditionalGuardBuiltins.cpp
130 /*
131  * Copyright (c) 2015 Canon Inc. All rights reserved.
132  * Copyright (c) 2016 Apple 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 "ArbitraryConditionalGuardBuiltins.h"
162
163 #if ENABLE(STREAMS_API) || USE(CF)
164
165 #include "WebCoreJSClientData.h"
166 #include <heap/HeapInlines.h>
167 #include <runtime/IdentifierInlines.h>
168 #include <runtime/Intrinsic.h>
169 #include <runtime/JSCJSValueInlines.h>
170 #include <runtime/JSCellInlines.h>
171 #include <runtime/StructureInlines.h>
172 #include <runtime/VM.h>
173
174 namespace WebCore {
175
176 const JSC::ConstructAbility s_arbitraryConditionalGuardIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
177 const int s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength = 70;
178 static const JSC::Intrinsic s_arbitraryConditionalGuardIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic;
179 const char* s_arbitraryConditionalGuardIsReadableStreamLockedCode =
180     "(function (stream)\n" \
181     "{\n" \
182     "   \"use strict\";\n" \
183     "    return !!stream.@reader;\n" \
184     "})\n" \
185 ;
186
187
188 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
189 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
190 {\
191     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
192     return clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \
193 }
194 WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
195 #undef DEFINE_BUILTIN_GENERATOR
196
197
198 } // namespace WebCore
199
200 #endif // ENABLE(STREAMS_API) || USE(CF)
201
202 ### End File: ArbitraryConditionalGuardBuiltins.cpp