Debian Codegraph @

src/3rdparty/javascriptcore/JavaScriptCore/runtime/ScopeChain.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21 #ifndef ScopeChain_h
22 #define ScopeChain_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/runtime/ScopeChain.h:22:9`!
23
24 #include "FastAllocBase.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastAllocBase.h`/
25
26 namespace JSCcxx . . $ QTJSC/ {
27
28 class JSGlobalDatacxx . . $ QTJSC/JSGlobalData#;
29 class JSGlobalObjectcxx . . $ QTJSC/JSGlobalObject#;
30 class JSObjectcxx . . $ QTJSC/JSObject#;
31 class MarkStackcxx . . $ QTJSC/MarkStack#;
32 class ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator#;
33
34 class ScopeChainNodecxx . . $ QTJSC/ScopeChainNode# : public FastAllocBasecxx . . $ FastAllocBase# {
35 public:
36 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#ScopeChainNode(841ab3acd4cc0160).(ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* next, JSObjectcxx . . $ QTJSC/JSObject#* object, JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, JSGlobalObjectcxx . . $ QTJSC/JSGlobalObject#* globalObject, JSObjectcxx . . $ QTJSC/JSObject#* globalThis)
37 : nextcxx . . $ QTJSC/ScopeChainNode#next.(next)
38 , objectcxx . . $ QTJSC/ScopeChainNode#object.(object)
39 , globalDatacxx . . $ QTJSC/ScopeChainNode#globalData.(globalData)
40 , globalObjectcxx . . $ QTJSC/ScopeChainNode#globalObject.(globalObject)
41 , globalThiscxx . . $ QTJSC/ScopeChainNode#globalThis.(globalThis)
42 , refCountcxx . . $ QTJSC/ScopeChainNode#refCount.(1)
43 {
44 ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(globalData);
45 ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(globalObject);
46 }
47 #ifndef NDEBUGcxx . . $ `<built-in>:472:9`!
48 // Due to the number of subtle and timing dependent bugs that have occurred due
49 // to deleted but still "valid" ScopeChainNodes we now deliberately clobber the
50 // contents in debug builds.
51 ~ScopeChainNode()
52 {
53 next = 0;
54 object = 0;
55 globalData = 0;
56 globalObject = 0;
57 globalThis = 0;
58 }
59 #endif
60
61 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* nextcxx . . $ QTJSC/ScopeChainNode#next.;
62 JSObjectcxx . . $ QTJSC/JSObject#* objectcxx . . $ QTJSC/ScopeChainNode#object.;
63 JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalDatacxx . . $ QTJSC/ScopeChainNode#globalData.;
64 JSGlobalObjectcxx . . $ QTJSC/JSGlobalObject#* globalObjectcxx . . $ QTJSC/ScopeChainNode#globalObject.;
65 JSObjectcxx . . $ QTJSC/JSObject#* globalThiscxx . . $ QTJSC/ScopeChainNode#globalThis.;
66 int refCountcxx . . $ QTJSC/ScopeChainNode#refCount.;
67
68 void derefcxx . . $ QTJSC/ScopeChainNode#deref(49f6e7a06ebc5aa8).() { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(refCount); if (--refCountcxx . . $ QTJSC/ScopeChainNode#refCount. == 0) { releasecxx . . $ QTJSC/ScopeChainNode#release(49f6e7a06ebc5aa8).();} }
69 void refcxx . . $ QTJSC/ScopeChainNode#ref(49f6e7a06ebc5aa8).() { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(refCount); ++refCountcxx . . $ QTJSC/ScopeChainNode#refCount.; }
70 void releasecxx . . $ QTJSC/ScopeChainNode#release(49f6e7a06ebc5aa8).();
71
72 // Before calling "push" on a bare ScopeChainNode, a client should
73 // logically "copy" the node. Later, the client can "deref" the head
74 // of its chain of ScopeChainNodes to reclaim all the nodes it added
75 // after the logical copy, leaving nodes added before the logical copy
76 // (nodes shared with other clients) untouched.
77 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* copycxx . . $ QTJSC/ScopeChainNode#copy(42331f7aadcf3667).()
78 {
79 refcxx . . $ QTJSC/ScopeChainNode#ref(49f6e7a06ebc5aa8).();
80 return this;
81 }
82
83 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* pushcxx . . $ QTJSC/ScopeChainNode#push(e196140052074d96).(JSObjectcxx . . $ QTJSC/JSObject#*);
84 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* popcxx . . $ QTJSC/ScopeChainNode#pop(42331f7aadcf3667).();
85
86 ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator# begincxx . . $ QTJSC/ScopeChainNode#begin(96529fad815ce745).() const;
87 ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator# endcxx . . $ QTJSC/ScopeChainNode#end(96529fad815ce745).() const;
88
89 #ifndef NDEBUGcxx . . $ `<built-in>:472:9`!
90 void print() const;
91 #endif
92 };
93
94 inline ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#::pushcxx . . $ QTJSC/ScopeChainNode#push(e196140052074d96).(JSObjectcxx . . $ QTJSC/JSObject#* o)
95 {
96 ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(o);
97 return new ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#(this, o, globalDatacxx . . $ QTJSC/ScopeChainNode#globalData., globalObjectcxx . . $ QTJSC/ScopeChainNode#globalObject., globalThiscxx . . $ QTJSC/ScopeChainNode#globalThis.);
98 }
99
100 inline ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#::popcxx . . $ QTJSC/ScopeChainNode#pop(42331f7aadcf3667).()
101 {
102 ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(next);
103 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* result = nextcxx . . $ QTJSC/ScopeChainNode#next.;
104
105 if (--refCountcxx . . $ QTJSC/ScopeChainNode#refCount. != 0)
106 ++result->refCountcxx . . $ QTJSC/ScopeChainNode#refCount.;
107 else
108 delete this;
109
110 return result;
111 }
112
113 inline void ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#::releasecxx . . $ QTJSC/ScopeChainNode#release(49f6e7a06ebc5aa8).()
114 {
115 // This function is only called by deref(),
116 // Deref ensures these conditions are true.
117 ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(refCount == 0);
118 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* n = this;
119 do {
120 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* next = n->nextcxx . . $ QTJSC/ScopeChainNode#next.;
121 delete n;
122 n = next;
123 } while (n && --n->refCountcxx . . $ QTJSC/ScopeChainNode#refCount. == 0);
124 }
125
126 class ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator# {
127 public:
128 ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator#ScopeChainIterator(2e05a1e0cea03012).(const ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* node)
129 : m_nodecxx . . $ QTJSC/ScopeChainIterator#m_node.(node)
130 {
131 }
132
133 JSObjectcxx . . $ QTJSC/JSObject#* const & operatorcxx . . $ QTJSC/ScopeChainIterator#`operator*`(99d346b5a13496d5).*() const { return m_nodecxx . . $ QTJSC/ScopeChainIterator#m_node.->objectcxx . . $ QTJSC/ScopeChainNode#object.; }
134 JSObjectcxx . . $ QTJSC/JSObject#* const * operatorcxx . . $ QTJSC/ScopeChainIterator#`operator->`(34aaeb1f312eb7db).->() const { return &(operator*()); }
135
136 ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator#& operatorcxx . . $ QTJSC/ScopeChainIterator#operator++(fdd019326dfb3ff8).++() { m_nodecxx . . $ QTJSC/ScopeChainIterator#m_node. = m_nodecxx . . $ QTJSC/ScopeChainIterator#m_node.->nextcxx . . $ QTJSC/ScopeChainNode#next.; return *this; }
137
138 // postfix ++ intentionally omitted
139
140 bool operatorcxx . . $ QTJSC/ScopeChainIterator#`operator==`(b99368ddd4a254b).==(const ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator#& other) const { return m_nodecxx . . $ QTJSC/ScopeChainIterator#m_node. == other.m_nodecxx . . $ QTJSC/ScopeChainIterator#m_node.; }
141 bool operatorcxx . . $ QTJSC/ScopeChainIterator#`operator!=`(b99368ddd4a254b).!=(const ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator#& other) const { return m_nodecxx . . $ QTJSC/ScopeChainIterator#m_node. != other.m_nodecxx . . $ QTJSC/ScopeChainIterator#m_node.; }
142
143 private:
144 const ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* m_nodecxx . . $ QTJSC/ScopeChainIterator#m_node.;
145 };
146
147 inline ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator# ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#::begincxx . . $ QTJSC/ScopeChainNode#begin(96529fad815ce745).() const
148 {
149 return ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator#ScopeChainIterator(2e05a1e0cea03012).(this);
150 }
151
152 inline ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator# ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#::endcxx . . $ QTJSC/ScopeChainNode#end(96529fad815ce745).() const
153 {
154 return ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator#ScopeChainIterator(2e05a1e0cea03012).(0);
155 }
156
157 class NoScopeChaincxx . . $ QTJSC/NoScopeChain# {};
158
159 class ScopeChaincxx . . $ QTJSC/ScopeChain# {
160 friend class JITcxx . . $ QTJSC/JIT#;
161 public:
162 ScopeChaincxx . . $ QTJSC/ScopeChain#ScopeChain(5f17479e0fa3a595).(NoScopeChaincxx . . $ QTJSC/NoScopeChain#)
163 : m_nodecxx . . $ QTJSC/ScopeChain#m_node.(0)
164 {
165 }
166
167 ScopeChaincxx . . $ QTJSC/ScopeChain#ScopeChain(b97d23b0954839b3).(JSObjectcxx . . $ QTJSC/JSObject#* o, JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, JSGlobalObjectcxx . . $ QTJSC/JSGlobalObject#* globalObject, JSObjectcxx . . $ QTJSC/JSObject#* globalThis)
168 : m_nodecxx . . $ QTJSC/ScopeChain#m_node.(new ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#ScopeChainNode(841ab3acd4cc0160).(0, o, globalData, globalObject, globalThis))
169 {
170 }
171
172 ScopeChaincxx . . $ QTJSC/ScopeChain#ScopeChain(b489e285b10a6c80).(const ScopeChaincxx . . $ QTJSC/ScopeChain#& c)
173 : m_nodecxx . . $ QTJSC/ScopeChain#m_node.(c.m_nodecxx . . $ QTJSC/ScopeChain#m_node.->copycxx . . $ QTJSC/ScopeChainNode#copy(42331f7aadcf3667).())
174 {
175 }
176
177 ScopeChaincxx . . $ QTJSC/ScopeChain#& operatorcxx . . $ QTJSC/ScopeChain#`operator=`(8020e468db5c14ae).=(const ScopeChaincxx . . $ QTJSC/ScopeChain#& c);
178
179 explicit ScopeChaincxx . . $ QTJSC/ScopeChain#ScopeChain(fdc7869371484d42).(ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* node)
180 : m_nodecxx . . $ QTJSC/ScopeChain#m_node.(node->copycxx . . $ QTJSC/ScopeChainNode#copy(42331f7aadcf3667).())
181 {
182 }
183
184 ~cxx . . $ QTJSC/ScopeChain#`~ScopeChain`(49f6e7a06ebc5aa8).ScopeChaincxx . . $ QTJSC/ScopeChain#()
185 {
186 if (m_nodecxx . . $ QTJSC/ScopeChain#m_node.)
187 m_nodecxx . . $ QTJSC/ScopeChain#m_node.->derefcxx . . $ QTJSC/ScopeChainNode#deref(49f6e7a06ebc5aa8).();
188 #ifndef NDEBUGcxx . . $ `<built-in>:472:9`!
189 m_node = 0;
190 #endif
191 }
192
193 void swapcxx . . $ QTJSC/ScopeChain#swap(1a290238a65c6c2e).(ScopeChaincxx . . $ QTJSC/ScopeChain#&);
194
195 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* nodecxx . . $ QTJSC/ScopeChain#node(7483ce9f56294eec).() const { return m_nodecxx . . $ QTJSC/ScopeChain#m_node.; }
196
197 JSObjectcxx . . $ QTJSC/JSObject#* topcxx . . $ QTJSC/ScopeChain#top(8ac23ea934d7a115).() const { return m_nodecxx . . $ QTJSC/ScopeChain#m_node.->objectcxx . . $ QTJSC/ScopeChainNode#object.; }
198
199 ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator# begincxx . . $ QTJSC/ScopeChain#begin(96529fad815ce745).() const { return m_nodecxx . . $ QTJSC/ScopeChain#m_node.->begincxx . . $ QTJSC/ScopeChainNode#begin(96529fad815ce745).(); }
200 ScopeChainIteratorcxx . . $ QTJSC/ScopeChainIterator# endcxx . . $ QTJSC/ScopeChain#end(96529fad815ce745).() const { return m_nodecxx . . $ QTJSC/ScopeChain#m_node.->endcxx . . $ QTJSC/ScopeChainNode#end(96529fad815ce745).(); }
201
202 void pushcxx . . $ QTJSC/ScopeChain#push(aa1c69ebc68b9201).(JSObjectcxx . . $ QTJSC/JSObject#* o) { m_nodecxx . . $ QTJSC/ScopeChain#m_node. = m_nodecxx . . $ QTJSC/ScopeChain#m_node.->pushcxx . . $ QTJSC/ScopeChainNode#push(e196140052074d96).(o); }
203
204 void popcxx . . $ QTJSC/ScopeChain#pop(49f6e7a06ebc5aa8).() { m_nodecxx . . $ QTJSC/ScopeChain#m_node. = m_nodecxx . . $ QTJSC/ScopeChain#m_node.->popcxx . . $ QTJSC/ScopeChainNode#pop(42331f7aadcf3667).(); }
205 void clearcxx . . $ QTJSC/ScopeChain#clear(49f6e7a06ebc5aa8).() { m_nodecxx . . $ QTJSC/ScopeChain#m_node.->derefcxx . . $ QTJSC/ScopeChainNode#deref(49f6e7a06ebc5aa8).(); m_nodecxx . . $ QTJSC/ScopeChain#m_node. = 0; }
206
207 JSGlobalObjectcxx . . $ QTJSC/JSGlobalObject#* globalObjectcxx . . $ QTJSC/ScopeChain#globalObject(3d50c730b5e26899).() const { return m_nodecxx . . $ QTJSC/ScopeChain#m_node.->globalObjectcxx . . $ QTJSC/ScopeChainNode#globalObject.; }
208
209 void markAggregatecxx . . $ QTJSC/ScopeChain#markAggregate(25892ea107a060b1).(MarkStackcxx . . $ QTJSC/MarkStack#&) const;
210
211 // Caution: this should only be used if the codeblock this is being used
212 // with needs a full scope chain, otherwise this returns the depth of
213 // the preceeding call frame
214 //
215 // Returns the depth of the current call frame's scope chain
216 int localDepthcxx . . $ QTJSC/ScopeChain#localDepth(455f465bc33b4cdf).() const;
217
218 #ifndef NDEBUGcxx . . $ `<built-in>:472:9`!
219 void print() const { m_node->print(); }
220 #endif
221
222 private:
223 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* m_nodecxx . . $ QTJSC/ScopeChain#m_node.;
224 };
225
226 inline void ScopeChaincxx . . $ QTJSC/ScopeChain#::swapcxx . . $ QTJSC/ScopeChain#swap(1a290238a65c6c2e).(ScopeChaincxx . . $ QTJSC/ScopeChain#& o)
227 {
228 ScopeChainNodecxx . . $ QTJSC/ScopeChainNode#* tmp = m_nodecxx . . $ QTJSC/ScopeChain#m_node.;
229 m_nodecxx . . $ QTJSC/ScopeChain#m_node. = o.m_nodecxx . . $ QTJSC/ScopeChain#m_node.;
230 o.m_nodecxx . . $ QTJSC/ScopeChain#m_node. = tmp;
231 }
232
233 inline ScopeChaincxx . . $ QTJSC/ScopeChain#& ScopeChaincxx . . $ QTJSC/ScopeChain#::operatorcxx . . $ QTJSC/ScopeChain#`operator=`(8020e468db5c14ae).=(const ScopeChaincxx . . $ QTJSC/ScopeChain#& c)
234 {
235 ScopeChaincxx . . $ QTJSC/ScopeChain# tmpcxx . . $ QTJSC/ScopeChain#ScopeChain(b489e285b10a6c80).(c);
236 swapcxx . . $ QTJSC/ScopeChain#swap(1a290238a65c6c2e).(tmp);
237 return *this;
238 }
239
240 } // namespace JSC
241
242 #endif // ScopeChain_h