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