1 | /*
|
---|
2 | * Copyright (C) 1999-2000 Harri Porten ([email protected])
|
---|
3 | * Copyright (C) 2001 Peter Kelly ([email protected])
|
---|
4 | * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
|
---|
5 | * Copyright (C) 2007 Cameron Zwarich ([email protected])
|
---|
6 | * Copyright (C) 2007 Maks Orlovich
|
---|
7 | * Copyright (C) 2007 Eric Seidel <[email protected]>
|
---|
8 | *
|
---|
9 | * This library is free software; you can redistribute it and/or
|
---|
10 | * modify it under the terms of the GNU Library General Public
|
---|
11 | * License as published by the Free Software Foundation; either
|
---|
12 | * version 2 of the License, or (at your option) any later version.
|
---|
13 | *
|
---|
14 | * This library is distributed in the hope that it will be useful,
|
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
17 | * Library General Public License for more details.
|
---|
18 | *
|
---|
19 | * You should have received a copy of the GNU Library General Public License
|
---|
20 | * along with this library; see the file COPYING.LIB. If not, write to
|
---|
21 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
---|
22 | * Boston, MA 02110-1301, USA.
|
---|
23 | *
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef NODES_H_
|
---|
27 | #define NODES_H_
|
---|
28 |
|
---|
29 | #include "Error.h"
|
---|
30 | #include "Opcode.h"
|
---|
31 | #include "ResultType.h"
|
---|
32 | #include "SourceCode.h"
|
---|
33 | #include "SymbolTable.h"
|
---|
34 | #include <wtf/MathExtras.h>
|
---|
35 | #include <wtf/OwnPtr.h>
|
---|
36 | #include <wtf/Vector.h>
|
---|
37 |
|
---|
38 | #if PLATFORM(X86) && COMPILER(GCC)
|
---|
39 | #define JSC_FAST_CALL __attribute__((regparm(3)))
|
---|
40 | #else
|
---|
41 | #define JSC_FAST_CALL
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | namespace JSC {
|
---|
45 |
|
---|
46 | class ArgumentListNode;
|
---|
47 | class CodeBlock;
|
---|
48 | class BytecodeGenerator;
|
---|
49 | class FuncDeclNode;
|
---|
50 | class EvalCodeBlock;
|
---|
51 | class JSFunction;
|
---|
52 | class NodeReleaser;
|
---|
53 | class ProgramCodeBlock;
|
---|
54 | class PropertyListNode;
|
---|
55 | class RegisterID;
|
---|
56 | class ScopeChainNode;
|
---|
57 |
|
---|
58 | typedef unsigned CodeFeatures;
|
---|
59 |
|
---|
60 | const CodeFeatures NoFeatures = 0;
|
---|
61 | const CodeFeatures EvalFeature = 1 << 0;
|
---|
62 | const CodeFeatures ClosureFeature = 1 << 1;
|
---|
63 | const CodeFeatures AssignFeature = 1 << 2;
|
---|
64 | const CodeFeatures ArgumentsFeature = 1 << 3;
|
---|
65 | const CodeFeatures WithFeature = 1 << 4;
|
---|
66 | const CodeFeatures CatchFeature = 1 << 5;
|
---|
67 | const CodeFeatures ThisFeature = 1 << 6;
|
---|
68 | const CodeFeatures AllFeatures = EvalFeature | ClosureFeature | AssignFeature | ArgumentsFeature | WithFeature | CatchFeature | ThisFeature;
|
---|
69 |
|
---|
70 | enum Operator {
|
---|
71 | OpEqual,
|
---|
72 | OpPlusEq,
|
---|
73 | OpMinusEq,
|
---|
74 | OpMultEq,
|
---|
75 | OpDivEq,
|
---|
76 | OpPlusPlus,
|
---|
77 | OpMinusMinus,
|
---|
78 | OpAndEq,
|
---|
79 | OpXOrEq,
|
---|
80 | OpOrEq,
|
---|
81 | OpModEq,
|
---|
82 | OpLShift,
|
---|
83 | OpRShift,
|
---|
84 | OpURShift
|
---|
85 | };
|
---|
86 |
|
---|
87 | enum LogicalOperator {
|
---|
88 | OpLogicalAnd,
|
---|
89 | OpLogicalOr
|
---|
90 | };
|
---|
91 |
|
---|
92 | namespace DeclarationStacks {
|
---|
93 | enum VarAttrs { IsConstant = 1, HasInitializer = 2 };
|
---|
94 | typedef Vector<std::pair<Identifier, unsigned> > VarStack;
|
---|
95 | typedef Vector<RefPtr<FuncDeclNode> > FunctionStack;
|
---|
96 | }
|
---|
97 |
|
---|
98 | struct SwitchInfo {
|
---|
99 | enum SwitchType { SwitchNone, SwitchImmediate, SwitchCharacter, SwitchString };
|
---|
100 | uint32_t bytecodeOffset;
|
---|
101 | SwitchType switchType;
|
---|
102 | };
|
---|
103 |
|
---|
104 | class ParserRefCounted : Noncopyable {
|
---|
105 | protected:
|
---|
106 | ParserRefCounted(JSGlobalData*) JSC_FAST_CALL;
|
---|
107 |
|
---|
108 | public:
|
---|
109 | virtual ~ParserRefCounted();
|
---|
110 |
|
---|
111 | // Nonrecursive destruction.
|
---|
112 | virtual void releaseNodes(NodeReleaser&);
|
---|
113 |
|
---|
114 | void ref() JSC_FAST_CALL;
|
---|
115 | void deref() JSC_FAST_CALL;
|
---|
116 | bool hasOneRef() JSC_FAST_CALL;
|
---|
117 |
|
---|
118 | static void deleteNewObjects(JSGlobalData*) JSC_FAST_CALL;
|
---|
119 |
|
---|
120 | private:
|
---|
121 | JSGlobalData* m_globalData;
|
---|
122 | };
|
---|
123 |
|
---|
124 | class Node : public ParserRefCounted {
|
---|
125 | public:
|
---|
126 | Node(JSGlobalData*) JSC_FAST_CALL;
|
---|
127 |
|
---|
128 | /*
|
---|
129 | Return value: The register holding the production's value.
|
---|
130 | dst: An optional parameter specifying the most efficient
|
---|
131 | destination at which to store the production's value.
|
---|
132 | The callee must honor dst.
|
---|
133 |
|
---|
134 | dst provides for a crude form of copy propagation. For example,
|
---|
135 |
|
---|
136 | x = 1
|
---|
137 |
|
---|
138 | becomes
|
---|
139 |
|
---|
140 | load r[x], 1
|
---|
141 |
|
---|
142 | instead of
|
---|
143 |
|
---|
144 | load r0, 1
|
---|
145 | mov r[x], r0
|
---|
146 |
|
---|
147 | because the assignment node, "x =", passes r[x] as dst to the number
|
---|
148 | node, "1".
|
---|
149 | */
|
---|
150 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* dst = 0) JSC_FAST_CALL = 0;
|
---|
151 |
|
---|
152 | int lineNo() const { return m_line; }
|
---|
153 |
|
---|
154 | protected:
|
---|
155 | int m_line;
|
---|
156 | };
|
---|
157 |
|
---|
158 | class ExpressionNode : public Node {
|
---|
159 | public:
|
---|
160 | ExpressionNode(JSGlobalData* globalData, ResultType resultDesc = ResultType::unknownType()) JSC_FAST_CALL
|
---|
161 | : Node(globalData)
|
---|
162 | , m_resultDesc(resultDesc)
|
---|
163 | {
|
---|
164 | }
|
---|
165 |
|
---|
166 | virtual bool isNumber() const JSC_FAST_CALL { return false; }
|
---|
167 | virtual bool isString() const JSC_FAST_CALL { return false; }
|
---|
168 | virtual bool isNull() const JSC_FAST_CALL { return false; }
|
---|
169 | virtual bool isPure(BytecodeGenerator&) const JSC_FAST_CALL { return false; }
|
---|
170 | virtual bool isLocation() const JSC_FAST_CALL { return false; }
|
---|
171 | virtual bool isResolveNode() const JSC_FAST_CALL { return false; }
|
---|
172 | virtual bool isBracketAccessorNode() const JSC_FAST_CALL { return false; }
|
---|
173 | virtual bool isDotAccessorNode() const JSC_FAST_CALL { return false; }
|
---|
174 | virtual bool isFuncExprNode() const JSC_FAST_CALL { return false; }
|
---|
175 | virtual bool isSimpleArray() const JSC_FAST_CALL { return false; }
|
---|
176 |
|
---|
177 | virtual ExpressionNode* stripUnaryPlus() { return this; }
|
---|
178 |
|
---|
179 | ResultType resultDescriptor() const JSC_FAST_CALL { return m_resultDesc; }
|
---|
180 |
|
---|
181 | // This needs to be in public in order to compile using GCC 3.x
|
---|
182 | typedef enum { EvalOperator, FunctionCall } CallerType;
|
---|
183 |
|
---|
184 | private:
|
---|
185 | ResultType m_resultDesc;
|
---|
186 | };
|
---|
187 |
|
---|
188 | class StatementNode : public Node {
|
---|
189 | public:
|
---|
190 | StatementNode(JSGlobalData*) JSC_FAST_CALL;
|
---|
191 | void setLoc(int line0, int line1) JSC_FAST_CALL;
|
---|
192 | int firstLine() const JSC_FAST_CALL { return lineNo(); }
|
---|
193 | int lastLine() const JSC_FAST_CALL { return m_lastLine; }
|
---|
194 |
|
---|
195 | virtual bool isEmptyStatement() const JSC_FAST_CALL { return false; }
|
---|
196 | virtual bool isReturnNode() const JSC_FAST_CALL { return false; }
|
---|
197 | virtual bool isExprStatement() const JSC_FAST_CALL { return false; }
|
---|
198 |
|
---|
199 | virtual bool isBlock() const JSC_FAST_CALL { return false; }
|
---|
200 |
|
---|
201 | private:
|
---|
202 | int m_lastLine;
|
---|
203 | };
|
---|
204 |
|
---|
205 | class NullNode : public ExpressionNode {
|
---|
206 | public:
|
---|
207 | NullNode(JSGlobalData* globalData) JSC_FAST_CALL
|
---|
208 | : ExpressionNode(globalData, ResultType::nullType())
|
---|
209 | {
|
---|
210 | }
|
---|
211 |
|
---|
212 | virtual bool isNull() const JSC_FAST_CALL { return true; }
|
---|
213 |
|
---|
214 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
215 | };
|
---|
216 |
|
---|
217 | class BooleanNode : public ExpressionNode {
|
---|
218 | public:
|
---|
219 | BooleanNode(JSGlobalData* globalData, bool value) JSC_FAST_CALL
|
---|
220 | : ExpressionNode(globalData, ResultType::booleanType())
|
---|
221 | , m_value(value)
|
---|
222 | {
|
---|
223 | }
|
---|
224 |
|
---|
225 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
226 |
|
---|
227 | virtual bool isPure(BytecodeGenerator&) const JSC_FAST_CALL { return true; }
|
---|
228 |
|
---|
229 | private:
|
---|
230 | bool m_value;
|
---|
231 | };
|
---|
232 |
|
---|
233 | class NumberNode : public ExpressionNode {
|
---|
234 | public:
|
---|
235 | NumberNode(JSGlobalData* globalData, double v) JSC_FAST_CALL
|
---|
236 | : ExpressionNode(globalData, ResultType::numberType())
|
---|
237 | , m_double(v)
|
---|
238 | {
|
---|
239 | }
|
---|
240 |
|
---|
241 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
242 |
|
---|
243 | virtual bool isNumber() const JSC_FAST_CALL { return true; }
|
---|
244 | virtual bool isPure(BytecodeGenerator&) const JSC_FAST_CALL { return true; }
|
---|
245 | double value() const JSC_FAST_CALL { return m_double; }
|
---|
246 | void setValue(double d) JSC_FAST_CALL { m_double = d; }
|
---|
247 |
|
---|
248 | private:
|
---|
249 | double m_double;
|
---|
250 | };
|
---|
251 |
|
---|
252 | class StringNode : public ExpressionNode {
|
---|
253 | public:
|
---|
254 | StringNode(JSGlobalData* globalData, const Identifier& v) JSC_FAST_CALL
|
---|
255 | : ExpressionNode(globalData, ResultType::stringType())
|
---|
256 | , m_value(v)
|
---|
257 | {
|
---|
258 | }
|
---|
259 |
|
---|
260 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
261 |
|
---|
262 | virtual bool isString() const JSC_FAST_CALL { return true; }
|
---|
263 | const Identifier& value() { return m_value; }
|
---|
264 | virtual bool isPure(BytecodeGenerator&) const JSC_FAST_CALL { return true; }
|
---|
265 |
|
---|
266 | private:
|
---|
267 | Identifier m_value;
|
---|
268 | };
|
---|
269 |
|
---|
270 | class ThrowableExpressionData {
|
---|
271 | public:
|
---|
272 | ThrowableExpressionData()
|
---|
273 | : m_divot(static_cast<uint32_t>(-1))
|
---|
274 | , m_startOffset(static_cast<uint16_t>(-1))
|
---|
275 | , m_endOffset(static_cast<uint16_t>(-1))
|
---|
276 | {
|
---|
277 | }
|
---|
278 |
|
---|
279 | ThrowableExpressionData(unsigned divot, unsigned startOffset, unsigned endOffset)
|
---|
280 | : m_divot(divot)
|
---|
281 | , m_startOffset(startOffset)
|
---|
282 | , m_endOffset(endOffset)
|
---|
283 | {
|
---|
284 | }
|
---|
285 |
|
---|
286 | void setExceptionSourceCode(unsigned divot, unsigned startOffset, unsigned endOffset)
|
---|
287 | {
|
---|
288 | m_divot = divot;
|
---|
289 | m_startOffset = startOffset;
|
---|
290 | m_endOffset = endOffset;
|
---|
291 | }
|
---|
292 |
|
---|
293 | uint32_t divot() const { return m_divot; }
|
---|
294 | uint16_t startOffset() const { return m_startOffset; }
|
---|
295 | uint16_t endOffset() const { return m_endOffset; }
|
---|
296 |
|
---|
297 | protected:
|
---|
298 | RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* msg);
|
---|
299 | RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* msg, const Identifier&);
|
---|
300 |
|
---|
301 | private:
|
---|
302 | uint32_t m_divot;
|
---|
303 | uint16_t m_startOffset;
|
---|
304 | uint16_t m_endOffset;
|
---|
305 | };
|
---|
306 |
|
---|
307 | class ThrowableSubExpressionData : public ThrowableExpressionData {
|
---|
308 | public:
|
---|
309 | ThrowableSubExpressionData()
|
---|
310 | : ThrowableExpressionData()
|
---|
311 | , m_subexpressionDivotOffset(0)
|
---|
312 | , m_subexpressionEndOffset(0)
|
---|
313 | {
|
---|
314 | }
|
---|
315 |
|
---|
316 | ThrowableSubExpressionData(unsigned divot, unsigned startOffset, unsigned endOffset)
|
---|
317 | : ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
318 | , m_subexpressionDivotOffset(0)
|
---|
319 | , m_subexpressionEndOffset(0)
|
---|
320 | {
|
---|
321 | }
|
---|
322 |
|
---|
323 | void setSubexpressionInfo(uint32_t subexpressionDivot, uint16_t subexpressionOffset)
|
---|
324 | {
|
---|
325 | ASSERT(subexpressionDivot <= divot());
|
---|
326 | if ((divot() - subexpressionDivot) & ~0xFFFF) // Overflow means we can't do this safely, so just point at the primary divot
|
---|
327 | return;
|
---|
328 | m_subexpressionDivotOffset = divot() - subexpressionDivot;
|
---|
329 | m_subexpressionEndOffset = subexpressionOffset;
|
---|
330 | }
|
---|
331 |
|
---|
332 | protected:
|
---|
333 | uint16_t m_subexpressionDivotOffset;
|
---|
334 | uint16_t m_subexpressionEndOffset;
|
---|
335 | };
|
---|
336 |
|
---|
337 | class ThrowablePrefixedSubExpressionData : public ThrowableExpressionData {
|
---|
338 | public:
|
---|
339 | ThrowablePrefixedSubExpressionData()
|
---|
340 | : ThrowableExpressionData()
|
---|
341 | , m_subexpressionDivotOffset(0)
|
---|
342 | , m_subexpressionStartOffset(0)
|
---|
343 | {
|
---|
344 | }
|
---|
345 |
|
---|
346 | ThrowablePrefixedSubExpressionData(unsigned divot, unsigned startOffset, unsigned endOffset)
|
---|
347 | : ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
348 | , m_subexpressionDivotOffset(0)
|
---|
349 | , m_subexpressionStartOffset(0)
|
---|
350 | {
|
---|
351 | }
|
---|
352 |
|
---|
353 | void setSubexpressionInfo(uint32_t subexpressionDivot, uint16_t subexpressionOffset)
|
---|
354 | {
|
---|
355 | ASSERT(subexpressionDivot >= divot());
|
---|
356 | if ((subexpressionDivot - divot()) & ~0xFFFF) // Overflow means we can't do this safely, so just point at the primary divot
|
---|
357 | return;
|
---|
358 | m_subexpressionDivotOffset = subexpressionDivot - divot();
|
---|
359 | m_subexpressionStartOffset = subexpressionOffset;
|
---|
360 | }
|
---|
361 |
|
---|
362 | protected:
|
---|
363 | uint16_t m_subexpressionDivotOffset;
|
---|
364 | uint16_t m_subexpressionStartOffset;
|
---|
365 | };
|
---|
366 |
|
---|
367 | class RegExpNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
368 | public:
|
---|
369 | RegExpNode(JSGlobalData* globalData, const UString& pattern, const UString& flags) JSC_FAST_CALL
|
---|
370 | : ExpressionNode(globalData)
|
---|
371 | , m_pattern(pattern)
|
---|
372 | , m_flags(flags)
|
---|
373 | {
|
---|
374 | }
|
---|
375 |
|
---|
376 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
377 |
|
---|
378 | private:
|
---|
379 | UString m_pattern;
|
---|
380 | UString m_flags;
|
---|
381 | };
|
---|
382 |
|
---|
383 | class ThisNode : public ExpressionNode {
|
---|
384 | public:
|
---|
385 | ThisNode(JSGlobalData* globalData) JSC_FAST_CALL
|
---|
386 | : ExpressionNode(globalData)
|
---|
387 | {
|
---|
388 | }
|
---|
389 |
|
---|
390 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
391 | };
|
---|
392 |
|
---|
393 | class ResolveNode : public ExpressionNode {
|
---|
394 | public:
|
---|
395 | ResolveNode(JSGlobalData* globalData, const Identifier& ident, int startOffset) JSC_FAST_CALL
|
---|
396 | : ExpressionNode(globalData)
|
---|
397 | , m_ident(ident)
|
---|
398 | , m_startOffset(startOffset)
|
---|
399 | {
|
---|
400 | }
|
---|
401 |
|
---|
402 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
403 |
|
---|
404 | virtual bool isPure(BytecodeGenerator&) const JSC_FAST_CALL;
|
---|
405 | virtual bool isLocation() const JSC_FAST_CALL { return true; }
|
---|
406 | virtual bool isResolveNode() const JSC_FAST_CALL { return true; }
|
---|
407 | const Identifier& identifier() const JSC_FAST_CALL { return m_ident; }
|
---|
408 |
|
---|
409 | private:
|
---|
410 | Identifier m_ident;
|
---|
411 | int32_t m_startOffset;
|
---|
412 | };
|
---|
413 |
|
---|
414 | class ElementNode : public ParserRefCounted {
|
---|
415 | public:
|
---|
416 | ElementNode(JSGlobalData* globalData, int elision, ExpressionNode* node) JSC_FAST_CALL
|
---|
417 | : ParserRefCounted(globalData)
|
---|
418 | , m_elision(elision)
|
---|
419 | , m_node(node)
|
---|
420 | {
|
---|
421 | }
|
---|
422 |
|
---|
423 | ElementNode(JSGlobalData* globalData, ElementNode* l, int elision, ExpressionNode* node) JSC_FAST_CALL
|
---|
424 | : ParserRefCounted(globalData)
|
---|
425 | , m_elision(elision)
|
---|
426 | , m_node(node)
|
---|
427 | {
|
---|
428 | l->m_next = this;
|
---|
429 | }
|
---|
430 |
|
---|
431 | virtual ~ElementNode();
|
---|
432 | virtual void releaseNodes(NodeReleaser&);
|
---|
433 |
|
---|
434 | int elision() const { return m_elision; }
|
---|
435 | ExpressionNode* value() { return m_node.get(); }
|
---|
436 |
|
---|
437 | ElementNode* next() { return m_next.get(); }
|
---|
438 |
|
---|
439 | private:
|
---|
440 | RefPtr<ElementNode> m_next;
|
---|
441 | int m_elision;
|
---|
442 | RefPtr<ExpressionNode> m_node;
|
---|
443 | };
|
---|
444 |
|
---|
445 | class ArrayNode : public ExpressionNode {
|
---|
446 | public:
|
---|
447 | ArrayNode(JSGlobalData* globalData, int elision) JSC_FAST_CALL
|
---|
448 | : ExpressionNode(globalData)
|
---|
449 | , m_elision(elision)
|
---|
450 | , m_optional(true)
|
---|
451 | {
|
---|
452 | }
|
---|
453 |
|
---|
454 | ArrayNode(JSGlobalData* globalData, ElementNode* element) JSC_FAST_CALL
|
---|
455 | : ExpressionNode(globalData)
|
---|
456 | , m_element(element)
|
---|
457 | , m_elision(0)
|
---|
458 | , m_optional(false)
|
---|
459 | {
|
---|
460 | }
|
---|
461 |
|
---|
462 | ArrayNode(JSGlobalData* globalData, int elision, ElementNode* element) JSC_FAST_CALL
|
---|
463 | : ExpressionNode(globalData)
|
---|
464 | , m_element(element)
|
---|
465 | , m_elision(elision)
|
---|
466 | , m_optional(true)
|
---|
467 | {
|
---|
468 | }
|
---|
469 |
|
---|
470 | virtual ~ArrayNode();
|
---|
471 | virtual void releaseNodes(NodeReleaser&);
|
---|
472 |
|
---|
473 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
474 |
|
---|
475 | virtual bool isSimpleArray() const JSC_FAST_CALL;
|
---|
476 | PassRefPtr<ArgumentListNode> toArgumentList(JSGlobalData*) const;
|
---|
477 | private:
|
---|
478 | RefPtr<ElementNode> m_element;
|
---|
479 | int m_elision;
|
---|
480 | bool m_optional;
|
---|
481 | };
|
---|
482 |
|
---|
483 | class PropertyNode : public ParserRefCounted {
|
---|
484 | public:
|
---|
485 | enum Type { Constant, Getter, Setter };
|
---|
486 |
|
---|
487 | PropertyNode(JSGlobalData* globalData, const Identifier& name, ExpressionNode* assign, Type type) JSC_FAST_CALL
|
---|
488 | : ParserRefCounted(globalData)
|
---|
489 | , m_name(name)
|
---|
490 | , m_assign(assign)
|
---|
491 | , m_type(type)
|
---|
492 | {
|
---|
493 | }
|
---|
494 |
|
---|
495 | virtual ~PropertyNode();
|
---|
496 | virtual void releaseNodes(NodeReleaser&);
|
---|
497 |
|
---|
498 | const Identifier& name() const { return m_name; }
|
---|
499 |
|
---|
500 | private:
|
---|
501 | friend class PropertyListNode;
|
---|
502 | Identifier m_name;
|
---|
503 | RefPtr<ExpressionNode> m_assign;
|
---|
504 | Type m_type;
|
---|
505 | };
|
---|
506 |
|
---|
507 | class PropertyListNode : public Node {
|
---|
508 | public:
|
---|
509 | PropertyListNode(JSGlobalData* globalData, PropertyNode* node) JSC_FAST_CALL
|
---|
510 | : Node(globalData)
|
---|
511 | , m_node(node)
|
---|
512 | {
|
---|
513 | }
|
---|
514 |
|
---|
515 | PropertyListNode(JSGlobalData* globalData, PropertyNode* node, PropertyListNode* list) JSC_FAST_CALL
|
---|
516 | : Node(globalData)
|
---|
517 | , m_node(node)
|
---|
518 | {
|
---|
519 | list->m_next = this;
|
---|
520 | }
|
---|
521 |
|
---|
522 | virtual ~PropertyListNode();
|
---|
523 | virtual void releaseNodes(NodeReleaser&);
|
---|
524 |
|
---|
525 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
526 |
|
---|
527 | private:
|
---|
528 | RefPtr<PropertyNode> m_node;
|
---|
529 | RefPtr<PropertyListNode> m_next;
|
---|
530 | };
|
---|
531 |
|
---|
532 | class ObjectLiteralNode : public ExpressionNode {
|
---|
533 | public:
|
---|
534 | ObjectLiteralNode(JSGlobalData* globalData) JSC_FAST_CALL
|
---|
535 | : ExpressionNode(globalData)
|
---|
536 | {
|
---|
537 | }
|
---|
538 |
|
---|
539 | ObjectLiteralNode(JSGlobalData* globalData, PropertyListNode* list) JSC_FAST_CALL
|
---|
540 | : ExpressionNode(globalData)
|
---|
541 | , m_list(list)
|
---|
542 | {
|
---|
543 | }
|
---|
544 |
|
---|
545 | virtual ~ObjectLiteralNode();
|
---|
546 | virtual void releaseNodes(NodeReleaser&);
|
---|
547 |
|
---|
548 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
549 |
|
---|
550 | private:
|
---|
551 | RefPtr<PropertyListNode> m_list;
|
---|
552 | };
|
---|
553 |
|
---|
554 | class BracketAccessorNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
555 | public:
|
---|
556 | BracketAccessorNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments) JSC_FAST_CALL
|
---|
557 | : ExpressionNode(globalData)
|
---|
558 | , m_base(base)
|
---|
559 | , m_subscript(subscript)
|
---|
560 | , m_subscriptHasAssignments(subscriptHasAssignments)
|
---|
561 | {
|
---|
562 | }
|
---|
563 |
|
---|
564 | virtual ~BracketAccessorNode();
|
---|
565 | virtual void releaseNodes(NodeReleaser&);
|
---|
566 |
|
---|
567 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
568 |
|
---|
569 | virtual bool isLocation() const JSC_FAST_CALL { return true; }
|
---|
570 | virtual bool isBracketAccessorNode() const JSC_FAST_CALL { return true; }
|
---|
571 | ExpressionNode* base() JSC_FAST_CALL { return m_base.get(); }
|
---|
572 | ExpressionNode* subscript() JSC_FAST_CALL { return m_subscript.get(); }
|
---|
573 |
|
---|
574 | private:
|
---|
575 | RefPtr<ExpressionNode> m_base;
|
---|
576 | RefPtr<ExpressionNode> m_subscript;
|
---|
577 | bool m_subscriptHasAssignments;
|
---|
578 | };
|
---|
579 |
|
---|
580 | class DotAccessorNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
581 | public:
|
---|
582 | DotAccessorNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident) JSC_FAST_CALL
|
---|
583 | : ExpressionNode(globalData)
|
---|
584 | , m_base(base)
|
---|
585 | , m_ident(ident)
|
---|
586 | {
|
---|
587 | }
|
---|
588 |
|
---|
589 | virtual ~DotAccessorNode();
|
---|
590 | virtual void releaseNodes(NodeReleaser&);
|
---|
591 |
|
---|
592 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
593 |
|
---|
594 | virtual bool isLocation() const JSC_FAST_CALL { return true; }
|
---|
595 | virtual bool isDotAccessorNode() const JSC_FAST_CALL { return true; }
|
---|
596 | ExpressionNode* base() const JSC_FAST_CALL { return m_base.get(); }
|
---|
597 | const Identifier& identifier() const JSC_FAST_CALL { return m_ident; }
|
---|
598 |
|
---|
599 | private:
|
---|
600 | RefPtr<ExpressionNode> m_base;
|
---|
601 | Identifier m_ident;
|
---|
602 | };
|
---|
603 |
|
---|
604 | class ArgumentListNode : public Node {
|
---|
605 | public:
|
---|
606 | ArgumentListNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
607 | : Node(globalData)
|
---|
608 | , m_expr(expr)
|
---|
609 | {
|
---|
610 | }
|
---|
611 |
|
---|
612 | ArgumentListNode(JSGlobalData* globalData, ArgumentListNode* listNode, ExpressionNode* expr) JSC_FAST_CALL
|
---|
613 | : Node(globalData)
|
---|
614 | , m_expr(expr)
|
---|
615 | {
|
---|
616 | listNode->m_next = this;
|
---|
617 | }
|
---|
618 |
|
---|
619 | virtual ~ArgumentListNode();
|
---|
620 | virtual void releaseNodes(NodeReleaser&);
|
---|
621 |
|
---|
622 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
623 |
|
---|
624 | RefPtr<ArgumentListNode> m_next;
|
---|
625 | RefPtr<ExpressionNode> m_expr;
|
---|
626 | };
|
---|
627 |
|
---|
628 | class ArgumentsNode : public ParserRefCounted {
|
---|
629 | public:
|
---|
630 | ArgumentsNode(JSGlobalData* globalData) JSC_FAST_CALL
|
---|
631 | : ParserRefCounted(globalData)
|
---|
632 | {
|
---|
633 | }
|
---|
634 |
|
---|
635 | ArgumentsNode(JSGlobalData* globalData, ArgumentListNode* listNode) JSC_FAST_CALL
|
---|
636 | : ParserRefCounted(globalData)
|
---|
637 | , m_listNode(listNode)
|
---|
638 | {
|
---|
639 | }
|
---|
640 |
|
---|
641 | virtual ~ArgumentsNode();
|
---|
642 | virtual void releaseNodes(NodeReleaser&);
|
---|
643 |
|
---|
644 | RefPtr<ArgumentListNode> m_listNode;
|
---|
645 | };
|
---|
646 |
|
---|
647 | class NewExprNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
648 | public:
|
---|
649 | NewExprNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
650 | : ExpressionNode(globalData)
|
---|
651 | , m_expr(expr)
|
---|
652 | {
|
---|
653 | }
|
---|
654 |
|
---|
655 | NewExprNode(JSGlobalData* globalData, ExpressionNode* expr, ArgumentsNode* args) JSC_FAST_CALL
|
---|
656 | : ExpressionNode(globalData)
|
---|
657 | , m_expr(expr)
|
---|
658 | , m_args(args)
|
---|
659 | {
|
---|
660 | }
|
---|
661 |
|
---|
662 | virtual ~NewExprNode();
|
---|
663 | virtual void releaseNodes(NodeReleaser&);
|
---|
664 |
|
---|
665 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
666 |
|
---|
667 | private:
|
---|
668 | RefPtr<ExpressionNode> m_expr;
|
---|
669 | RefPtr<ArgumentsNode> m_args;
|
---|
670 | };
|
---|
671 |
|
---|
672 | class EvalFunctionCallNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
673 | public:
|
---|
674 | EvalFunctionCallNode(JSGlobalData* globalData, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
675 | : ExpressionNode(globalData)
|
---|
676 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
677 | , m_args(args)
|
---|
678 | {
|
---|
679 | }
|
---|
680 |
|
---|
681 | virtual ~EvalFunctionCallNode();
|
---|
682 | virtual void releaseNodes(NodeReleaser&);
|
---|
683 |
|
---|
684 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
685 |
|
---|
686 | private:
|
---|
687 | RefPtr<ArgumentsNode> m_args;
|
---|
688 | };
|
---|
689 |
|
---|
690 | class FunctionCallValueNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
691 | public:
|
---|
692 | FunctionCallValueNode(JSGlobalData* globalData, ExpressionNode* expr, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
693 | : ExpressionNode(globalData)
|
---|
694 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
695 | , m_expr(expr)
|
---|
696 | , m_args(args)
|
---|
697 | {
|
---|
698 | }
|
---|
699 |
|
---|
700 | virtual ~FunctionCallValueNode();
|
---|
701 | virtual void releaseNodes(NodeReleaser&);
|
---|
702 |
|
---|
703 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
704 |
|
---|
705 | private:
|
---|
706 | RefPtr<ExpressionNode> m_expr;
|
---|
707 | RefPtr<ArgumentsNode> m_args;
|
---|
708 | };
|
---|
709 |
|
---|
710 | class FunctionCallResolveNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
711 | public:
|
---|
712 | FunctionCallResolveNode(JSGlobalData* globalData, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
713 | : ExpressionNode(globalData)
|
---|
714 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
715 | , m_ident(ident)
|
---|
716 | , m_args(args)
|
---|
717 | {
|
---|
718 | }
|
---|
719 |
|
---|
720 | virtual ~FunctionCallResolveNode();
|
---|
721 | virtual void releaseNodes(NodeReleaser&);
|
---|
722 |
|
---|
723 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
724 |
|
---|
725 | private:
|
---|
726 | Identifier m_ident;
|
---|
727 | RefPtr<ArgumentsNode> m_args;
|
---|
728 | size_t m_index; // Used by LocalVarFunctionCallNode.
|
---|
729 | size_t m_scopeDepth; // Used by ScopedVarFunctionCallNode and NonLocalVarFunctionCallNode
|
---|
730 | };
|
---|
731 |
|
---|
732 | class FunctionCallBracketNode : public ExpressionNode, public ThrowableSubExpressionData {
|
---|
733 | public:
|
---|
734 | FunctionCallBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
735 | : ExpressionNode(globalData)
|
---|
736 | , ThrowableSubExpressionData(divot, startOffset, endOffset)
|
---|
737 | , m_base(base)
|
---|
738 | , m_subscript(subscript)
|
---|
739 | , m_args(args)
|
---|
740 | {
|
---|
741 | }
|
---|
742 |
|
---|
743 | virtual ~FunctionCallBracketNode();
|
---|
744 | virtual void releaseNodes(NodeReleaser&);
|
---|
745 |
|
---|
746 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
747 |
|
---|
748 | private:
|
---|
749 | RefPtr<ExpressionNode> m_base;
|
---|
750 | RefPtr<ExpressionNode> m_subscript;
|
---|
751 | RefPtr<ArgumentsNode> m_args;
|
---|
752 | };
|
---|
753 |
|
---|
754 | class FunctionCallDotNode : public ExpressionNode, public ThrowableSubExpressionData {
|
---|
755 | public:
|
---|
756 | FunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
757 | : ExpressionNode(globalData)
|
---|
758 | , ThrowableSubExpressionData(divot, startOffset, endOffset)
|
---|
759 | , m_base(base)
|
---|
760 | , m_ident(ident)
|
---|
761 | , m_args(args)
|
---|
762 | {
|
---|
763 | }
|
---|
764 |
|
---|
765 | virtual ~FunctionCallDotNode();
|
---|
766 | virtual void releaseNodes(NodeReleaser&);
|
---|
767 |
|
---|
768 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
769 |
|
---|
770 | protected:
|
---|
771 | RefPtr<ExpressionNode> m_base;
|
---|
772 | Identifier m_ident;
|
---|
773 | RefPtr<ArgumentsNode> m_args;
|
---|
774 | };
|
---|
775 |
|
---|
776 | class CallFunctionCallDotNode : public FunctionCallDotNode {
|
---|
777 | public:
|
---|
778 | CallFunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
779 | : FunctionCallDotNode(globalData, base, ident, args, divot, startOffset, endOffset)
|
---|
780 | {
|
---|
781 | }
|
---|
782 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
783 | };
|
---|
784 |
|
---|
785 | class ApplyFunctionCallDotNode : public FunctionCallDotNode {
|
---|
786 | public:
|
---|
787 | ApplyFunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
788 | : FunctionCallDotNode(globalData, base, ident, args, divot, startOffset, endOffset)
|
---|
789 | {
|
---|
790 | }
|
---|
791 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
792 | };
|
---|
793 |
|
---|
794 | class PrePostResolveNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
795 | public:
|
---|
796 | PrePostResolveNode(JSGlobalData* globalData, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
797 | : ExpressionNode(globalData, ResultType::numberType()) // could be reusable for pre?
|
---|
798 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
799 | , m_ident(ident)
|
---|
800 | {
|
---|
801 | }
|
---|
802 |
|
---|
803 | protected:
|
---|
804 | Identifier m_ident;
|
---|
805 | };
|
---|
806 |
|
---|
807 | class PostfixResolveNode : public PrePostResolveNode {
|
---|
808 | public:
|
---|
809 | PostfixResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
810 | : PrePostResolveNode(globalData, ident, divot, startOffset, endOffset)
|
---|
811 | , m_operator(oper)
|
---|
812 | {
|
---|
813 | }
|
---|
814 |
|
---|
815 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
816 |
|
---|
817 | private:
|
---|
818 | Operator m_operator;
|
---|
819 | };
|
---|
820 |
|
---|
821 | class PostfixBracketNode : public ExpressionNode, public ThrowableSubExpressionData {
|
---|
822 | public:
|
---|
823 | PostfixBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
824 | : ExpressionNode(globalData)
|
---|
825 | , ThrowableSubExpressionData(divot, startOffset, endOffset)
|
---|
826 | , m_base(base)
|
---|
827 | , m_subscript(subscript)
|
---|
828 | , m_operator(oper)
|
---|
829 | {
|
---|
830 | }
|
---|
831 |
|
---|
832 | virtual ~PostfixBracketNode();
|
---|
833 | virtual void releaseNodes(NodeReleaser&);
|
---|
834 |
|
---|
835 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
836 |
|
---|
837 | private:
|
---|
838 | RefPtr<ExpressionNode> m_base;
|
---|
839 | RefPtr<ExpressionNode> m_subscript;
|
---|
840 | Operator m_operator;
|
---|
841 | };
|
---|
842 |
|
---|
843 | class PostfixDotNode : public ExpressionNode, public ThrowableSubExpressionData {
|
---|
844 | public:
|
---|
845 | PostfixDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
846 | : ExpressionNode(globalData)
|
---|
847 | , ThrowableSubExpressionData(divot, startOffset, endOffset)
|
---|
848 | , m_base(base)
|
---|
849 | , m_ident(ident)
|
---|
850 | , m_operator(oper)
|
---|
851 | {
|
---|
852 | }
|
---|
853 |
|
---|
854 | virtual ~PostfixDotNode();
|
---|
855 | virtual void releaseNodes(NodeReleaser&);
|
---|
856 |
|
---|
857 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
858 |
|
---|
859 | private:
|
---|
860 | RefPtr<ExpressionNode> m_base;
|
---|
861 | Identifier m_ident;
|
---|
862 | Operator m_operator;
|
---|
863 | };
|
---|
864 |
|
---|
865 | class PostfixErrorNode : public ExpressionNode, public ThrowableSubExpressionData {
|
---|
866 | public:
|
---|
867 | PostfixErrorNode(JSGlobalData* globalData, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
868 | : ExpressionNode(globalData)
|
---|
869 | , ThrowableSubExpressionData(divot, startOffset, endOffset)
|
---|
870 | , m_expr(expr)
|
---|
871 | , m_operator(oper)
|
---|
872 | {
|
---|
873 | }
|
---|
874 |
|
---|
875 | virtual ~PostfixErrorNode();
|
---|
876 | virtual void releaseNodes(NodeReleaser&);
|
---|
877 |
|
---|
878 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
879 |
|
---|
880 | private:
|
---|
881 | RefPtr<ExpressionNode> m_expr;
|
---|
882 | Operator m_operator;
|
---|
883 | };
|
---|
884 |
|
---|
885 | class DeleteResolveNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
886 | public:
|
---|
887 | DeleteResolveNode(JSGlobalData* globalData, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
888 | : ExpressionNode(globalData)
|
---|
889 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
890 | , m_ident(ident)
|
---|
891 | {
|
---|
892 | }
|
---|
893 |
|
---|
894 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
895 |
|
---|
896 | private:
|
---|
897 | Identifier m_ident;
|
---|
898 | };
|
---|
899 |
|
---|
900 | class DeleteBracketNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
901 | public:
|
---|
902 | DeleteBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
903 | : ExpressionNode(globalData)
|
---|
904 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
905 | , m_base(base)
|
---|
906 | , m_subscript(subscript)
|
---|
907 | {
|
---|
908 | }
|
---|
909 |
|
---|
910 | virtual ~DeleteBracketNode();
|
---|
911 | virtual void releaseNodes(NodeReleaser&);
|
---|
912 |
|
---|
913 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
914 |
|
---|
915 | private:
|
---|
916 | RefPtr<ExpressionNode> m_base;
|
---|
917 | RefPtr<ExpressionNode> m_subscript;
|
---|
918 | };
|
---|
919 |
|
---|
920 | class DeleteDotNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
921 | public:
|
---|
922 | DeleteDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
923 | : ExpressionNode(globalData)
|
---|
924 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
925 | , m_base(base)
|
---|
926 | , m_ident(ident)
|
---|
927 | {
|
---|
928 | }
|
---|
929 |
|
---|
930 | virtual ~DeleteDotNode();
|
---|
931 | virtual void releaseNodes(NodeReleaser&);
|
---|
932 |
|
---|
933 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
934 |
|
---|
935 | private:
|
---|
936 | RefPtr<ExpressionNode> m_base;
|
---|
937 | Identifier m_ident;
|
---|
938 | };
|
---|
939 |
|
---|
940 | class DeleteValueNode : public ExpressionNode {
|
---|
941 | public:
|
---|
942 | DeleteValueNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
943 | : ExpressionNode(globalData)
|
---|
944 | , m_expr(expr)
|
---|
945 | {
|
---|
946 | }
|
---|
947 |
|
---|
948 | virtual ~DeleteValueNode();
|
---|
949 | virtual void releaseNodes(NodeReleaser&);
|
---|
950 |
|
---|
951 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
952 |
|
---|
953 | private:
|
---|
954 | RefPtr<ExpressionNode> m_expr;
|
---|
955 | };
|
---|
956 |
|
---|
957 | class VoidNode : public ExpressionNode {
|
---|
958 | public:
|
---|
959 | VoidNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
960 | : ExpressionNode(globalData)
|
---|
961 | , m_expr(expr)
|
---|
962 | {
|
---|
963 | }
|
---|
964 |
|
---|
965 | virtual ~VoidNode();
|
---|
966 | virtual void releaseNodes(NodeReleaser&);
|
---|
967 |
|
---|
968 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
969 |
|
---|
970 | private:
|
---|
971 | RefPtr<ExpressionNode> m_expr;
|
---|
972 | };
|
---|
973 |
|
---|
974 | class TypeOfResolveNode : public ExpressionNode {
|
---|
975 | public:
|
---|
976 | TypeOfResolveNode(JSGlobalData* globalData, const Identifier& ident) JSC_FAST_CALL
|
---|
977 | : ExpressionNode(globalData, ResultType::stringType())
|
---|
978 | , m_ident(ident)
|
---|
979 | {
|
---|
980 | }
|
---|
981 |
|
---|
982 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
983 |
|
---|
984 | const Identifier& identifier() const JSC_FAST_CALL { return m_ident; }
|
---|
985 |
|
---|
986 | private:
|
---|
987 | Identifier m_ident;
|
---|
988 | };
|
---|
989 |
|
---|
990 | class TypeOfValueNode : public ExpressionNode {
|
---|
991 | public:
|
---|
992 | TypeOfValueNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
993 | : ExpressionNode(globalData, ResultType::stringType())
|
---|
994 | , m_expr(expr)
|
---|
995 | {
|
---|
996 | }
|
---|
997 |
|
---|
998 | virtual ~TypeOfValueNode();
|
---|
999 | virtual void releaseNodes(NodeReleaser&);
|
---|
1000 |
|
---|
1001 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1002 |
|
---|
1003 | private:
|
---|
1004 | RefPtr<ExpressionNode> m_expr;
|
---|
1005 | };
|
---|
1006 |
|
---|
1007 | class PrefixResolveNode : public PrePostResolveNode {
|
---|
1008 | public:
|
---|
1009 | PrefixResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
1010 | : PrePostResolveNode(globalData, ident, divot, startOffset, endOffset)
|
---|
1011 | , m_operator(oper)
|
---|
1012 | {
|
---|
1013 | }
|
---|
1014 |
|
---|
1015 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1016 |
|
---|
1017 | private:
|
---|
1018 | Operator m_operator;
|
---|
1019 | };
|
---|
1020 |
|
---|
1021 | class PrefixBracketNode : public ExpressionNode, public ThrowablePrefixedSubExpressionData {
|
---|
1022 | public:
|
---|
1023 | PrefixBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
1024 | : ExpressionNode(globalData)
|
---|
1025 | , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset)
|
---|
1026 | , m_base(base)
|
---|
1027 | , m_subscript(subscript)
|
---|
1028 | , m_operator(oper)
|
---|
1029 | {
|
---|
1030 | }
|
---|
1031 |
|
---|
1032 | virtual ~PrefixBracketNode();
|
---|
1033 | virtual void releaseNodes(NodeReleaser&);
|
---|
1034 |
|
---|
1035 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1036 |
|
---|
1037 | private:
|
---|
1038 | RefPtr<ExpressionNode> m_base;
|
---|
1039 | RefPtr<ExpressionNode> m_subscript;
|
---|
1040 | Operator m_operator;
|
---|
1041 | };
|
---|
1042 |
|
---|
1043 | class PrefixDotNode : public ExpressionNode, public ThrowablePrefixedSubExpressionData {
|
---|
1044 | public:
|
---|
1045 | PrefixDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
1046 | : ExpressionNode(globalData)
|
---|
1047 | , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset)
|
---|
1048 | , m_base(base)
|
---|
1049 | , m_ident(ident)
|
---|
1050 | , m_operator(oper)
|
---|
1051 | {
|
---|
1052 | }
|
---|
1053 |
|
---|
1054 | virtual ~PrefixDotNode();
|
---|
1055 | virtual void releaseNodes(NodeReleaser&);
|
---|
1056 |
|
---|
1057 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1058 |
|
---|
1059 | private:
|
---|
1060 | RefPtr<ExpressionNode> m_base;
|
---|
1061 | Identifier m_ident;
|
---|
1062 | Operator m_operator;
|
---|
1063 | };
|
---|
1064 |
|
---|
1065 | class PrefixErrorNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
1066 | public:
|
---|
1067 | PrefixErrorNode(JSGlobalData* globalData, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
1068 | : ExpressionNode(globalData)
|
---|
1069 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
1070 | , m_expr(expr)
|
---|
1071 | , m_operator(oper)
|
---|
1072 | {
|
---|
1073 | }
|
---|
1074 |
|
---|
1075 | virtual ~PrefixErrorNode();
|
---|
1076 | virtual void releaseNodes(NodeReleaser&);
|
---|
1077 |
|
---|
1078 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1079 |
|
---|
1080 | private:
|
---|
1081 | RefPtr<ExpressionNode> m_expr;
|
---|
1082 | Operator m_operator;
|
---|
1083 | };
|
---|
1084 |
|
---|
1085 | class UnaryOpNode : public ExpressionNode {
|
---|
1086 | public:
|
---|
1087 | UnaryOpNode(JSGlobalData* globalData, ExpressionNode* expr)
|
---|
1088 | : ExpressionNode(globalData)
|
---|
1089 | , m_expr(expr)
|
---|
1090 | {
|
---|
1091 | }
|
---|
1092 |
|
---|
1093 | UnaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr)
|
---|
1094 | : ExpressionNode(globalData, type)
|
---|
1095 | , m_expr(expr)
|
---|
1096 | {
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | virtual ~UnaryOpNode();
|
---|
1100 | virtual void releaseNodes(NodeReleaser&);
|
---|
1101 |
|
---|
1102 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1103 | virtual OpcodeID opcodeID() const JSC_FAST_CALL = 0;
|
---|
1104 |
|
---|
1105 | protected:
|
---|
1106 | RefPtr<ExpressionNode> m_expr;
|
---|
1107 | };
|
---|
1108 |
|
---|
1109 | class UnaryPlusNode : public UnaryOpNode {
|
---|
1110 | public:
|
---|
1111 | UnaryPlusNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
1112 | : UnaryOpNode(globalData, ResultType::numberType(), expr)
|
---|
1113 | {
|
---|
1114 | }
|
---|
1115 |
|
---|
1116 | virtual ExpressionNode* stripUnaryPlus() { return m_expr.get(); }
|
---|
1117 |
|
---|
1118 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_to_jsnumber; }
|
---|
1119 | };
|
---|
1120 |
|
---|
1121 | class NegateNode : public UnaryOpNode {
|
---|
1122 | public:
|
---|
1123 | NegateNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
1124 | : UnaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr)
|
---|
1125 | {
|
---|
1126 | }
|
---|
1127 |
|
---|
1128 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_negate; }
|
---|
1129 | };
|
---|
1130 |
|
---|
1131 | class BitwiseNotNode : public UnaryOpNode {
|
---|
1132 | public:
|
---|
1133 | BitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
1134 | : UnaryOpNode(globalData, ResultType::forBitOp(), expr)
|
---|
1135 | {
|
---|
1136 | }
|
---|
1137 |
|
---|
1138 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_bitnot; }
|
---|
1139 | };
|
---|
1140 |
|
---|
1141 | class LogicalNotNode : public UnaryOpNode {
|
---|
1142 | public:
|
---|
1143 | LogicalNotNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
1144 | : UnaryOpNode(globalData, ResultType::booleanType(), expr)
|
---|
1145 | {
|
---|
1146 | }
|
---|
1147 |
|
---|
1148 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_not; }
|
---|
1149 | };
|
---|
1150 |
|
---|
1151 | class BinaryOpNode : public ExpressionNode {
|
---|
1152 | public:
|
---|
1153 | BinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
|
---|
1154 | : ExpressionNode(globalData)
|
---|
1155 | , m_expr1(expr1)
|
---|
1156 | , m_expr2(expr2)
|
---|
1157 | , m_rightHasAssignments(rightHasAssignments)
|
---|
1158 | {
|
---|
1159 | }
|
---|
1160 |
|
---|
1161 | BinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
|
---|
1162 | : ExpressionNode(globalData, type)
|
---|
1163 | , m_expr1(expr1)
|
---|
1164 | , m_expr2(expr2)
|
---|
1165 | , m_rightHasAssignments(rightHasAssignments)
|
---|
1166 | {
|
---|
1167 | }
|
---|
1168 |
|
---|
1169 | virtual ~BinaryOpNode();
|
---|
1170 | virtual void releaseNodes(NodeReleaser&);
|
---|
1171 |
|
---|
1172 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1173 | virtual OpcodeID opcodeID() const JSC_FAST_CALL = 0;
|
---|
1174 |
|
---|
1175 | protected:
|
---|
1176 | RefPtr<ExpressionNode> m_expr1;
|
---|
1177 | RefPtr<ExpressionNode> m_expr2;
|
---|
1178 | bool m_rightHasAssignments;
|
---|
1179 | };
|
---|
1180 |
|
---|
1181 | class ReverseBinaryOpNode : public BinaryOpNode {
|
---|
1182 | public:
|
---|
1183 | ReverseBinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
|
---|
1184 | : BinaryOpNode(globalData, expr1, expr2, rightHasAssignments)
|
---|
1185 | {
|
---|
1186 | }
|
---|
1187 |
|
---|
1188 | ReverseBinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
|
---|
1189 | : BinaryOpNode(globalData, type, expr1, expr2, rightHasAssignments)
|
---|
1190 | {
|
---|
1191 | }
|
---|
1192 |
|
---|
1193 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1194 | };
|
---|
1195 |
|
---|
1196 | class MultNode : public BinaryOpNode {
|
---|
1197 | public:
|
---|
1198 | MultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1199 | : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, rightHasAssignments)
|
---|
1200 | {
|
---|
1201 | }
|
---|
1202 |
|
---|
1203 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_mul; }
|
---|
1204 | };
|
---|
1205 |
|
---|
1206 | class DivNode : public BinaryOpNode {
|
---|
1207 | public:
|
---|
1208 | DivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1209 | : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, rightHasAssignments)
|
---|
1210 | {
|
---|
1211 | }
|
---|
1212 |
|
---|
1213 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_div; }
|
---|
1214 | };
|
---|
1215 |
|
---|
1216 | class ModNode : public BinaryOpNode {
|
---|
1217 | public:
|
---|
1218 | ModNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1219 | : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, rightHasAssignments)
|
---|
1220 | {
|
---|
1221 | }
|
---|
1222 |
|
---|
1223 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_mod; }
|
---|
1224 | };
|
---|
1225 |
|
---|
1226 | class AddNode : public BinaryOpNode {
|
---|
1227 | public:
|
---|
1228 | AddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1229 | : BinaryOpNode(globalData, ResultType::forAdd(expr1->resultDescriptor(), expr2->resultDescriptor()), expr1, expr2, rightHasAssignments)
|
---|
1230 | {
|
---|
1231 | }
|
---|
1232 |
|
---|
1233 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_add; }
|
---|
1234 | };
|
---|
1235 |
|
---|
1236 | class SubNode : public BinaryOpNode {
|
---|
1237 | public:
|
---|
1238 | SubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1239 | : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, rightHasAssignments)
|
---|
1240 | {
|
---|
1241 | }
|
---|
1242 |
|
---|
1243 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_sub; }
|
---|
1244 | };
|
---|
1245 |
|
---|
1246 | class LeftShiftNode : public BinaryOpNode {
|
---|
1247 | public:
|
---|
1248 | LeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1249 | : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, rightHasAssignments)
|
---|
1250 | {
|
---|
1251 | }
|
---|
1252 |
|
---|
1253 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_lshift; }
|
---|
1254 | };
|
---|
1255 |
|
---|
1256 | class RightShiftNode : public BinaryOpNode {
|
---|
1257 | public:
|
---|
1258 | RightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1259 | : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, rightHasAssignments)
|
---|
1260 | {
|
---|
1261 | }
|
---|
1262 |
|
---|
1263 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_rshift; }
|
---|
1264 | };
|
---|
1265 |
|
---|
1266 | class UnsignedRightShiftNode : public BinaryOpNode {
|
---|
1267 | public:
|
---|
1268 | UnsignedRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1269 | : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, rightHasAssignments)
|
---|
1270 | {
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_urshift; }
|
---|
1274 | };
|
---|
1275 |
|
---|
1276 | class LessNode : public BinaryOpNode {
|
---|
1277 | public:
|
---|
1278 | LessNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1279 | : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, rightHasAssignments)
|
---|
1280 | {
|
---|
1281 | }
|
---|
1282 |
|
---|
1283 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_less; }
|
---|
1284 | };
|
---|
1285 |
|
---|
1286 | class GreaterNode : public ReverseBinaryOpNode {
|
---|
1287 | public:
|
---|
1288 | GreaterNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1289 | : ReverseBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, rightHasAssignments)
|
---|
1290 | {
|
---|
1291 | }
|
---|
1292 |
|
---|
1293 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_less; }
|
---|
1294 | };
|
---|
1295 |
|
---|
1296 | class LessEqNode : public BinaryOpNode {
|
---|
1297 | public:
|
---|
1298 | LessEqNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1299 | : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, rightHasAssignments)
|
---|
1300 | {
|
---|
1301 | }
|
---|
1302 |
|
---|
1303 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_lesseq; }
|
---|
1304 | };
|
---|
1305 |
|
---|
1306 | class GreaterEqNode : public ReverseBinaryOpNode {
|
---|
1307 | public:
|
---|
1308 | GreaterEqNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1309 | : ReverseBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, rightHasAssignments)
|
---|
1310 | {
|
---|
1311 | }
|
---|
1312 |
|
---|
1313 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_lesseq; }
|
---|
1314 | };
|
---|
1315 |
|
---|
1316 | class ThrowableBinaryOpNode : public BinaryOpNode, public ThrowableExpressionData {
|
---|
1317 | public:
|
---|
1318 | ThrowableBinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1319 | : BinaryOpNode(globalData, type, expr1, expr2, rightHasAssignments)
|
---|
1320 | {
|
---|
1321 | }
|
---|
1322 | ThrowableBinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1323 | : BinaryOpNode(globalData, expr1, expr2, rightHasAssignments)
|
---|
1324 | {
|
---|
1325 | }
|
---|
1326 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1327 | };
|
---|
1328 |
|
---|
1329 | class InstanceOfNode : public ThrowableBinaryOpNode {
|
---|
1330 | public:
|
---|
1331 | InstanceOfNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1332 | : ThrowableBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, rightHasAssignments)
|
---|
1333 | {
|
---|
1334 | }
|
---|
1335 |
|
---|
1336 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_instanceof; }
|
---|
1337 |
|
---|
1338 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1339 | };
|
---|
1340 |
|
---|
1341 | class InNode : public ThrowableBinaryOpNode {
|
---|
1342 | public:
|
---|
1343 | InNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1344 | : ThrowableBinaryOpNode(globalData, expr1, expr2, rightHasAssignments)
|
---|
1345 | {
|
---|
1346 | }
|
---|
1347 |
|
---|
1348 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_in; }
|
---|
1349 | };
|
---|
1350 |
|
---|
1351 | class EqualNode : public BinaryOpNode {
|
---|
1352 | public:
|
---|
1353 | EqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1354 | : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, rightHasAssignments)
|
---|
1355 | {
|
---|
1356 | }
|
---|
1357 |
|
---|
1358 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1359 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_eq; }
|
---|
1360 | };
|
---|
1361 |
|
---|
1362 | class NotEqualNode : public BinaryOpNode {
|
---|
1363 | public:
|
---|
1364 | NotEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1365 | : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, rightHasAssignments)
|
---|
1366 | {
|
---|
1367 | }
|
---|
1368 |
|
---|
1369 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_neq; }
|
---|
1370 | };
|
---|
1371 |
|
---|
1372 | class StrictEqualNode : public BinaryOpNode {
|
---|
1373 | public:
|
---|
1374 | StrictEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1375 | : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, rightHasAssignments)
|
---|
1376 | {
|
---|
1377 | }
|
---|
1378 |
|
---|
1379 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1380 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_stricteq; }
|
---|
1381 | };
|
---|
1382 |
|
---|
1383 | class NotStrictEqualNode : public BinaryOpNode {
|
---|
1384 | public:
|
---|
1385 | NotStrictEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1386 | : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, rightHasAssignments)
|
---|
1387 | {
|
---|
1388 | }
|
---|
1389 |
|
---|
1390 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_nstricteq; }
|
---|
1391 | };
|
---|
1392 |
|
---|
1393 | class BitAndNode : public BinaryOpNode {
|
---|
1394 | public:
|
---|
1395 | BitAndNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1396 | : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, rightHasAssignments)
|
---|
1397 | {
|
---|
1398 | }
|
---|
1399 |
|
---|
1400 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_bitand; }
|
---|
1401 | };
|
---|
1402 |
|
---|
1403 | class BitOrNode : public BinaryOpNode {
|
---|
1404 | public:
|
---|
1405 | BitOrNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1406 | : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, rightHasAssignments)
|
---|
1407 | {
|
---|
1408 | }
|
---|
1409 |
|
---|
1410 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_bitor; }
|
---|
1411 | };
|
---|
1412 |
|
---|
1413 | class BitXOrNode : public BinaryOpNode {
|
---|
1414 | public:
|
---|
1415 | BitXOrNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1416 | : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, rightHasAssignments)
|
---|
1417 | {
|
---|
1418 | }
|
---|
1419 |
|
---|
1420 | virtual OpcodeID opcodeID() const JSC_FAST_CALL { return op_bitxor; }
|
---|
1421 | };
|
---|
1422 |
|
---|
1423 | /**
|
---|
1424 | * m_expr1 && m_expr2, m_expr1 || m_expr2
|
---|
1425 | */
|
---|
1426 | class LogicalOpNode : public ExpressionNode {
|
---|
1427 | public:
|
---|
1428 | LogicalOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator oper) JSC_FAST_CALL
|
---|
1429 | : ExpressionNode(globalData, ResultType::booleanType())
|
---|
1430 | , m_expr1(expr1)
|
---|
1431 | , m_expr2(expr2)
|
---|
1432 | , m_operator(oper)
|
---|
1433 | {
|
---|
1434 | }
|
---|
1435 |
|
---|
1436 | virtual ~LogicalOpNode();
|
---|
1437 | virtual void releaseNodes(NodeReleaser&);
|
---|
1438 |
|
---|
1439 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1440 |
|
---|
1441 | private:
|
---|
1442 | RefPtr<ExpressionNode> m_expr1;
|
---|
1443 | RefPtr<ExpressionNode> m_expr2;
|
---|
1444 | LogicalOperator m_operator;
|
---|
1445 | };
|
---|
1446 |
|
---|
1447 | /**
|
---|
1448 | * The ternary operator, "m_logical ? m_expr1 : m_expr2"
|
---|
1449 | */
|
---|
1450 | class ConditionalNode : public ExpressionNode {
|
---|
1451 | public:
|
---|
1452 | ConditionalNode(JSGlobalData* globalData, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2) JSC_FAST_CALL
|
---|
1453 | : ExpressionNode(globalData)
|
---|
1454 | , m_logical(logical)
|
---|
1455 | , m_expr1(expr1)
|
---|
1456 | , m_expr2(expr2)
|
---|
1457 | {
|
---|
1458 | }
|
---|
1459 |
|
---|
1460 | virtual ~ConditionalNode();
|
---|
1461 | virtual void releaseNodes(NodeReleaser&);
|
---|
1462 |
|
---|
1463 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1464 |
|
---|
1465 | private:
|
---|
1466 | RefPtr<ExpressionNode> m_logical;
|
---|
1467 | RefPtr<ExpressionNode> m_expr1;
|
---|
1468 | RefPtr<ExpressionNode> m_expr2;
|
---|
1469 | };
|
---|
1470 |
|
---|
1471 | class ReadModifyResolveNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
1472 | public:
|
---|
1473 | ReadModifyResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
1474 | : ExpressionNode(globalData)
|
---|
1475 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
1476 | , m_ident(ident)
|
---|
1477 | , m_right(right)
|
---|
1478 | , m_operator(oper)
|
---|
1479 | , m_rightHasAssignments(rightHasAssignments)
|
---|
1480 | {
|
---|
1481 | }
|
---|
1482 |
|
---|
1483 | virtual ~ReadModifyResolveNode();
|
---|
1484 | virtual void releaseNodes(NodeReleaser&);
|
---|
1485 |
|
---|
1486 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1487 |
|
---|
1488 | private:
|
---|
1489 | Identifier m_ident;
|
---|
1490 | RefPtr<ExpressionNode> m_right;
|
---|
1491 | size_t m_index; // Used by ReadModifyLocalVarNode.
|
---|
1492 | Operator m_operator : 31;
|
---|
1493 | bool m_rightHasAssignments : 1;
|
---|
1494 | };
|
---|
1495 |
|
---|
1496 | class AssignResolveNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
1497 | public:
|
---|
1498 | AssignResolveNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments) JSC_FAST_CALL
|
---|
1499 | : ExpressionNode(globalData)
|
---|
1500 | , m_ident(ident)
|
---|
1501 | , m_right(right)
|
---|
1502 | , m_rightHasAssignments(rightHasAssignments)
|
---|
1503 | {
|
---|
1504 | }
|
---|
1505 |
|
---|
1506 | virtual ~AssignResolveNode();
|
---|
1507 | virtual void releaseNodes(NodeReleaser&);
|
---|
1508 |
|
---|
1509 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1510 |
|
---|
1511 | private:
|
---|
1512 | Identifier m_ident;
|
---|
1513 | RefPtr<ExpressionNode> m_right;
|
---|
1514 | size_t m_index; // Used by ReadModifyLocalVarNode.
|
---|
1515 | bool m_rightHasAssignments;
|
---|
1516 | };
|
---|
1517 |
|
---|
1518 | class ReadModifyBracketNode : public ExpressionNode, public ThrowableSubExpressionData {
|
---|
1519 | public:
|
---|
1520 | ReadModifyBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
1521 | : ExpressionNode(globalData)
|
---|
1522 | , ThrowableSubExpressionData(divot, startOffset, endOffset)
|
---|
1523 | , m_base(base)
|
---|
1524 | , m_subscript(subscript)
|
---|
1525 | , m_right(right)
|
---|
1526 | , m_operator(oper)
|
---|
1527 | , m_subscriptHasAssignments(subscriptHasAssignments)
|
---|
1528 | , m_rightHasAssignments(rightHasAssignments)
|
---|
1529 | {
|
---|
1530 | }
|
---|
1531 |
|
---|
1532 | virtual ~ReadModifyBracketNode();
|
---|
1533 | virtual void releaseNodes(NodeReleaser&);
|
---|
1534 |
|
---|
1535 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1536 |
|
---|
1537 | private:
|
---|
1538 | RefPtr<ExpressionNode> m_base;
|
---|
1539 | RefPtr<ExpressionNode> m_subscript;
|
---|
1540 | RefPtr<ExpressionNode> m_right;
|
---|
1541 | Operator m_operator : 30;
|
---|
1542 | bool m_subscriptHasAssignments : 1;
|
---|
1543 | bool m_rightHasAssignments : 1;
|
---|
1544 | };
|
---|
1545 |
|
---|
1546 | class AssignBracketNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
1547 | public:
|
---|
1548 | AssignBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
1549 | : ExpressionNode(globalData)
|
---|
1550 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
1551 | , m_base(base)
|
---|
1552 | , m_subscript(subscript)
|
---|
1553 | , m_right(right)
|
---|
1554 | , m_subscriptHasAssignments(subscriptHasAssignments)
|
---|
1555 | , m_rightHasAssignments(rightHasAssignments)
|
---|
1556 | {
|
---|
1557 | }
|
---|
1558 |
|
---|
1559 | virtual ~AssignBracketNode();
|
---|
1560 | virtual void releaseNodes(NodeReleaser&);
|
---|
1561 |
|
---|
1562 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1563 |
|
---|
1564 | private:
|
---|
1565 | RefPtr<ExpressionNode> m_base;
|
---|
1566 | RefPtr<ExpressionNode> m_subscript;
|
---|
1567 | RefPtr<ExpressionNode> m_right;
|
---|
1568 | bool m_subscriptHasAssignments : 1;
|
---|
1569 | bool m_rightHasAssignments : 1;
|
---|
1570 | };
|
---|
1571 |
|
---|
1572 | class AssignDotNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
1573 | public:
|
---|
1574 | AssignDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
1575 | : ExpressionNode(globalData)
|
---|
1576 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
1577 | , m_base(base)
|
---|
1578 | , m_ident(ident)
|
---|
1579 | , m_right(right)
|
---|
1580 | , m_rightHasAssignments(rightHasAssignments)
|
---|
1581 | {
|
---|
1582 | }
|
---|
1583 |
|
---|
1584 | virtual ~AssignDotNode();
|
---|
1585 | virtual void releaseNodes(NodeReleaser&);
|
---|
1586 |
|
---|
1587 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1588 |
|
---|
1589 | private:
|
---|
1590 | RefPtr<ExpressionNode> m_base;
|
---|
1591 | Identifier m_ident;
|
---|
1592 | RefPtr<ExpressionNode> m_right;
|
---|
1593 | bool m_rightHasAssignments;
|
---|
1594 | };
|
---|
1595 |
|
---|
1596 | class ReadModifyDotNode : public ExpressionNode, public ThrowableSubExpressionData {
|
---|
1597 | public:
|
---|
1598 | ReadModifyDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
1599 | : ExpressionNode(globalData)
|
---|
1600 | , ThrowableSubExpressionData(divot, startOffset, endOffset)
|
---|
1601 | , m_base(base)
|
---|
1602 | , m_ident(ident)
|
---|
1603 | , m_right(right)
|
---|
1604 | , m_operator(oper)
|
---|
1605 | , m_rightHasAssignments(rightHasAssignments)
|
---|
1606 | {
|
---|
1607 | }
|
---|
1608 |
|
---|
1609 | virtual ~ReadModifyDotNode();
|
---|
1610 | virtual void releaseNodes(NodeReleaser&);
|
---|
1611 |
|
---|
1612 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1613 |
|
---|
1614 | private:
|
---|
1615 | RefPtr<ExpressionNode> m_base;
|
---|
1616 | Identifier m_ident;
|
---|
1617 | RefPtr<ExpressionNode> m_right;
|
---|
1618 | Operator m_operator : 31;
|
---|
1619 | bool m_rightHasAssignments : 1;
|
---|
1620 | };
|
---|
1621 |
|
---|
1622 | class AssignErrorNode : public ExpressionNode, public ThrowableExpressionData {
|
---|
1623 | public:
|
---|
1624 | AssignErrorNode(JSGlobalData* globalData, ExpressionNode* left, Operator oper, ExpressionNode* right, unsigned divot, unsigned startOffset, unsigned endOffset) JSC_FAST_CALL
|
---|
1625 | : ExpressionNode(globalData)
|
---|
1626 | , ThrowableExpressionData(divot, startOffset, endOffset)
|
---|
1627 | , m_left(left)
|
---|
1628 | , m_operator(oper)
|
---|
1629 | , m_right(right)
|
---|
1630 | {
|
---|
1631 | }
|
---|
1632 |
|
---|
1633 | virtual ~AssignErrorNode();
|
---|
1634 | virtual void releaseNodes(NodeReleaser&);
|
---|
1635 |
|
---|
1636 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1637 |
|
---|
1638 | private:
|
---|
1639 | RefPtr<ExpressionNode> m_left;
|
---|
1640 | Operator m_operator;
|
---|
1641 | RefPtr<ExpressionNode> m_right;
|
---|
1642 | };
|
---|
1643 |
|
---|
1644 | class CommaNode : public ExpressionNode {
|
---|
1645 | public:
|
---|
1646 | CommaNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2) JSC_FAST_CALL
|
---|
1647 | : ExpressionNode(globalData)
|
---|
1648 | , m_expr1(expr1)
|
---|
1649 | , m_expr2(expr2)
|
---|
1650 | {
|
---|
1651 | }
|
---|
1652 |
|
---|
1653 | virtual ~CommaNode();
|
---|
1654 | virtual void releaseNodes(NodeReleaser&);
|
---|
1655 |
|
---|
1656 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1657 |
|
---|
1658 | private:
|
---|
1659 | RefPtr<ExpressionNode> m_expr1;
|
---|
1660 | RefPtr<ExpressionNode> m_expr2;
|
---|
1661 | };
|
---|
1662 |
|
---|
1663 | class VarDeclCommaNode : public CommaNode {
|
---|
1664 | public:
|
---|
1665 | VarDeclCommaNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2) JSC_FAST_CALL
|
---|
1666 | : CommaNode(globalData, expr1, expr2)
|
---|
1667 | {
|
---|
1668 | }
|
---|
1669 | };
|
---|
1670 |
|
---|
1671 | class ConstDeclNode : public ExpressionNode {
|
---|
1672 | public:
|
---|
1673 | ConstDeclNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* in) JSC_FAST_CALL;
|
---|
1674 |
|
---|
1675 | virtual ~ConstDeclNode();
|
---|
1676 | virtual void releaseNodes(NodeReleaser&);
|
---|
1677 |
|
---|
1678 | Identifier m_ident;
|
---|
1679 | RefPtr<ConstDeclNode> m_next;
|
---|
1680 | RefPtr<ExpressionNode> m_init;
|
---|
1681 |
|
---|
1682 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1683 | virtual RegisterID* emitCodeSingle(BytecodeGenerator&) JSC_FAST_CALL;
|
---|
1684 | };
|
---|
1685 |
|
---|
1686 | class ConstStatementNode : public StatementNode {
|
---|
1687 | public:
|
---|
1688 | ConstStatementNode(JSGlobalData* globalData, ConstDeclNode* next) JSC_FAST_CALL
|
---|
1689 | : StatementNode(globalData)
|
---|
1690 | , m_next(next)
|
---|
1691 | {
|
---|
1692 | }
|
---|
1693 |
|
---|
1694 | virtual ~ConstStatementNode();
|
---|
1695 | virtual void releaseNodes(NodeReleaser&);
|
---|
1696 |
|
---|
1697 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1698 |
|
---|
1699 | private:
|
---|
1700 | RefPtr<ConstDeclNode> m_next;
|
---|
1701 | };
|
---|
1702 |
|
---|
1703 | typedef Vector<RefPtr<StatementNode> > StatementVector;
|
---|
1704 |
|
---|
1705 | class SourceElements : public ParserRefCounted {
|
---|
1706 | public:
|
---|
1707 | SourceElements(JSGlobalData* globalData) : ParserRefCounted(globalData) {}
|
---|
1708 |
|
---|
1709 | void append(PassRefPtr<StatementNode>);
|
---|
1710 | void releaseContentsIntoVector(StatementVector& destination)
|
---|
1711 | {
|
---|
1712 | ASSERT(destination.isEmpty());
|
---|
1713 | m_statements.swap(destination);
|
---|
1714 | destination.shrinkToFit();
|
---|
1715 | }
|
---|
1716 |
|
---|
1717 | private:
|
---|
1718 | StatementVector m_statements;
|
---|
1719 | };
|
---|
1720 |
|
---|
1721 | class BlockNode : public StatementNode {
|
---|
1722 | public:
|
---|
1723 | BlockNode(JSGlobalData*, SourceElements* children) JSC_FAST_CALL;
|
---|
1724 |
|
---|
1725 | virtual ~BlockNode();
|
---|
1726 | virtual void releaseNodes(NodeReleaser&);
|
---|
1727 |
|
---|
1728 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1729 |
|
---|
1730 | StatementVector& children() { return m_children; }
|
---|
1731 |
|
---|
1732 | virtual bool isBlock() const JSC_FAST_CALL { return true; }
|
---|
1733 |
|
---|
1734 | private:
|
---|
1735 | StatementVector m_children;
|
---|
1736 | };
|
---|
1737 |
|
---|
1738 | class EmptyStatementNode : public StatementNode {
|
---|
1739 | public:
|
---|
1740 | EmptyStatementNode(JSGlobalData* globalData) JSC_FAST_CALL // debug
|
---|
1741 | : StatementNode(globalData)
|
---|
1742 | {
|
---|
1743 | }
|
---|
1744 |
|
---|
1745 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1746 |
|
---|
1747 | virtual bool isEmptyStatement() const JSC_FAST_CALL { return true; }
|
---|
1748 | };
|
---|
1749 |
|
---|
1750 | class DebuggerStatementNode : public StatementNode {
|
---|
1751 | public:
|
---|
1752 | DebuggerStatementNode(JSGlobalData* globalData) JSC_FAST_CALL
|
---|
1753 | : StatementNode(globalData)
|
---|
1754 | {
|
---|
1755 | }
|
---|
1756 |
|
---|
1757 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1758 | };
|
---|
1759 |
|
---|
1760 | class ExprStatementNode : public StatementNode {
|
---|
1761 | public:
|
---|
1762 | ExprStatementNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
1763 | : StatementNode(globalData)
|
---|
1764 | , m_expr(expr)
|
---|
1765 | {
|
---|
1766 | }
|
---|
1767 |
|
---|
1768 | virtual bool isExprStatement() const JSC_FAST_CALL { return true; }
|
---|
1769 |
|
---|
1770 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1771 |
|
---|
1772 | ExpressionNode* expr() const { return m_expr.get(); }
|
---|
1773 |
|
---|
1774 | private:
|
---|
1775 | RefPtr<ExpressionNode> m_expr;
|
---|
1776 | };
|
---|
1777 |
|
---|
1778 | class VarStatementNode : public StatementNode {
|
---|
1779 | public:
|
---|
1780 | VarStatementNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
1781 | : StatementNode(globalData)
|
---|
1782 | , m_expr(expr)
|
---|
1783 | {
|
---|
1784 | }
|
---|
1785 |
|
---|
1786 | virtual ~VarStatementNode();
|
---|
1787 | virtual void releaseNodes(NodeReleaser&);
|
---|
1788 |
|
---|
1789 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1790 |
|
---|
1791 | private:
|
---|
1792 | RefPtr<ExpressionNode> m_expr;
|
---|
1793 | };
|
---|
1794 |
|
---|
1795 | class IfNode : public StatementNode {
|
---|
1796 | public:
|
---|
1797 | IfNode(JSGlobalData* globalData, ExpressionNode* condition, StatementNode* ifBlock) JSC_FAST_CALL
|
---|
1798 | : StatementNode(globalData)
|
---|
1799 | , m_condition(condition)
|
---|
1800 | , m_ifBlock(ifBlock)
|
---|
1801 | {
|
---|
1802 | }
|
---|
1803 |
|
---|
1804 | virtual ~IfNode();
|
---|
1805 | virtual void releaseNodes(NodeReleaser&);
|
---|
1806 |
|
---|
1807 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1808 |
|
---|
1809 | protected:
|
---|
1810 | RefPtr<ExpressionNode> m_condition;
|
---|
1811 | RefPtr<StatementNode> m_ifBlock;
|
---|
1812 | };
|
---|
1813 |
|
---|
1814 | class IfElseNode : public IfNode {
|
---|
1815 | public:
|
---|
1816 | IfElseNode(JSGlobalData* globalData, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock) JSC_FAST_CALL
|
---|
1817 | : IfNode(globalData, condition, ifBlock)
|
---|
1818 | , m_elseBlock(elseBlock)
|
---|
1819 | {
|
---|
1820 | }
|
---|
1821 |
|
---|
1822 | virtual ~IfElseNode();
|
---|
1823 | virtual void releaseNodes(NodeReleaser&);
|
---|
1824 |
|
---|
1825 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1826 |
|
---|
1827 | private:
|
---|
1828 | RefPtr<StatementNode> m_elseBlock;
|
---|
1829 | };
|
---|
1830 |
|
---|
1831 | class DoWhileNode : public StatementNode {
|
---|
1832 | public:
|
---|
1833 | DoWhileNode(JSGlobalData* globalData, StatementNode* statement, ExpressionNode* expr) JSC_FAST_CALL
|
---|
1834 | : StatementNode(globalData)
|
---|
1835 | , m_statement(statement)
|
---|
1836 | , m_expr(expr)
|
---|
1837 | {
|
---|
1838 | }
|
---|
1839 |
|
---|
1840 | virtual ~DoWhileNode();
|
---|
1841 | virtual void releaseNodes(NodeReleaser&);
|
---|
1842 |
|
---|
1843 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1844 |
|
---|
1845 | private:
|
---|
1846 | RefPtr<StatementNode> m_statement;
|
---|
1847 | RefPtr<ExpressionNode> m_expr;
|
---|
1848 | };
|
---|
1849 |
|
---|
1850 | class WhileNode : public StatementNode {
|
---|
1851 | public:
|
---|
1852 | WhileNode(JSGlobalData* globalData, ExpressionNode* expr, StatementNode* statement) JSC_FAST_CALL
|
---|
1853 | : StatementNode(globalData)
|
---|
1854 | , m_expr(expr)
|
---|
1855 | , m_statement(statement)
|
---|
1856 | {
|
---|
1857 | }
|
---|
1858 |
|
---|
1859 | virtual ~WhileNode();
|
---|
1860 | virtual void releaseNodes(NodeReleaser&);
|
---|
1861 |
|
---|
1862 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1863 |
|
---|
1864 | private:
|
---|
1865 | RefPtr<ExpressionNode> m_expr;
|
---|
1866 | RefPtr<StatementNode> m_statement;
|
---|
1867 | };
|
---|
1868 |
|
---|
1869 | class ForNode : public StatementNode {
|
---|
1870 | public:
|
---|
1871 | ForNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode* statement, bool expr1WasVarDecl) JSC_FAST_CALL
|
---|
1872 | : StatementNode(globalData)
|
---|
1873 | , m_expr1(expr1)
|
---|
1874 | , m_expr2(expr2)
|
---|
1875 | , m_expr3(expr3)
|
---|
1876 | , m_statement(statement)
|
---|
1877 | , m_expr1WasVarDecl(expr1 && expr1WasVarDecl)
|
---|
1878 | {
|
---|
1879 | ASSERT(statement);
|
---|
1880 | }
|
---|
1881 |
|
---|
1882 | virtual ~ForNode();
|
---|
1883 | virtual void releaseNodes(NodeReleaser&);
|
---|
1884 |
|
---|
1885 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1886 |
|
---|
1887 | private:
|
---|
1888 | RefPtr<ExpressionNode> m_expr1;
|
---|
1889 | RefPtr<ExpressionNode> m_expr2;
|
---|
1890 | RefPtr<ExpressionNode> m_expr3;
|
---|
1891 | RefPtr<StatementNode> m_statement;
|
---|
1892 | bool m_expr1WasVarDecl;
|
---|
1893 | };
|
---|
1894 |
|
---|
1895 | class ForInNode : public StatementNode, public ThrowableExpressionData {
|
---|
1896 | public:
|
---|
1897 | ForInNode(JSGlobalData*, ExpressionNode*, ExpressionNode*, StatementNode*) JSC_FAST_CALL;
|
---|
1898 | ForInNode(JSGlobalData*, const Identifier&, ExpressionNode*, ExpressionNode*, StatementNode*, int divot, int startOffset, int endOffset) JSC_FAST_CALL;
|
---|
1899 |
|
---|
1900 | virtual ~ForInNode();
|
---|
1901 | virtual void releaseNodes(NodeReleaser&);
|
---|
1902 |
|
---|
1903 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1904 |
|
---|
1905 | private:
|
---|
1906 | Identifier m_ident;
|
---|
1907 | RefPtr<ExpressionNode> m_init;
|
---|
1908 | RefPtr<ExpressionNode> m_lexpr;
|
---|
1909 | RefPtr<ExpressionNode> m_expr;
|
---|
1910 | RefPtr<StatementNode> m_statement;
|
---|
1911 | bool m_identIsVarDecl;
|
---|
1912 | };
|
---|
1913 |
|
---|
1914 | class ContinueNode : public StatementNode, public ThrowableExpressionData {
|
---|
1915 | public:
|
---|
1916 | ContinueNode(JSGlobalData* globalData) JSC_FAST_CALL
|
---|
1917 | : StatementNode(globalData)
|
---|
1918 | {
|
---|
1919 | }
|
---|
1920 |
|
---|
1921 | ContinueNode(JSGlobalData* globalData, const Identifier& ident) JSC_FAST_CALL
|
---|
1922 | : StatementNode(globalData)
|
---|
1923 | , m_ident(ident)
|
---|
1924 | {
|
---|
1925 | }
|
---|
1926 |
|
---|
1927 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1928 |
|
---|
1929 | private:
|
---|
1930 | Identifier m_ident;
|
---|
1931 | };
|
---|
1932 |
|
---|
1933 | class BreakNode : public StatementNode, public ThrowableExpressionData {
|
---|
1934 | public:
|
---|
1935 | BreakNode(JSGlobalData* globalData) JSC_FAST_CALL
|
---|
1936 | : StatementNode(globalData)
|
---|
1937 | {
|
---|
1938 | }
|
---|
1939 |
|
---|
1940 | BreakNode(JSGlobalData* globalData, const Identifier& ident) JSC_FAST_CALL
|
---|
1941 | : StatementNode(globalData)
|
---|
1942 | , m_ident(ident)
|
---|
1943 | {
|
---|
1944 | }
|
---|
1945 |
|
---|
1946 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1947 |
|
---|
1948 | private:
|
---|
1949 | Identifier m_ident;
|
---|
1950 | };
|
---|
1951 |
|
---|
1952 | class ReturnNode : public StatementNode, public ThrowableExpressionData {
|
---|
1953 | public:
|
---|
1954 | ReturnNode(JSGlobalData* globalData, ExpressionNode* value) JSC_FAST_CALL
|
---|
1955 | : StatementNode(globalData)
|
---|
1956 | , m_value(value)
|
---|
1957 | {
|
---|
1958 | }
|
---|
1959 |
|
---|
1960 | virtual ~ReturnNode();
|
---|
1961 | virtual void releaseNodes(NodeReleaser&);
|
---|
1962 |
|
---|
1963 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1964 | virtual bool isReturnNode() const JSC_FAST_CALL { return true; }
|
---|
1965 |
|
---|
1966 | private:
|
---|
1967 | RefPtr<ExpressionNode> m_value;
|
---|
1968 | };
|
---|
1969 |
|
---|
1970 | class WithNode : public StatementNode {
|
---|
1971 | public:
|
---|
1972 | WithNode(JSGlobalData* globalData, ExpressionNode* expr, StatementNode* statement, uint32_t divot, uint32_t expressionLength) JSC_FAST_CALL
|
---|
1973 | : StatementNode(globalData)
|
---|
1974 | , m_expr(expr)
|
---|
1975 | , m_statement(statement)
|
---|
1976 | , m_divot(divot)
|
---|
1977 | , m_expressionLength(expressionLength)
|
---|
1978 | {
|
---|
1979 | }
|
---|
1980 |
|
---|
1981 | virtual ~WithNode();
|
---|
1982 | virtual void releaseNodes(NodeReleaser&);
|
---|
1983 |
|
---|
1984 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
1985 |
|
---|
1986 | private:
|
---|
1987 | RefPtr<ExpressionNode> m_expr;
|
---|
1988 | RefPtr<StatementNode> m_statement;
|
---|
1989 | uint32_t m_divot;
|
---|
1990 | uint32_t m_expressionLength;
|
---|
1991 | };
|
---|
1992 |
|
---|
1993 | class LabelNode : public StatementNode, public ThrowableExpressionData {
|
---|
1994 | public:
|
---|
1995 | LabelNode(JSGlobalData* globalData, const Identifier& name, StatementNode* statement) JSC_FAST_CALL
|
---|
1996 | : StatementNode(globalData)
|
---|
1997 | , m_name(name)
|
---|
1998 | , m_statement(statement)
|
---|
1999 | {
|
---|
2000 | }
|
---|
2001 |
|
---|
2002 | virtual ~LabelNode();
|
---|
2003 | virtual void releaseNodes(NodeReleaser&);
|
---|
2004 |
|
---|
2005 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
2006 |
|
---|
2007 | private:
|
---|
2008 | Identifier m_name;
|
---|
2009 | RefPtr<StatementNode> m_statement;
|
---|
2010 | };
|
---|
2011 |
|
---|
2012 | class ThrowNode : public StatementNode, public ThrowableExpressionData {
|
---|
2013 | public:
|
---|
2014 | ThrowNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
2015 | : StatementNode(globalData)
|
---|
2016 | , m_expr(expr)
|
---|
2017 | {
|
---|
2018 | }
|
---|
2019 |
|
---|
2020 | virtual ~ThrowNode();
|
---|
2021 | virtual void releaseNodes(NodeReleaser&);
|
---|
2022 |
|
---|
2023 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
2024 |
|
---|
2025 | private:
|
---|
2026 | RefPtr<ExpressionNode> m_expr;
|
---|
2027 | };
|
---|
2028 |
|
---|
2029 | class TryNode : public StatementNode {
|
---|
2030 | public:
|
---|
2031 | TryNode(JSGlobalData* globalData, StatementNode* tryBlock, const Identifier& exceptionIdent, bool catchHasEval, StatementNode* catchBlock, StatementNode* finallyBlock) JSC_FAST_CALL
|
---|
2032 | : StatementNode(globalData)
|
---|
2033 | , m_tryBlock(tryBlock)
|
---|
2034 | , m_exceptionIdent(exceptionIdent)
|
---|
2035 | , m_catchBlock(catchBlock)
|
---|
2036 | , m_finallyBlock(finallyBlock)
|
---|
2037 | , m_catchHasEval(catchHasEval)
|
---|
2038 | {
|
---|
2039 | }
|
---|
2040 |
|
---|
2041 | virtual ~TryNode();
|
---|
2042 | virtual void releaseNodes(NodeReleaser&);
|
---|
2043 |
|
---|
2044 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* dst = 0) JSC_FAST_CALL;
|
---|
2045 |
|
---|
2046 | private:
|
---|
2047 | RefPtr<StatementNode> m_tryBlock;
|
---|
2048 | Identifier m_exceptionIdent;
|
---|
2049 | RefPtr<StatementNode> m_catchBlock;
|
---|
2050 | RefPtr<StatementNode> m_finallyBlock;
|
---|
2051 | bool m_catchHasEval;
|
---|
2052 | };
|
---|
2053 |
|
---|
2054 | class ParameterNode : public ParserRefCounted {
|
---|
2055 | public:
|
---|
2056 | ParameterNode(JSGlobalData* globalData, const Identifier& ident) JSC_FAST_CALL
|
---|
2057 | : ParserRefCounted(globalData)
|
---|
2058 | , m_ident(ident)
|
---|
2059 | {
|
---|
2060 | }
|
---|
2061 |
|
---|
2062 | ParameterNode(JSGlobalData* globalData, ParameterNode* l, const Identifier& ident) JSC_FAST_CALL
|
---|
2063 | : ParserRefCounted(globalData)
|
---|
2064 | , m_ident(ident)
|
---|
2065 | {
|
---|
2066 | l->m_next = this;
|
---|
2067 | }
|
---|
2068 |
|
---|
2069 | virtual ~ParameterNode();
|
---|
2070 | virtual void releaseNodes(NodeReleaser&);
|
---|
2071 |
|
---|
2072 | const Identifier& ident() const JSC_FAST_CALL { return m_ident; }
|
---|
2073 | ParameterNode* nextParam() const JSC_FAST_CALL { return m_next.get(); }
|
---|
2074 |
|
---|
2075 | private:
|
---|
2076 | Identifier m_ident;
|
---|
2077 | RefPtr<ParameterNode> m_next;
|
---|
2078 | };
|
---|
2079 |
|
---|
2080 | struct ScopeNodeData {
|
---|
2081 | typedef DeclarationStacks::VarStack VarStack;
|
---|
2082 | typedef DeclarationStacks::FunctionStack FunctionStack;
|
---|
2083 |
|
---|
2084 | ScopeNodeData(SourceElements*, VarStack*, FunctionStack*, int numConstants);
|
---|
2085 |
|
---|
2086 | VarStack m_varStack;
|
---|
2087 | FunctionStack m_functionStack;
|
---|
2088 | int m_numConstants;
|
---|
2089 | StatementVector m_children;
|
---|
2090 |
|
---|
2091 | void mark();
|
---|
2092 | };
|
---|
2093 |
|
---|
2094 | class ScopeNode : public StatementNode {
|
---|
2095 | public:
|
---|
2096 | typedef DeclarationStacks::VarStack VarStack;
|
---|
2097 | typedef DeclarationStacks::FunctionStack FunctionStack;
|
---|
2098 |
|
---|
2099 | ScopeNode(JSGlobalData*) JSC_FAST_CALL;
|
---|
2100 | ScopeNode(JSGlobalData*, const SourceCode&, SourceElements*, VarStack*, FunctionStack*, CodeFeatures, int numConstants) JSC_FAST_CALL;
|
---|
2101 | virtual ~ScopeNode();
|
---|
2102 | virtual void releaseNodes(NodeReleaser&);
|
---|
2103 |
|
---|
2104 | void adoptData(std::auto_ptr<ScopeNodeData> data) { m_data.adopt(data); }
|
---|
2105 | ScopeNodeData* data() const { return m_data.get(); }
|
---|
2106 | void destroyData() { m_data.clear(); }
|
---|
2107 |
|
---|
2108 | const SourceCode& source() const { return m_source; }
|
---|
2109 | const UString& sourceURL() const JSC_FAST_CALL { return m_source.provider()->url(); }
|
---|
2110 | intptr_t sourceID() const { return m_source.provider()->asID(); }
|
---|
2111 |
|
---|
2112 | void setFeatures(CodeFeatures features) { m_features = features; }
|
---|
2113 | CodeFeatures features() { return m_features; }
|
---|
2114 |
|
---|
2115 | bool usesEval() const { return m_features & EvalFeature; }
|
---|
2116 | bool usesArguments() const { return m_features & ArgumentsFeature; }
|
---|
2117 | void setUsesArguments() { m_features |= ArgumentsFeature; }
|
---|
2118 | bool usesThis() const { return m_features & ThisFeature; }
|
---|
2119 | bool needsActivation() const { return m_features & (EvalFeature | ClosureFeature | WithFeature | CatchFeature); }
|
---|
2120 |
|
---|
2121 | VarStack& varStack() { ASSERT(m_data); return m_data->m_varStack; }
|
---|
2122 | FunctionStack& functionStack() { ASSERT(m_data); return m_data->m_functionStack; }
|
---|
2123 |
|
---|
2124 | StatementVector& children() { ASSERT(m_data); return m_data->m_children; }
|
---|
2125 |
|
---|
2126 | int neededConstants()
|
---|
2127 | {
|
---|
2128 | ASSERT(m_data);
|
---|
2129 | // We may need 2 more constants than the count given by the parser,
|
---|
2130 | // because of the various uses of jsUndefined() and jsNull().
|
---|
2131 | return m_data->m_numConstants + 2;
|
---|
2132 | }
|
---|
2133 |
|
---|
2134 | virtual void mark() { }
|
---|
2135 |
|
---|
2136 | protected:
|
---|
2137 | void setSource(const SourceCode& source) { m_source = source; }
|
---|
2138 |
|
---|
2139 | private:
|
---|
2140 | OwnPtr<ScopeNodeData> m_data;
|
---|
2141 | CodeFeatures m_features;
|
---|
2142 | SourceCode m_source;
|
---|
2143 | };
|
---|
2144 |
|
---|
2145 | class ProgramNode : public ScopeNode {
|
---|
2146 | public:
|
---|
2147 | static ProgramNode* create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants) JSC_FAST_CALL;
|
---|
2148 |
|
---|
2149 | ProgramCodeBlock& bytecode(ScopeChainNode* scopeChain) JSC_FAST_CALL
|
---|
2150 | {
|
---|
2151 | if (!m_code)
|
---|
2152 | generateBytecode(scopeChain);
|
---|
2153 | return *m_code;
|
---|
2154 | }
|
---|
2155 |
|
---|
2156 | private:
|
---|
2157 | ProgramNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants) JSC_FAST_CALL;
|
---|
2158 |
|
---|
2159 | void generateBytecode(ScopeChainNode*) JSC_FAST_CALL;
|
---|
2160 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
2161 |
|
---|
2162 | OwnPtr<ProgramCodeBlock> m_code;
|
---|
2163 | };
|
---|
2164 |
|
---|
2165 | class EvalNode : public ScopeNode {
|
---|
2166 | public:
|
---|
2167 | static EvalNode* create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants) JSC_FAST_CALL;
|
---|
2168 |
|
---|
2169 | EvalCodeBlock& bytecode(ScopeChainNode* scopeChain) JSC_FAST_CALL
|
---|
2170 | {
|
---|
2171 | if (!m_code)
|
---|
2172 | generateBytecode(scopeChain);
|
---|
2173 | return *m_code;
|
---|
2174 | }
|
---|
2175 |
|
---|
2176 | EvalCodeBlock& bytecodeForExceptionInfoReparse(ScopeChainNode*, CodeBlock*) JSC_FAST_CALL;
|
---|
2177 |
|
---|
2178 | virtual void mark();
|
---|
2179 |
|
---|
2180 | private:
|
---|
2181 | EvalNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants) JSC_FAST_CALL;
|
---|
2182 |
|
---|
2183 | void generateBytecode(ScopeChainNode*) JSC_FAST_CALL;
|
---|
2184 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
2185 |
|
---|
2186 | OwnPtr<EvalCodeBlock> m_code;
|
---|
2187 | };
|
---|
2188 |
|
---|
2189 | class FunctionBodyNode : public ScopeNode {
|
---|
2190 | friend class JIT;
|
---|
2191 | public:
|
---|
2192 | static FunctionBodyNode* create(JSGlobalData*) JSC_FAST_CALL;
|
---|
2193 | static FunctionBodyNode* create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants) JSC_FAST_CALL;
|
---|
2194 | virtual ~FunctionBodyNode();
|
---|
2195 |
|
---|
2196 | const Identifier* parameters() const JSC_FAST_CALL { return m_parameters; }
|
---|
2197 | size_t parameterCount() const { return m_parameterCount; }
|
---|
2198 | UString paramString() const JSC_FAST_CALL;
|
---|
2199 | Identifier* copyParameters();
|
---|
2200 |
|
---|
2201 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
2202 |
|
---|
2203 | CodeBlock& bytecode(ScopeChainNode* scopeChain) JSC_FAST_CALL
|
---|
2204 | {
|
---|
2205 | ASSERT(scopeChain);
|
---|
2206 | if (!m_code)
|
---|
2207 | generateBytecode(scopeChain);
|
---|
2208 | return *m_code;
|
---|
2209 | }
|
---|
2210 |
|
---|
2211 | CodeBlock& generatedBytecode() JSC_FAST_CALL
|
---|
2212 | {
|
---|
2213 | ASSERT(m_code);
|
---|
2214 | return *m_code;
|
---|
2215 | }
|
---|
2216 |
|
---|
2217 | bool isGenerated() JSC_FAST_CALL
|
---|
2218 | {
|
---|
2219 | return m_code;
|
---|
2220 | }
|
---|
2221 |
|
---|
2222 | virtual void mark();
|
---|
2223 |
|
---|
2224 | void finishParsing(const SourceCode&, ParameterNode*);
|
---|
2225 | void finishParsing(Identifier* parameters, size_t parameterCount);
|
---|
2226 |
|
---|
2227 | UString toSourceString() const JSC_FAST_CALL { return source().toString(); }
|
---|
2228 |
|
---|
2229 | // These objects are ref/deref'd a lot in the scope chain, so this is a faster ref/deref.
|
---|
2230 | // If the virtual machine changes so this doesn't happen as much we can change back.
|
---|
2231 | void ref()
|
---|
2232 | {
|
---|
2233 | if (++m_refCount == 1)
|
---|
2234 | ScopeNode::ref();
|
---|
2235 | }
|
---|
2236 | void deref()
|
---|
2237 | {
|
---|
2238 | ASSERT(m_refCount);
|
---|
2239 | if (!--m_refCount)
|
---|
2240 | ScopeNode::deref();
|
---|
2241 | }
|
---|
2242 |
|
---|
2243 | CodeBlock& bytecodeForExceptionInfoReparse(ScopeChainNode*, CodeBlock*) JSC_FAST_CALL;
|
---|
2244 |
|
---|
2245 | private:
|
---|
2246 | FunctionBodyNode(JSGlobalData*) JSC_FAST_CALL;
|
---|
2247 | FunctionBodyNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants) JSC_FAST_CALL;
|
---|
2248 |
|
---|
2249 | void generateBytecode(ScopeChainNode*) JSC_FAST_CALL;
|
---|
2250 |
|
---|
2251 | Identifier* m_parameters;
|
---|
2252 | size_t m_parameterCount;
|
---|
2253 | OwnPtr<CodeBlock> m_code;
|
---|
2254 | unsigned m_refCount;
|
---|
2255 | };
|
---|
2256 |
|
---|
2257 | class FuncExprNode : public ExpressionNode {
|
---|
2258 | public:
|
---|
2259 | FuncExprNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter = 0) JSC_FAST_CALL
|
---|
2260 | : ExpressionNode(globalData)
|
---|
2261 | , m_ident(ident)
|
---|
2262 | , m_parameter(parameter)
|
---|
2263 | , m_body(body)
|
---|
2264 | {
|
---|
2265 | m_body->finishParsing(source, m_parameter.get());
|
---|
2266 | }
|
---|
2267 |
|
---|
2268 | virtual ~FuncExprNode();
|
---|
2269 | virtual void releaseNodes(NodeReleaser&);
|
---|
2270 |
|
---|
2271 | virtual bool isFuncExprNode() const JSC_FAST_CALL { return true; }
|
---|
2272 |
|
---|
2273 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
2274 | JSFunction* makeFunction(ExecState*, ScopeChainNode*) JSC_FAST_CALL;
|
---|
2275 |
|
---|
2276 | FunctionBodyNode* body() { return m_body.get(); }
|
---|
2277 |
|
---|
2278 | private:
|
---|
2279 | Identifier m_ident;
|
---|
2280 | RefPtr<ParameterNode> m_parameter;
|
---|
2281 | RefPtr<FunctionBodyNode> m_body;
|
---|
2282 | };
|
---|
2283 |
|
---|
2284 | class FuncDeclNode : public StatementNode {
|
---|
2285 | public:
|
---|
2286 | FuncDeclNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter = 0) JSC_FAST_CALL
|
---|
2287 | : StatementNode(globalData)
|
---|
2288 | , m_ident(ident)
|
---|
2289 | , m_parameter(parameter)
|
---|
2290 | , m_body(body)
|
---|
2291 | {
|
---|
2292 | m_body->finishParsing(source, m_parameter.get());
|
---|
2293 | }
|
---|
2294 |
|
---|
2295 | virtual ~FuncDeclNode();
|
---|
2296 | virtual void releaseNodes(NodeReleaser&);
|
---|
2297 |
|
---|
2298 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
2299 |
|
---|
2300 | JSFunction* makeFunction(ExecState*, ScopeChainNode*) JSC_FAST_CALL;
|
---|
2301 |
|
---|
2302 | Identifier m_ident;
|
---|
2303 |
|
---|
2304 | FunctionBodyNode* body() { return m_body.get(); }
|
---|
2305 |
|
---|
2306 | private:
|
---|
2307 | RefPtr<ParameterNode> m_parameter;
|
---|
2308 | RefPtr<FunctionBodyNode> m_body;
|
---|
2309 | };
|
---|
2310 |
|
---|
2311 | class CaseClauseNode : public ParserRefCounted {
|
---|
2312 | public:
|
---|
2313 | CaseClauseNode(JSGlobalData* globalData, ExpressionNode* expr) JSC_FAST_CALL
|
---|
2314 | : ParserRefCounted(globalData)
|
---|
2315 | , m_expr(expr)
|
---|
2316 | {
|
---|
2317 | }
|
---|
2318 |
|
---|
2319 | CaseClauseNode(JSGlobalData* globalData, ExpressionNode* expr, SourceElements* children) JSC_FAST_CALL
|
---|
2320 | : ParserRefCounted(globalData)
|
---|
2321 | , m_expr(expr)
|
---|
2322 | {
|
---|
2323 | if (children)
|
---|
2324 | children->releaseContentsIntoVector(m_children);
|
---|
2325 | }
|
---|
2326 |
|
---|
2327 | virtual ~CaseClauseNode();
|
---|
2328 | virtual void releaseNodes(NodeReleaser&);
|
---|
2329 |
|
---|
2330 | ExpressionNode* expr() const { return m_expr.get(); }
|
---|
2331 | StatementVector& children() { return m_children; }
|
---|
2332 |
|
---|
2333 | private:
|
---|
2334 | RefPtr<ExpressionNode> m_expr;
|
---|
2335 | StatementVector m_children;
|
---|
2336 | };
|
---|
2337 |
|
---|
2338 | class ClauseListNode : public ParserRefCounted {
|
---|
2339 | public:
|
---|
2340 | ClauseListNode(JSGlobalData* globalData, CaseClauseNode* clause) JSC_FAST_CALL
|
---|
2341 | : ParserRefCounted(globalData)
|
---|
2342 | , m_clause(clause)
|
---|
2343 | {
|
---|
2344 | }
|
---|
2345 |
|
---|
2346 | ClauseListNode(JSGlobalData* globalData, ClauseListNode* clauseList, CaseClauseNode* clause) JSC_FAST_CALL
|
---|
2347 | : ParserRefCounted(globalData)
|
---|
2348 | , m_clause(clause)
|
---|
2349 | {
|
---|
2350 | clauseList->m_next = this;
|
---|
2351 | }
|
---|
2352 |
|
---|
2353 | virtual ~ClauseListNode();
|
---|
2354 | virtual void releaseNodes(NodeReleaser&);
|
---|
2355 |
|
---|
2356 | CaseClauseNode* getClause() const JSC_FAST_CALL { return m_clause.get(); }
|
---|
2357 | ClauseListNode* getNext() const JSC_FAST_CALL { return m_next.get(); }
|
---|
2358 |
|
---|
2359 | private:
|
---|
2360 | RefPtr<CaseClauseNode> m_clause;
|
---|
2361 | RefPtr<ClauseListNode> m_next;
|
---|
2362 | };
|
---|
2363 |
|
---|
2364 | class CaseBlockNode : public ParserRefCounted {
|
---|
2365 | public:
|
---|
2366 | CaseBlockNode(JSGlobalData* globalData, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2) JSC_FAST_CALL
|
---|
2367 | : ParserRefCounted(globalData)
|
---|
2368 | , m_list1(list1)
|
---|
2369 | , m_defaultClause(defaultClause)
|
---|
2370 | , m_list2(list2)
|
---|
2371 | {
|
---|
2372 | }
|
---|
2373 |
|
---|
2374 | virtual ~CaseBlockNode();
|
---|
2375 | virtual void releaseNodes(NodeReleaser&);
|
---|
2376 |
|
---|
2377 | RegisterID* emitBytecodeForBlock(BytecodeGenerator&, RegisterID* input, RegisterID* dst = 0) JSC_FAST_CALL;
|
---|
2378 |
|
---|
2379 | private:
|
---|
2380 | SwitchInfo::SwitchType tryOptimizedSwitch(Vector<ExpressionNode*, 8>& literalVector, int32_t& min_num, int32_t& max_num);
|
---|
2381 | RefPtr<ClauseListNode> m_list1;
|
---|
2382 | RefPtr<CaseClauseNode> m_defaultClause;
|
---|
2383 | RefPtr<ClauseListNode> m_list2;
|
---|
2384 | };
|
---|
2385 |
|
---|
2386 | class SwitchNode : public StatementNode {
|
---|
2387 | public:
|
---|
2388 | SwitchNode(JSGlobalData* globalData, ExpressionNode* expr, CaseBlockNode* block) JSC_FAST_CALL
|
---|
2389 | : StatementNode(globalData)
|
---|
2390 | , m_expr(expr)
|
---|
2391 | , m_block(block)
|
---|
2392 | {
|
---|
2393 | }
|
---|
2394 |
|
---|
2395 | virtual ~SwitchNode();
|
---|
2396 | virtual void releaseNodes(NodeReleaser&);
|
---|
2397 |
|
---|
2398 | virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) JSC_FAST_CALL;
|
---|
2399 |
|
---|
2400 | private:
|
---|
2401 | RefPtr<ExpressionNode> m_expr;
|
---|
2402 | RefPtr<CaseBlockNode> m_block;
|
---|
2403 | };
|
---|
2404 |
|
---|
2405 | struct ElementList {
|
---|
2406 | ElementNode* head;
|
---|
2407 | ElementNode* tail;
|
---|
2408 | };
|
---|
2409 |
|
---|
2410 | struct PropertyList {
|
---|
2411 | PropertyListNode* head;
|
---|
2412 | PropertyListNode* tail;
|
---|
2413 | };
|
---|
2414 |
|
---|
2415 | struct ArgumentList {
|
---|
2416 | ArgumentListNode* head;
|
---|
2417 | ArgumentListNode* tail;
|
---|
2418 | };
|
---|
2419 |
|
---|
2420 | struct ConstDeclList {
|
---|
2421 | ConstDeclNode* head;
|
---|
2422 | ConstDeclNode* tail;
|
---|
2423 | };
|
---|
2424 |
|
---|
2425 | struct ParameterList {
|
---|
2426 | ParameterNode* head;
|
---|
2427 | ParameterNode* tail;
|
---|
2428 | };
|
---|
2429 |
|
---|
2430 | struct ClauseList {
|
---|
2431 | ClauseListNode* head;
|
---|
2432 | ClauseListNode* tail;
|
---|
2433 | };
|
---|
2434 |
|
---|
2435 | } // namespace JSC
|
---|
2436 |
|
---|
2437 | #endif // NODES_H_
|
---|