44fa4c0ed662bd9001b6c0317999a68f7bc8e99d
[WebKit-https.git] / Source / JavaScriptCore / Scripts / tests / builtins / expected / WebCore-UnguardedBuiltin-Separate.js-result
1 ### Begin File: UnguardedBuiltinBuiltins.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 #include <builtins/BuiltinUtils.h>
35 #include <bytecode/UnlinkedFunctionExecutable.h>
36 #include <runtime/Identifier.h>
37 #include <runtime/JSFunction.h>
38
39 namespace JSC {
40 class FunctionExecutable;
41 }
42
43 namespace WebCore {
44
45 /* UnguardedBuiltin */
46 extern const char* s_unguardedBuiltinIsReadableStreamLockedCode;
47 extern const int s_unguardedBuiltinIsReadableStreamLockedCodeLength;
48 extern const JSC::ConstructAbility s_unguardedBuiltinIsReadableStreamLockedCodeConstructAbility;
49
50 #define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_DATA(macro) \
51     macro(isReadableStreamLocked, unguardedBuiltinIsReadableStreamLocked, 1) \
52
53 #define WEBCORE_BUILTIN_UNGUARDEDBUILTIN_ISREADABLESTREAMLOCKED 1
54
55 #define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(macro) \
56     macro(unguardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_unguardedBuiltinIsReadableStreamLockedCodeLength) \
57
58 #define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
59     macro(isReadableStreamLocked) \
60
61 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
62     JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
63
64 WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
65 #undef DECLARE_BUILTIN_GENERATOR
66
67 class UnguardedBuiltinBuiltinsWrapper : private JSC::WeakHandleOwner {
68 public:
69     explicit UnguardedBuiltinBuiltinsWrapper(JSC::VM* vm)
70         : m_vm(*vm)
71         WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
72 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
73         WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
74 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
75     {
76     }
77
78 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
79     JSC::UnlinkedFunctionExecutable* name##Executable(); \
80     const JSC::SourceCode& name##Source() const { return m_##name##Source; }
81     WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
82 #undef EXPOSE_BUILTIN_EXECUTABLES
83
84     WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
85
86     void exportNames();
87
88 private:
89     JSC::VM& m_vm;
90
91     WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
92
93 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \
94     JSC::SourceCode m_##name##Source;\
95     JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
96     WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
97 #undef DECLARE_BUILTIN_SOURCE_MEMBERS
98
99 };
100
101 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
102 inline JSC::UnlinkedFunctionExecutable* UnguardedBuiltinBuiltinsWrapper::name##Executable() \
103 {\
104     if (!m_##name##Executable) {\
105         JSC::Identifier executableName = functionName##PublicName();\
106         if (overriddenName)\
107             executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\
108         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\
109     }\
110     return m_##name##Executable.get();\
111 }
112 WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
113 #undef DEFINE_BUILTIN_EXECUTABLES
114
115 inline void UnguardedBuiltinBuiltinsWrapper::exportNames()
116 {
117 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
118     WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
119 #undef EXPORT_FUNCTION_NAME
120 }
121
122 } // namespace WebCore
123 ### End File: UnguardedBuiltinBuiltins.h
124
125 ### Begin File: UnguardedBuiltinBuiltins.cpp
126 /*
127  * Copyright (c) 2015 Canon Inc. All rights reserved.
128  * Copyright (c) 2016 Apple Inc. All rights reserved.
129  * 
130  * Redistribution and use in source and binary forms, with or without
131  * modification, are permitted provided that the following conditions
132  * are met:
133  * 1. Redistributions of source code must retain the above copyright
134  *    notice, this list of conditions and the following disclaimer.
135  * 2. Redistributions in binary form must reproduce the above copyright
136  *    notice, this list of conditions and the following disclaimer in the
137  *    documentation and/or other materials provided with the distribution.
138  * 
139  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
140  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
141  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
142  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
143  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
144  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
145  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
146  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
147  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
148  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
149  * THE POSSIBILITY OF SUCH DAMAGE.
150  * 
151  */
152
153 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
154 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
155
156 #include "config.h"
157 #include "UnguardedBuiltinBuiltins.h"
158
159 #include "WebCoreJSClientData.h"
160 #include <heap/HeapInlines.h>
161 #include <runtime/IdentifierInlines.h>
162 #include <runtime/Intrinsic.h>
163 #include <runtime/JSCJSValueInlines.h>
164 #include <runtime/JSCellInlines.h>
165 #include <runtime/StructureInlines.h>
166 #include <runtime/VM.h>
167
168 namespace WebCore {
169
170 const JSC::ConstructAbility s_unguardedBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
171 const int s_unguardedBuiltinIsReadableStreamLockedCodeLength = 70;
172 static const JSC::Intrinsic s_unguardedBuiltinIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic;
173 const char* s_unguardedBuiltinIsReadableStreamLockedCode =
174     "(function (stream)\n" \
175     "{\n" \
176     "   \"use strict\";\n" \
177     "    return !!stream.@reader;\n" \
178     "})\n" \
179 ;
180
181
182 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
183 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
184 {\
185     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
186     return clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \
187 }
188 WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
189 #undef DEFINE_BUILTIN_GENERATOR
190
191
192 } // namespace WebCore
193 ### End File: UnguardedBuiltinBuiltins.cpp