ac10a11a5004ce36d84f6b3dba2f3b44266e3385
[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, s_unguardedBuiltinIsReadableStreamLockedCodeLength) \
57
58 #define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
59     macro(isReadableStreamLocked) \
60
61 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, 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, 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, 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, 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, length) \
102 inline JSC::UnlinkedFunctionExecutable* UnguardedBuiltinBuiltinsWrapper::name##Executable() \
103 {\
104     if (!m_##name##Executable)\
105         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
106     return m_##name##Executable.get();\
107 }
108 WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
109 #undef DEFINE_BUILTIN_EXECUTABLES
110
111 inline void UnguardedBuiltinBuiltinsWrapper::exportNames()
112 {
113 #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
114     WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
115 #undef EXPORT_FUNCTION_NAME
116 }
117
118 } // namespace WebCore
119 ### End File: UnguardedBuiltinBuiltins.h
120
121 ### Begin File: UnguardedBuiltinBuiltins.cpp
122 /*
123  * Copyright (c) 2015 Canon Inc. All rights reserved.
124  * Copyright (c) 2016 Apple Inc. All rights reserved.
125  * 
126  * Redistribution and use in source and binary forms, with or without
127  * modification, are permitted provided that the following conditions
128  * are met:
129  * 1. Redistributions of source code must retain the above copyright
130  *    notice, this list of conditions and the following disclaimer.
131  * 2. Redistributions in binary form must reproduce the above copyright
132  *    notice, this list of conditions and the following disclaimer in the
133  *    documentation and/or other materials provided with the distribution.
134  * 
135  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
136  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
137  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
138  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
139  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
140  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
141  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
142  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
143  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
144  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
145  * THE POSSIBILITY OF SUCH DAMAGE.
146  * 
147  */
148
149 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
150 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
151
152 #include "config.h"
153 #include "UnguardedBuiltinBuiltins.h"
154
155 #include "WebCoreJSClientData.h"
156 #include <heap/HeapInlines.h>
157 #include <runtime/Intrinsic.h>
158 #include <runtime/JSCJSValueInlines.h>
159 #include <runtime/JSCellInlines.h>
160 #include <runtime/StructureInlines.h>
161 #include <runtime/VM.h>
162
163 namespace WebCore {
164
165 const JSC::ConstructAbility s_unguardedBuiltinIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
166 const int s_unguardedBuiltinIsReadableStreamLockedCodeLength = 70;
167 static const JSC::Intrinsic s_unguardedBuiltinIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic;
168 const char* s_unguardedBuiltinIsReadableStreamLockedCode =
169     "(function (stream)\n" \
170     "{\n" \
171     "   \"use strict\";\n" \
172     "    return !!stream.@reader;\n" \
173     "})\n" \
174 ;
175
176
177 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
178 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
179 {\
180     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
181     return clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Source(), Nullopt, s_##codeName##Intrinsic); \
182 }
183 WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
184 #undef DEFINE_BUILTIN_GENERATOR
185
186
187 } // namespace WebCore
188 ### End File: UnguardedBuiltinBuiltins.cpp