Debian Codegraph @

src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSCell.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 1999-2001 Harri Porten ([email protected])
3 * Copyright (C) 2001 Peter Kelly ([email protected])
4 * Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23 #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/
24 #include "JSCell.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSCell.h`/
25
26 #include "JSFunction.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSFunction.h`/
27 #include "JSString.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSString.h`/
28 #include "JSObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h`/
29 #include <wtf/MathExtras.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h`/
30
31 namespace JSCcxx . . $ `<built-in>:463:9`! {
32
33 #if defined NANcxx . . $ `<external>/11263917310783833665/math.h:101:12`! && defined INFINITYcxx . . $ `<external>/11263917310783833665/math.h:92:12`!
34
35 extern const double NaNcxx . . $ QTJSC/NaN. = NANcxx . . $ `<external>/11263917310783833665/math.h:101:12`!;
36 extern const double Infcxx . . $ QTJSC/Inf. = INFINITYcxx . . $ `<external>/11263917310783833665/math.h:92:12`!;
37
38 #else // !(defined NAN && defined INFINITY)
39
40 // The trick is to define the NaN and Inf globals with a different type than the declaration.
41 // This trick works because the mangled name of the globals does not include the type, although
42 // I'm not sure that's guaranteed. There could be alignment issues with this, since arrays of
43 // characters don't necessarily need the same alignment doubles do, but for now it seems to work.
44 // It would be good to figure out a 100% clean way that still avoids code that runs at init time.
45
46 // Note, we have to use union to ensure alignment. Otherwise, NaN_Bytes can start anywhere,
47 // while NaN_double has to be 4-byte aligned for 32-bits.
48 // With -fstrict-aliasing enabled, unions are the only safe way to do type masquerading.
49
50 static const union {
51 struct {
52 unsigned char NaN_Bytes[8];
53 unsigned char Inf_Bytes[8];
54 } bytes;
55
56 struct {
57 double NaN_Double;
58 double Inf_Double;
59 } doubles;
60
61 } NaNInf = { {
62 #if CPU(BIG_ENDIAN)
63 { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 },
64 { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
65 #elif CPU(MIDDLE_ENDIAN)
66 { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 },
67 { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
68 #else
69 { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f },
70 { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
71 #endif
72 } } ;
73
74 extern const double NaN = NaNInf.doubles.NaN_Double;
75 extern const double Inf = NaNInf.doubles.Inf_Double;
76
77 #endif // !(defined NAN && defined INFINITY)
78
79 bool JSCellcxx . . $ QTJSC/JSCell#::getUInt32cxx . . $ QTJSC/JSCell#getUInt32(186fade19594183d).(uint32_tcxx . . $ uint32_t#&) const
80 {
81 return false;
82 }
83
84 bool JSCellcxx . . $ QTJSC/JSCell#::getStringcxx . . $ QTJSC/JSCell#getString(4ed3c128543e83ef).(ExecStatecxx . . $ QTJSC/ExecState#* exec, UStringcxx . . $ QTJSC/UString#&stringValue) const
85 {
86 if (!isStringcxx . . $ QTJSC/JSCell#isString(50ce9a9e25b4a850).())
87 return false;
88 stringValue = static_cast<const JSString*>(this)->value(exec);
89 return true;
90 }
91
92 UStringcxx . . $ QTJSC/UString# JSCellcxx . . $ QTJSC/JSCell#::getStringcxx . . $ QTJSC/JSCell#getString(9c94f5abb1995042).(ExecStatecxx . . $ QTJSC/ExecState#* exec) const
93 {
94 return isString() ? static_cast<const JSString*>(this)->value(exec) : UString();
95 }
96
97 JSObjectcxx . . $ QTJSC/JSObject#* JSCellcxx . . $ QTJSC/JSCell#::getObjectcxx . . $ QTJSC/JSCell#getObject(2eaa870b9a6c25e1).()
98 {
99 return isObjectcxx . . $ QTJSC/JSCell#isObject(50ce9a9e25b4a850).() ? asObjectcxx . . $ QTJSC/asObject(57571c3d51f0c406).(this) : 0;
100 }
101
102 const JSObjectcxx . . $ QTJSC/JSObject#* JSCellcxx . . $ QTJSC/JSCell#::getObjectcxx . . $ QTJSC/JSCell#getObject(352b1c9b6b28f20d).() const
103 {
104 return isObject() ? static_cast<const JSObject*>(this) : 0;
105 }
106
107 CallTypecxx . . $ QTJSC/CallType# JSCellcxx . . $ QTJSC/JSCell#::getCallDatacxx . . $ QTJSC/JSCell#getCallData(9482040cf952d29d).(CallDatacxx . . $ QTJSC/CallData#&)
108 {
109 return CallTypeNonecxx . . $ QTJSC/CallTypeNone.;
110 }
111
112 ConstructTypecxx . . $ QTJSC/ConstructType# JSCellcxx . . $ QTJSC/JSCell#::getConstructDatacxx . . $ QTJSC/JSCell#getConstructData(80014d68d6143eea).(ConstructDatacxx . . $ QTJSC/ConstructData#&)
113 {
114 return ConstructTypeNonecxx . . $ QTJSC/ConstructTypeNone.;
115 }
116
117 bool JSCellcxx . . $ QTJSC/JSCell#::getOwnPropertySlotcxx . . $ QTJSC/JSCell#getOwnPropertySlot(6f4ef3dbfe7d5ab9).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& identifier, PropertySlotcxx . . $ QTJSC/PropertySlot#& slot)
118 {
119 // This is not a general purpose implementation of getOwnPropertySlot.
120 // It should only be called by JSValue::get.
121 // It calls getPropertySlot, not getOwnPropertySlot.
122 JSObjectcxx . . $ QTJSC/JSObject#* object = toObjectcxx . . $ QTJSC/JSCell#toObject(8709ed4849a165ab).(exec);
123 slot.setBasecxx . . $ QTJSC/PropertySlot#setBase(5c2ac18db087b3e6).(object);
124 if (!object->getPropertySlotcxx . . $ QTJSC/JSObject#getPropertySlot(6f4ef3dbfe7d5ab9).(exec, identifier, slot))
125 slot.setUndefinedcxx . . $ QTJSC/PropertySlot#setUndefined(49f6e7a06ebc5aa8).();
126 return true;
127 }
128
129 bool JSCellcxx . . $ QTJSC/JSCell#::getOwnPropertySlotcxx . . $ QTJSC/JSCell#getOwnPropertySlot(d57d1c8d4b24d235).(ExecStatecxx . . $ QTJSC/ExecState#* exec, unsigned identifier, PropertySlotcxx . . $ QTJSC/PropertySlot#& slot)
130 {
131 // This is not a general purpose implementation of getOwnPropertySlot.
132 // It should only be called by JSValue::get.
133 // It calls getPropertySlot, not getOwnPropertySlot.
134 JSObjectcxx . . $ QTJSC/JSObject#* object = toObjectcxx . . $ QTJSC/JSCell#toObject(8709ed4849a165ab).(exec);
135 slot.setBasecxx . . $ QTJSC/PropertySlot#setBase(5c2ac18db087b3e6).(object);
136 if (!object->getPropertySlotcxx . . $ QTJSC/JSObject#getPropertySlot(d57d1c8d4b24d235).(exec, identifier, slot))
137 slot.setUndefinedcxx . . $ QTJSC/PropertySlot#setUndefined(49f6e7a06ebc5aa8).();
138 return true;
139 }
140
141 void JSCellcxx . . $ QTJSC/JSCell#::putcxx . . $ QTJSC/JSCell#put(dfb3133dafbe9ff4).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& identifier, JSValuecxx . . $ QTJSC/JSValue# value, PutPropertySlotcxx . . $ QTJSC/PutPropertySlot#& slot)
142 {
143 toObjectcxx . . $ QTJSC/JSCell#toObject(8709ed4849a165ab).(exec)->putcxx . . $ QTJSC/JSObject#put(dfb3133dafbe9ff4).(exec, identifier, value, slot);
144 }
145
146 void JSCellcxx . . $ QTJSC/JSCell#::putcxx . . $ QTJSC/JSCell#put(b1b60585cf3bb95).(ExecStatecxx . . $ QTJSC/ExecState#* exec, unsigned identifier, JSValuecxx . . $ QTJSC/JSValue# value)
147 {
148 toObjectcxx . . $ QTJSC/JSCell#toObject(8709ed4849a165ab).(exec)->putcxx . . $ QTJSC/JSObject#put(b1b60585cf3bb95).(exec, identifier, value);
149 }
150
151 bool JSCellcxx . . $ QTJSC/JSCell#::deletePropertycxx . . $ QTJSC/JSCell#deleteProperty(13154ef9bddc9416).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& identifier)
152 {
153 return toObjectcxx . . $ QTJSC/JSCell#toObject(8709ed4849a165ab).(exec)->deletePropertycxx . . $ QTJSC/JSObject#deleteProperty(13154ef9bddc9416).(exec, identifier);
154 }
155
156 bool JSCellcxx . . $ QTJSC/JSCell#::deletePropertycxx . . $ QTJSC/JSCell#deleteProperty(2f8cbeb04562a47b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, unsigned identifier)
157 {
158 return toObjectcxx . . $ QTJSC/JSCell#toObject(8709ed4849a165ab).(exec)->deletePropertycxx . . $ QTJSC/JSObject#deleteProperty(2f8cbeb04562a47b).(exec, identifier);
159 }
160
161 JSObjectcxx . . $ QTJSC/JSObject#* JSCellcxx . . $ QTJSC/JSCell#::toThisObjectcxx . . $ QTJSC/JSCell#toThisObject(8709ed4849a165ab).(ExecStatecxx . . $ QTJSC/ExecState#* exec) const
162 {
163 return toObjectcxx . . $ QTJSC/JSCell#toObject(8709ed4849a165ab).(exec);
164 }
165
166 UStringcxx . . $ QTJSC/UString# JSCellcxx . . $ QTJSC/JSCell#::toThisStringcxx . . $ QTJSC/JSCell#toThisString(9c94f5abb1995042).(ExecStatecxx . . $ QTJSC/ExecState#* exec) const
167 {
168 return toThisObjectcxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).(exec)->toStringcxx . . $ QTJSC/JSObject#toString(9c94f5abb1995042).(exec);
169 }
170
171 JSStringcxx . . $ QTJSC/JSString#* JSCellcxx . . $ QTJSC/JSCell#::toThisJSStringcxx . . $ QTJSC/JSCell#toThisJSString(193b2cc77222fd6b).(ExecStatecxx . . $ QTJSC/ExecState#* exec)
172 {
173 return jsStringcxx . . $ QTJSC/jsString(edccc873576bddf5).(exec, toThisStringcxx . . $ QTJSC/JSCell#toThisString(9c94f5abb1995042).(exec));
174 }
175
176 const ClassInfocxx . . $ QTJSC/ClassInfo#* JSCellcxx . . $ QTJSC/JSCell#::classInfocxx . . $ QTJSC/JSCell#classInfo(f90fb4cda7a7c2e2).() const
177 {
178 return 0;
179 }
180
181 JSValuecxx . . $ QTJSC/JSValue# JSCellcxx . . $ QTJSC/JSCell#::getJSNumbercxx . . $ QTJSC/JSCell#getJSNumber(ad9afe69d7bf6378).()
182 {
183 return JSValuecxx . . $ QTJSC/JSValue#JSValue(49f6e7a06ebc5aa8).();
184 }
185
186 bool JSCellcxx . . $ QTJSC/JSCell#::isGetterSettercxx . . $ QTJSC/JSCell#isGetterSetter(50ce9a9e25b4a850).() const
187 {
188 return false;
189 }
190
191 JSValuecxx . . $ QTJSC/JSValue# JSCellcxx . . $ QTJSC/JSCell#::toPrimitivecxx . . $ QTJSC/JSCell#toPrimitive(9c1c7f5535dadf1e).(ExecStatecxx . . $ QTJSC/ExecState#*, PreferredPrimitiveTypecxx . . $ QTJSC/PreferredPrimitiveType#) const
192 {
193 ASSERT_NOT_REACHEDcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:185:9`!();
194 return JSValuecxx . . $ QTJSC/JSValue#JSValue(49f6e7a06ebc5aa8).();
195 }
196
197 bool JSCellcxx . . $ QTJSC/JSCell#::getPrimitiveNumbercxx . . $ QTJSC/JSCell#getPrimitiveNumber(5ae801b0dd2b44e9).(ExecStatecxx . . $ QTJSC/ExecState#*, double&, JSValuecxx . . $ QTJSC/JSValue#&)
198 {
199 ASSERT_NOT_REACHEDcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:185:9`!();
200 return false;
201 }
202
203 bool JSCellcxx . . $ QTJSC/JSCell#::toBooleancxx . . $ QTJSC/JSCell#toBoolean(9608304f86fd7dc).(ExecStatecxx . . $ QTJSC/ExecState#*) const
204 {
205 ASSERT_NOT_REACHEDcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:185:9`!();
206 return false;
207 }
208
209 double JSCellcxx . . $ QTJSC/JSCell#::toNumbercxx . . $ QTJSC/JSCell#toNumber(1fd034e372fd1279).(ExecStatecxx . . $ QTJSC/ExecState#*) const
210 {
211 ASSERT_NOT_REACHEDcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:185:9`!();
212 return 0;
213 }
214
215 UStringcxx . . $ QTJSC/UString# JSCellcxx . . $ QTJSC/JSCell#::toStringcxx . . $ QTJSC/JSCell#toString(9c94f5abb1995042).(ExecStatecxx . . $ QTJSC/ExecState#*) const
216 {
217 ASSERT_NOT_REACHEDcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:185:9`!();
218 return UStringcxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).();
219 }
220
221 JSObjectcxx . . $ QTJSC/JSObject#* JSCellcxx . . $ QTJSC/JSCell#::toObjectcxx . . $ QTJSC/JSCell#toObject(8709ed4849a165ab).(ExecStatecxx . . $ QTJSC/ExecState#*) const
222 {
223 ASSERT_NOT_REACHEDcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:185:9`!();
224 return 0;
225 }
226
227 } // namespace JSC