]> git.saurik.com Git - apple/javascriptcore.git/blob - kjs/nodes.h
JavaScriptCore-466.1.tar.gz
[apple/javascriptcore.git] / kjs / nodes.h
1 /*
2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
3 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
6 * Copyright (C) 2007 Maks Orlovich
7 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
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 "internal.h"
30 #include "regexp.h"
31 #include "SymbolTable.h"
32 #include <wtf/ListRefPtr.h>
33 #include <wtf/MathExtras.h>
34 #include <wtf/OwnPtr.h>
35 #include <wtf/Vector.h>
36
37 #if PLATFORM(X86) && COMPILER(GCC)
38 #define KJS_FAST_CALL __attribute__((regparm(3)))
39 #else
40 #define KJS_FAST_CALL
41 #endif
42
43 namespace KJS {
44
45 class ConstDeclNode;
46 class FuncDeclNode;
47 class Node;
48 class PropertyListNode;
49 class SourceStream;
50
51 enum Operator {
52 OpEqual,
53 OpPlusEq,
54 OpMinusEq,
55 OpMultEq,
56 OpDivEq,
57 OpPlusPlus,
58 OpMinusMinus,
59 OpAndEq,
60 OpXOrEq,
61 OpOrEq,
62 OpModEq,
63 OpLShift,
64 OpRShift,
65 OpURShift,
66 };
67
68 enum Precedence {
69 PrecPrimary,
70 PrecMember,
71 PrecCall,
72 PrecLeftHandSide,
73 PrecPostfix,
74 PrecUnary,
75 PrecMultiplicitave,
76 PrecAdditive,
77 PrecShift,
78 PrecRelational,
79 PrecEquality,
80 PrecBitwiseAnd,
81 PrecBitwiseXor,
82 PrecBitwiseOr,
83 PrecLogicalAnd,
84 PrecLogicalOr,
85 PrecConditional,
86 PrecAssignment,
87 PrecExpression
88 };
89
90 struct DeclarationStacks {
91 typedef Vector<Node*, 16> NodeStack;
92 enum { IsConstant = 1, HasInitializer = 2 } VarAttrs;
93 typedef Vector<std::pair<Identifier, unsigned>, 16> VarStack;
94 typedef Vector<FuncDeclNode*, 16> FunctionStack;
95
96 DeclarationStacks(ExecState* e, NodeStack& n, VarStack& v, FunctionStack& f)
97 : exec(e)
98 , nodeStack(n)
99 , varStack(v)
100 , functionStack(f)
101 {
102 }
103
104 ExecState* exec;
105 NodeStack& nodeStack;
106 VarStack& varStack;
107 FunctionStack& functionStack;
108 };
109
110 class ParserRefCounted : Noncopyable {
111 protected:
112 ParserRefCounted() KJS_FAST_CALL;
113 ParserRefCounted(PlacementNewAdoptType) KJS_FAST_CALL
114 {
115 }
116
117 public:
118 void ref() KJS_FAST_CALL;
119 void deref() KJS_FAST_CALL;
120 unsigned refcount() KJS_FAST_CALL;
121
122 static void deleteNewObjects() KJS_FAST_CALL;
123
124 virtual ~ParserRefCounted();
125 };
126
127 class Node : public ParserRefCounted {
128 public:
129 typedef DeclarationStacks::NodeStack NodeStack;
130 typedef DeclarationStacks::VarStack VarStack;
131 typedef DeclarationStacks::FunctionStack FunctionStack;
132
133 Node() KJS_FAST_CALL;
134 Node(PlacementNewAdoptType placementAdopt) KJS_FAST_CALL
135 : ParserRefCounted(placementAdopt)
136 {
137 }
138
139 UString toString() const KJS_FAST_CALL;
140 int lineNo() const KJS_FAST_CALL { return m_line; }
141
142 // Serialization.
143 virtual void streamTo(SourceStream&) const KJS_FAST_CALL = 0;
144 virtual Precedence precedence() const = 0;
145 virtual bool needsParensIfLeftmost() const { return false; }
146
147 // Used for iterative, depth-first traversal of the node tree. Does not cross function call boundaries.
148 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL { }
149
150 protected:
151 JSValue* setInterruptedCompletion(ExecState*);
152 Node(JSType) KJS_FAST_CALL; // used by ExpressionNode
153
154 // for use in execute()
155 JSValue* setErrorCompletion(ExecState*, ErrorType, const char* msg) KJS_FAST_CALL;
156 JSValue* setErrorCompletion(ExecState*, ErrorType, const char* msg, const Identifier&) KJS_FAST_CALL;
157
158 // for use in evaluate()
159 JSValue* throwError(ExecState*, ErrorType, const char* msg) KJS_FAST_CALL;
160 JSValue* throwError(ExecState*, ErrorType, const char* msg, const char*) KJS_FAST_CALL;
161 JSValue* throwError(ExecState*, ErrorType, const char* msg, JSValue*, Node*) KJS_FAST_CALL;
162 JSValue* throwError(ExecState*, ErrorType, const char* msg, const Identifier&) KJS_FAST_CALL;
163 JSValue* throwError(ExecState*, ErrorType, const char* msg, JSValue*, const Identifier&) KJS_FAST_CALL;
164 JSValue* throwError(ExecState*, ErrorType, const char* msg, JSValue*, Node*, Node*) KJS_FAST_CALL;
165 JSValue* throwError(ExecState*, ErrorType, const char* msg, JSValue*, Node*, const Identifier&) KJS_FAST_CALL;
166
167 JSValue* throwUndefinedVariableError(ExecState*, const Identifier&) KJS_FAST_CALL;
168
169 void handleException(ExecState*) KJS_FAST_CALL;
170 void handleException(ExecState*, JSValue*) KJS_FAST_CALL;
171
172 // for use in execute()
173 JSValue* rethrowException(ExecState*) KJS_FAST_CALL;
174
175 int m_line : 28;
176 unsigned m_expectedReturnType : 3; // JSType
177 };
178
179 class ExpressionNode : public Node {
180 public:
181 ExpressionNode() KJS_FAST_CALL : Node() {}
182 ExpressionNode(JSType expectedReturn) KJS_FAST_CALL
183 : Node(expectedReturn)
184 {
185 }
186
187 // Special constructor for cases where we overwrite an object in place.
188 ExpressionNode(PlacementNewAdoptType) KJS_FAST_CALL
189 : Node(PlacementNewAdopt)
190 {
191 }
192
193 virtual bool isNumber() const KJS_FAST_CALL { return false; }
194 virtual bool isLocation() const KJS_FAST_CALL { return false; }
195 virtual bool isResolveNode() const KJS_FAST_CALL { return false; }
196 virtual bool isBracketAccessorNode() const KJS_FAST_CALL { return false; }
197 virtual bool isDotAccessorNode() const KJS_FAST_CALL { return false; }
198
199 JSType expectedReturnType() const KJS_FAST_CALL { return static_cast<JSType>(m_expectedReturnType); }
200
201 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL = 0;
202 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
203 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
204 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
205 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
206
207 // Used to optimize those nodes that do extra work when returning a result, even if the result has no semantic relevance
208 virtual void optimizeForUnnecessaryResult() { }
209 };
210
211 class StatementNode : public Node {
212 public:
213 StatementNode() KJS_FAST_CALL;
214 void setLoc(int line0, int line1) KJS_FAST_CALL;
215 int firstLine() const KJS_FAST_CALL { return lineNo(); }
216 int lastLine() const KJS_FAST_CALL { return m_lastLine; }
217 virtual JSValue* execute(ExecState *exec) KJS_FAST_CALL = 0;
218 void pushLabel(const Identifier& ident) KJS_FAST_CALL { m_labelStack.push(ident); }
219 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
220 virtual bool isEmptyStatement() const KJS_FAST_CALL { return false; }
221
222 protected:
223 LabelStack m_labelStack;
224
225 private:
226 int m_lastLine;
227 };
228
229 class NullNode : public ExpressionNode {
230 public:
231 NullNode() KJS_FAST_CALL : ExpressionNode(NullType) {}
232 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
233 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
234 virtual Precedence precedence() const { return PrecPrimary; }
235 };
236
237 class FalseNode : public ExpressionNode {
238 public:
239 FalseNode() KJS_FAST_CALL
240 : ExpressionNode(BooleanType)
241 {
242 }
243
244 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
245 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL { return false; }
246 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
247 virtual Precedence precedence() const { return PrecPrimary; }
248 };
249
250 class TrueNode : public ExpressionNode {
251 public:
252 TrueNode() KJS_FAST_CALL
253 : ExpressionNode(BooleanType)
254 {
255 }
256
257 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
258 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL { return true; }
259 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
260 virtual Precedence precedence() const { return PrecPrimary; }
261 };
262
263 class PlaceholderTrueNode : public TrueNode {
264 public:
265 // Like TrueNode, but does not serialize as "true".
266 PlaceholderTrueNode() KJS_FAST_CALL
267 : TrueNode()
268 {
269 }
270
271 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
272 };
273
274 class NumberNode : public ExpressionNode {
275 public:
276 NumberNode(double v) KJS_FAST_CALL
277 : ExpressionNode(NumberType)
278 , m_double(v)
279 {
280 }
281
282 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
283 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
284 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
285 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
286 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
287 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
288 virtual Precedence precedence() const { return signbit(m_double) ? PrecUnary : PrecPrimary; }
289
290 virtual bool isNumber() const KJS_FAST_CALL { return true; }
291 double value() const KJS_FAST_CALL { return m_double; }
292 virtual void setValue(double d) KJS_FAST_CALL { m_double = d; }
293
294 protected:
295 double m_double;
296 };
297
298 class ImmediateNumberNode : public NumberNode {
299 public:
300 ImmediateNumberNode(JSValue* v, double d) KJS_FAST_CALL
301 : NumberNode(d)
302 , m_value(v)
303 {
304 ASSERT(v == JSImmediate::from(d));
305 }
306
307 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
308 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
309 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
310
311 virtual void setValue(double d) KJS_FAST_CALL { m_double = d; m_value = JSImmediate::from(d); ASSERT(m_value); }
312
313 private:
314 JSValue* m_value; // This is never a JSCell, only JSImmediate, thus no ProtectedPtr
315 };
316
317 class StringNode : public ExpressionNode {
318 public:
319 StringNode(const UString* v) KJS_FAST_CALL
320 : ExpressionNode(StringType)
321 , m_value(*v)
322 {
323 }
324
325 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
326 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
327 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
328 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
329 virtual Precedence precedence() const { return PrecPrimary; }
330
331 private:
332 UString m_value;
333 };
334
335 class RegExpNode : public ExpressionNode {
336 public:
337 RegExpNode(const UString& pattern, const UString& flags) KJS_FAST_CALL
338 : m_regExp(new RegExp(pattern, flags))
339 {
340 }
341
342 JSValue* evaluate(ExecState*) KJS_FAST_CALL;
343 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
344 virtual Precedence precedence() const { return PrecPrimary; }
345
346 private:
347 RefPtr<RegExp> m_regExp;
348 };
349
350 class ThisNode : public ExpressionNode {
351 public:
352 ThisNode() KJS_FAST_CALL
353 {
354 }
355
356 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
357 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
358 virtual Precedence precedence() const { return PrecPrimary; }
359 };
360
361 class ResolveNode : public ExpressionNode {
362 public:
363 ResolveNode(const Identifier& ident) KJS_FAST_CALL
364 : m_ident(ident)
365 {
366 }
367
368 // Special constructor for cases where we overwrite an object in place.
369 ResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
370 : ExpressionNode(PlacementNewAdopt)
371 , m_ident(PlacementNewAdopt)
372 {
373 }
374
375 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
376
377 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
378 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
379 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
380 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
381 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
382 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
383 virtual Precedence precedence() const { return PrecPrimary; }
384
385 virtual bool isLocation() const KJS_FAST_CALL { return true; }
386 virtual bool isResolveNode() const KJS_FAST_CALL { return true; }
387 const Identifier& identifier() const KJS_FAST_CALL { return m_ident; }
388
389 protected:
390 ALWAYS_INLINE JSValue* inlineEvaluate(ExecState*);
391 Identifier m_ident;
392 size_t m_index; // Used by LocalVarAccessNode.
393 };
394
395 class LocalVarAccessNode : public ResolveNode {
396 public:
397 // Overwrites a ResolveNode in place.
398 LocalVarAccessNode(size_t i) KJS_FAST_CALL
399 : ResolveNode(PlacementNewAdopt)
400 {
401 ASSERT(i != missingSymbolMarker());
402 m_index = i;
403 }
404
405 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
406 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
407 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
408 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
409 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
410
411 private:
412 ALWAYS_INLINE JSValue* inlineEvaluate(ExecState*);
413 };
414
415 class ElementNode : public Node {
416 public:
417 ElementNode(int elision, ExpressionNode* node) KJS_FAST_CALL
418 : m_elision(elision)
419 , m_node(node)
420 {
421 }
422
423 ElementNode(ElementNode* l, int elision, ExpressionNode* node) KJS_FAST_CALL
424 : m_elision(elision)
425 , m_node(node)
426 {
427 l->m_next = this;
428 }
429
430 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
431 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
432 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
433
434 PassRefPtr<ElementNode> releaseNext() KJS_FAST_CALL { return m_next.release(); }
435
436 JSValue* evaluate(ExecState*) KJS_FAST_CALL;
437
438 private:
439 friend class ArrayNode;
440 ListRefPtr<ElementNode> m_next;
441 int m_elision;
442 RefPtr<ExpressionNode> m_node;
443 };
444
445 class ArrayNode : public ExpressionNode {
446 public:
447 ArrayNode(int elision) KJS_FAST_CALL
448 : m_elision(elision)
449 , m_optional(true)
450 {
451 }
452
453 ArrayNode(ElementNode* element) KJS_FAST_CALL
454 : m_element(element)
455 , m_elision(0)
456 , m_optional(false)
457 {
458 }
459
460 ArrayNode(int elision, ElementNode* element) KJS_FAST_CALL
461 : m_element(element)
462 , m_elision(elision)
463 , m_optional(true)
464 {
465 }
466
467 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
468 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
469 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
470 virtual Precedence precedence() const { return PrecPrimary; }
471
472 private:
473 RefPtr<ElementNode> m_element;
474 int m_elision;
475 bool m_optional;
476 };
477
478 class PropertyNode : public Node {
479 public:
480 enum Type { Constant, Getter, Setter };
481
482 PropertyNode(const Identifier& name, ExpressionNode* assign, Type type) KJS_FAST_CALL
483 : m_name(name)
484 , m_assign(assign)
485 , m_type(type)
486 {
487 }
488
489 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
490 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
491 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
492
493 JSValue* evaluate(ExecState*) KJS_FAST_CALL;
494 const Identifier& name() const { return m_name; }
495
496 private:
497 friend class PropertyListNode;
498 Identifier m_name;
499 RefPtr<ExpressionNode> m_assign;
500 Type m_type;
501 };
502
503 class PropertyListNode : public Node {
504 public:
505 PropertyListNode(PropertyNode* node) KJS_FAST_CALL
506 : m_node(node)
507 {
508 }
509
510 PropertyListNode(PropertyNode* node, PropertyListNode* list) KJS_FAST_CALL
511 : m_node(node)
512 {
513 list->m_next = this;
514 }
515
516 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
517 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
518 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
519
520 JSValue* evaluate(ExecState*) KJS_FAST_CALL;
521 PassRefPtr<PropertyListNode> releaseNext() KJS_FAST_CALL { return m_next.release(); }
522
523 private:
524 friend class ObjectLiteralNode;
525 RefPtr<PropertyNode> m_node;
526 ListRefPtr<PropertyListNode> m_next;
527 };
528
529 class ObjectLiteralNode : public ExpressionNode {
530 public:
531 ObjectLiteralNode() KJS_FAST_CALL
532 {
533 }
534
535 ObjectLiteralNode(PropertyListNode* list) KJS_FAST_CALL
536 : m_list(list)
537 {
538 }
539
540 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
541 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
542 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
543 virtual Precedence precedence() const { return PrecPrimary; }
544 virtual bool needsParensIfLeftmost() const { return true; }
545
546 private:
547 RefPtr<PropertyListNode> m_list;
548 };
549
550 class BracketAccessorNode : public ExpressionNode {
551 public:
552 BracketAccessorNode(ExpressionNode* base, ExpressionNode* subscript) KJS_FAST_CALL
553 : m_base(base)
554 , m_subscript(subscript)
555 {
556 }
557
558 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
559 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
560 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
561 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
562 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
563 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
564 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
565 virtual Precedence precedence() const { return PrecMember; }
566
567 virtual bool isLocation() const KJS_FAST_CALL { return true; }
568 virtual bool isBracketAccessorNode() const KJS_FAST_CALL { return true; }
569 ExpressionNode* base() KJS_FAST_CALL { return m_base.get(); }
570 ExpressionNode* subscript() KJS_FAST_CALL { return m_subscript.get(); }
571
572 private:
573 ALWAYS_INLINE JSValue* inlineEvaluate(ExecState*);
574
575 RefPtr<ExpressionNode> m_base;
576 RefPtr<ExpressionNode> m_subscript;
577 };
578
579 class DotAccessorNode : public ExpressionNode {
580 public:
581 DotAccessorNode(ExpressionNode* base, const Identifier& ident) KJS_FAST_CALL
582 : m_base(base)
583 , m_ident(ident)
584 {
585 }
586
587 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
588 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
589 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
590 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
591 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
592 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
593 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
594 virtual Precedence precedence() const { return PrecMember; }
595
596 virtual bool isLocation() const KJS_FAST_CALL { return true; }
597 virtual bool isDotAccessorNode() const KJS_FAST_CALL { return true; }
598 ExpressionNode* base() const KJS_FAST_CALL { return m_base.get(); }
599 const Identifier& identifier() const KJS_FAST_CALL { return m_ident; }
600
601 private:
602 ALWAYS_INLINE JSValue* inlineEvaluate(ExecState*);
603
604 RefPtr<ExpressionNode> m_base;
605 Identifier m_ident;
606 };
607
608 class ArgumentListNode : public Node {
609 public:
610 ArgumentListNode(ExpressionNode* expr) KJS_FAST_CALL
611 : m_expr(expr)
612 {
613 }
614
615 ArgumentListNode(ArgumentListNode* listNode, ExpressionNode* expr) KJS_FAST_CALL
616 : m_expr(expr)
617 {
618 listNode->m_next = this;
619 }
620
621 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
622 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
623 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
624
625 void evaluateList(ExecState*, List&) KJS_FAST_CALL;
626 PassRefPtr<ArgumentListNode> releaseNext() KJS_FAST_CALL { return m_next.release(); }
627
628 private:
629 friend class ArgumentsNode;
630 ListRefPtr<ArgumentListNode> m_next;
631 RefPtr<ExpressionNode> m_expr;
632 };
633
634 class ArgumentsNode : public Node {
635 public:
636 ArgumentsNode() KJS_FAST_CALL
637 {
638 }
639
640 ArgumentsNode(ArgumentListNode* listNode) KJS_FAST_CALL
641 : m_listNode(listNode)
642 {
643 }
644
645 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
646 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
647 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
648
649 void evaluateList(ExecState* exec, List& list) KJS_FAST_CALL { if (m_listNode) m_listNode->evaluateList(exec, list); }
650
651 private:
652 RefPtr<ArgumentListNode> m_listNode;
653 };
654
655 class NewExprNode : public ExpressionNode {
656 public:
657 NewExprNode(ExpressionNode* expr) KJS_FAST_CALL
658 : m_expr(expr)
659 {
660 }
661
662 NewExprNode(ExpressionNode* expr, ArgumentsNode* args) KJS_FAST_CALL
663 : m_expr(expr)
664 , m_args(args)
665 {
666 }
667
668 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
669 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
670 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
671 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
672 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
673 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
674 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
675 virtual Precedence precedence() const { return PrecLeftHandSide; }
676
677 private:
678 ALWAYS_INLINE JSValue* inlineEvaluate(ExecState*);
679
680 RefPtr<ExpressionNode> m_expr;
681 RefPtr<ArgumentsNode> m_args;
682 };
683
684 class FunctionCallValueNode : public ExpressionNode {
685 public:
686 FunctionCallValueNode(ExpressionNode* expr, ArgumentsNode* args) KJS_FAST_CALL
687 : m_expr(expr)
688 , m_args(args)
689 {
690 }
691
692 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
693 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
694 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
695 virtual Precedence precedence() const { return PrecCall; }
696
697 private:
698 RefPtr<ExpressionNode> m_expr;
699 RefPtr<ArgumentsNode> m_args;
700 };
701
702 class FunctionCallResolveNode : public ExpressionNode {
703 public:
704 FunctionCallResolveNode(const Identifier& ident, ArgumentsNode* args) KJS_FAST_CALL
705 : m_ident(ident)
706 , m_args(args)
707 {
708 }
709
710 FunctionCallResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
711 : ExpressionNode(PlacementNewAdopt)
712 , m_ident(PlacementNewAdopt)
713 , m_args(PlacementNewAdopt)
714 {
715 }
716
717 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
718 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
719 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
720 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
721 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
722 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
723 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
724 virtual Precedence precedence() const { return PrecCall; }
725
726 protected:
727 ALWAYS_INLINE JSValue* inlineEvaluate(ExecState*);
728
729 Identifier m_ident;
730 RefPtr<ArgumentsNode> m_args;
731 size_t m_index; // Used by LocalVarFunctionCallNode.
732 };
733
734 class LocalVarFunctionCallNode : public FunctionCallResolveNode {
735 public:
736 LocalVarFunctionCallNode(size_t i) KJS_FAST_CALL
737 : FunctionCallResolveNode(PlacementNewAdopt)
738 {
739 ASSERT(i != missingSymbolMarker());
740 m_index = i;
741 }
742
743 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
744 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
745 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
746 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
747 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
748
749 private:
750 ALWAYS_INLINE JSValue* inlineEvaluate(ExecState*);
751 };
752
753 class FunctionCallBracketNode : public ExpressionNode {
754 public:
755 FunctionCallBracketNode(ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode* args) KJS_FAST_CALL
756 : m_base(base)
757 , m_subscript(subscript)
758 , m_args(args)
759 {
760 }
761
762 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
763 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
764 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
765 virtual Precedence precedence() const { return PrecCall; }
766
767 protected:
768 RefPtr<ExpressionNode> m_base;
769 RefPtr<ExpressionNode> m_subscript;
770 RefPtr<ArgumentsNode> m_args;
771 };
772
773 class FunctionCallDotNode : public ExpressionNode {
774 public:
775 FunctionCallDotNode(ExpressionNode* base, const Identifier& ident, ArgumentsNode* args) KJS_FAST_CALL
776 : m_base(base)
777 , m_ident(ident)
778 , m_args(args)
779 {
780 }
781
782 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
783 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
784 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
785 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
786 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
787 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
788 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
789 virtual Precedence precedence() const { return PrecCall; }
790
791 private:
792 ALWAYS_INLINE JSValue* inlineEvaluate(ExecState*);
793
794 RefPtr<ExpressionNode> m_base;
795 Identifier m_ident;
796 RefPtr<ArgumentsNode> m_args;
797 };
798
799 class PrePostResolveNode : public ExpressionNode {
800 public:
801 PrePostResolveNode(const Identifier& ident) KJS_FAST_CALL
802 : ExpressionNode(NumberType)
803 , m_ident(ident)
804 {
805 }
806
807 PrePostResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
808 : ExpressionNode(PlacementNewAdopt)
809 , m_ident(PlacementNewAdopt)
810 {
811 }
812
813 protected:
814 Identifier m_ident;
815 size_t m_index; // Used by LocalVarPostfixNode.
816 };
817
818 class PostIncResolveNode : public PrePostResolveNode {
819 public:
820 PostIncResolveNode(const Identifier& ident) KJS_FAST_CALL
821 : PrePostResolveNode(ident)
822 {
823 }
824
825 PostIncResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
826 : PrePostResolveNode(PlacementNewAdopt)
827 {
828 }
829
830 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
831 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
832 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
833 virtual Precedence precedence() const { return PrecPostfix; }
834 virtual void optimizeForUnnecessaryResult();
835 };
836
837 class PostIncLocalVarNode : public PostIncResolveNode {
838 public:
839 PostIncLocalVarNode(size_t i) KJS_FAST_CALL
840 : PostIncResolveNode(PlacementNewAdopt)
841 {
842 ASSERT(i != missingSymbolMarker());
843 m_index = i;
844 }
845
846 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
847 virtual void optimizeForUnnecessaryResult();
848 };
849
850 class PostIncConstNode : public PostIncResolveNode {
851 public:
852 PostIncConstNode(size_t i) KJS_FAST_CALL
853 : PostIncResolveNode(PlacementNewAdopt)
854 {
855 ASSERT(i != missingSymbolMarker());
856 m_index = i;
857 }
858
859 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
860 };
861
862 class PostDecResolveNode : public PrePostResolveNode {
863 public:
864 PostDecResolveNode(const Identifier& ident) KJS_FAST_CALL
865 : PrePostResolveNode(ident)
866 {
867 }
868
869 PostDecResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
870 : PrePostResolveNode(PlacementNewAdopt)
871 {
872 }
873
874 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
875 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
876 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
877 virtual Precedence precedence() const { return PrecPostfix; }
878 virtual void optimizeForUnnecessaryResult();
879 };
880
881 class PostDecLocalVarNode : public PostDecResolveNode {
882 public:
883 PostDecLocalVarNode(size_t i) KJS_FAST_CALL
884 : PostDecResolveNode(PlacementNewAdopt)
885 {
886 ASSERT(i != missingSymbolMarker());
887 m_index = i;
888 }
889
890 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
891 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
892 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
893 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
894 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
895 virtual void optimizeForUnnecessaryResult();
896
897 private:
898 ALWAYS_INLINE double inlineEvaluateToNumber(ExecState*);
899 };
900
901 class PostDecConstNode : public PostDecResolveNode {
902 public:
903 PostDecConstNode(size_t i) KJS_FAST_CALL
904 : PostDecResolveNode(PlacementNewAdopt)
905 {
906 ASSERT(i != missingSymbolMarker());
907 m_index = i;
908 }
909
910 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
911 };
912
913 class PostfixBracketNode : public ExpressionNode {
914 public:
915 PostfixBracketNode(ExpressionNode* base, ExpressionNode* subscript) KJS_FAST_CALL
916 : m_base(base)
917 , m_subscript(subscript)
918 {
919 }
920
921 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
922 virtual Precedence precedence() const { return PrecPostfix; }
923
924 protected:
925 RefPtr<ExpressionNode> m_base;
926 RefPtr<ExpressionNode> m_subscript;
927 };
928
929 class PostIncBracketNode : public PostfixBracketNode {
930 public:
931 PostIncBracketNode(ExpressionNode* base, ExpressionNode* subscript) KJS_FAST_CALL
932 : PostfixBracketNode(base, subscript)
933 {
934 }
935
936 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
937 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
938 };
939
940 class PostDecBracketNode : public PostfixBracketNode {
941 public:
942 PostDecBracketNode(ExpressionNode* base, ExpressionNode* subscript) KJS_FAST_CALL
943 : PostfixBracketNode(base, subscript)
944 {
945 }
946
947 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
948 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
949 };
950
951 class PostfixDotNode : public ExpressionNode {
952 public:
953 PostfixDotNode(ExpressionNode* base, const Identifier& ident) KJS_FAST_CALL
954 : m_base(base)
955 , m_ident(ident)
956 {
957 }
958
959 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
960 virtual Precedence precedence() const { return PrecPostfix; }
961
962 protected:
963 RefPtr<ExpressionNode> m_base;
964 Identifier m_ident;
965 };
966
967 class PostIncDotNode : public PostfixDotNode {
968 public:
969 PostIncDotNode(ExpressionNode* base, const Identifier& ident) KJS_FAST_CALL
970 : PostfixDotNode(base, ident)
971 {
972 }
973
974 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
975 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
976 };
977
978 class PostDecDotNode : public PostfixDotNode {
979 public:
980 PostDecDotNode(ExpressionNode* base, const Identifier& ident) KJS_FAST_CALL
981 : PostfixDotNode(base, ident)
982 {
983 }
984
985 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
986 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
987 };
988
989 class PostfixErrorNode : public ExpressionNode {
990 public:
991 PostfixErrorNode(ExpressionNode* expr, Operator oper) KJS_FAST_CALL
992 : m_expr(expr)
993 , m_operator(oper)
994 {
995 }
996
997 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
998 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
999 virtual Precedence precedence() const { return PrecPostfix; }
1000
1001 private:
1002 RefPtr<ExpressionNode> m_expr;
1003 Operator m_operator;
1004 };
1005
1006 class DeleteResolveNode : public ExpressionNode {
1007 public:
1008 DeleteResolveNode(const Identifier& ident) KJS_FAST_CALL
1009 : m_ident(ident)
1010 {
1011 }
1012
1013 DeleteResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
1014 : ExpressionNode(PlacementNewAdopt)
1015 , m_ident(PlacementNewAdopt)
1016 {
1017 }
1018
1019 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1020 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1021 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1022 virtual Precedence precedence() const { return PrecUnary; }
1023
1024 private:
1025 Identifier m_ident;
1026 };
1027
1028 class LocalVarDeleteNode : public DeleteResolveNode {
1029 public:
1030 LocalVarDeleteNode() KJS_FAST_CALL
1031 : DeleteResolveNode(PlacementNewAdopt)
1032 {
1033 }
1034
1035 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1036 };
1037
1038 class DeleteBracketNode : public ExpressionNode {
1039 public:
1040 DeleteBracketNode(ExpressionNode* base, ExpressionNode* subscript) KJS_FAST_CALL
1041 : m_base(base)
1042 , m_subscript(subscript)
1043 {
1044 }
1045
1046 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1047 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1048 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1049 virtual Precedence precedence() const { return PrecUnary; }
1050
1051 private:
1052 RefPtr<ExpressionNode> m_base;
1053 RefPtr<ExpressionNode> m_subscript;
1054 };
1055
1056 class DeleteDotNode : public ExpressionNode {
1057 public:
1058 DeleteDotNode(ExpressionNode* base, const Identifier& ident) KJS_FAST_CALL
1059 : m_base(base)
1060 , m_ident(ident)
1061 {
1062 }
1063
1064 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1065 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1066 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1067 virtual Precedence precedence() const { return PrecUnary; }
1068
1069 private:
1070 RefPtr<ExpressionNode> m_base;
1071 Identifier m_ident;
1072 };
1073
1074 class DeleteValueNode : public ExpressionNode {
1075 public:
1076 DeleteValueNode(ExpressionNode* expr) KJS_FAST_CALL
1077 : m_expr(expr)
1078 {
1079 }
1080
1081 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1082 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1083 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1084 virtual Precedence precedence() const { return PrecUnary; }
1085
1086 private:
1087 RefPtr<ExpressionNode> m_expr;
1088 };
1089
1090 class VoidNode : public ExpressionNode {
1091 public:
1092 VoidNode(ExpressionNode* expr) KJS_FAST_CALL
1093 : m_expr(expr)
1094 {
1095 }
1096
1097 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1098 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1099 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1100 virtual Precedence precedence() const { return PrecUnary; }
1101
1102 private:
1103 RefPtr<ExpressionNode> m_expr;
1104 };
1105
1106 class TypeOfResolveNode : public ExpressionNode {
1107 public:
1108 TypeOfResolveNode(const Identifier& ident) KJS_FAST_CALL
1109 : ExpressionNode(StringType)
1110 , m_ident(ident)
1111 {
1112 }
1113
1114 TypeOfResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
1115 : ExpressionNode(PlacementNewAdopt)
1116 , m_ident(PlacementNewAdopt)
1117 {
1118 m_expectedReturnType = StringType;
1119 }
1120
1121 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1122
1123 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1124 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1125 virtual Precedence precedence() const { return PrecUnary; }
1126
1127 const Identifier& identifier() const KJS_FAST_CALL { return m_ident; }
1128
1129 protected:
1130 Identifier m_ident;
1131 size_t m_index; // Used by LocalTypeOfNode.
1132 };
1133
1134 class LocalVarTypeOfNode : public TypeOfResolveNode {
1135 public:
1136 LocalVarTypeOfNode(size_t i) KJS_FAST_CALL
1137 : TypeOfResolveNode(PlacementNewAdopt)
1138 {
1139 m_expectedReturnType = StringType;
1140 ASSERT(i != missingSymbolMarker());
1141 m_index = i;
1142 }
1143
1144 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1145 };
1146
1147 class TypeOfValueNode : public ExpressionNode {
1148 public:
1149 TypeOfValueNode(ExpressionNode* expr) KJS_FAST_CALL
1150 : ExpressionNode(StringType)
1151 , m_expr(expr)
1152 {
1153 }
1154
1155 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1156 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1157 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1158 virtual Precedence precedence() const { return PrecUnary; }
1159
1160 private:
1161 RefPtr<ExpressionNode> m_expr;
1162 };
1163
1164 class PreIncResolveNode : public PrePostResolveNode {
1165 public:
1166 PreIncResolveNode(const Identifier& ident) KJS_FAST_CALL
1167 : PrePostResolveNode(ident)
1168 {
1169 }
1170
1171 PreIncResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
1172 : PrePostResolveNode(PlacementNewAdopt)
1173 {
1174 }
1175
1176 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1177
1178 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1179 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1180 virtual Precedence precedence() const { return PrecUnary; }
1181 };
1182
1183 class PreIncLocalVarNode : public PreIncResolveNode {
1184 public:
1185 PreIncLocalVarNode(size_t i) KJS_FAST_CALL
1186 : PreIncResolveNode(PlacementNewAdopt)
1187 {
1188 ASSERT(i != missingSymbolMarker());
1189 m_index = i;
1190 }
1191
1192 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1193 };
1194
1195 class PreIncConstNode : public PreIncResolveNode {
1196 public:
1197 PreIncConstNode(size_t i) KJS_FAST_CALL
1198 : PreIncResolveNode(PlacementNewAdopt)
1199 {
1200 ASSERT(i != missingSymbolMarker());
1201 m_index = i;
1202 }
1203
1204 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1205 };
1206
1207 class PreDecResolveNode : public PrePostResolveNode {
1208 public:
1209 PreDecResolveNode(const Identifier& ident) KJS_FAST_CALL
1210 : PrePostResolveNode(ident)
1211 {
1212 }
1213
1214 PreDecResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
1215 : PrePostResolveNode(PlacementNewAdopt)
1216 {
1217 }
1218
1219 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1220
1221 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1222 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1223 virtual Precedence precedence() const { return PrecUnary; }
1224 };
1225
1226 class PreDecLocalVarNode : public PreDecResolveNode {
1227 public:
1228 PreDecLocalVarNode(size_t i) KJS_FAST_CALL
1229 : PreDecResolveNode(PlacementNewAdopt)
1230 {
1231 ASSERT(i != missingSymbolMarker());
1232 m_index = i;
1233 }
1234
1235 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1236 };
1237
1238 class PreDecConstNode : public PreDecResolveNode {
1239 public:
1240 PreDecConstNode(size_t i) KJS_FAST_CALL
1241 : PreDecResolveNode(PlacementNewAdopt)
1242 {
1243 ASSERT(i != missingSymbolMarker());
1244 m_index = i;
1245 }
1246
1247 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1248 };
1249
1250 class PrefixBracketNode : public ExpressionNode {
1251 public:
1252 PrefixBracketNode(ExpressionNode* base, ExpressionNode* subscript) KJS_FAST_CALL
1253 : m_base(base)
1254 , m_subscript(subscript)
1255 {
1256 }
1257
1258 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1259 virtual Precedence precedence() const { return PrecUnary; }
1260
1261 protected:
1262 RefPtr<ExpressionNode> m_base;
1263 RefPtr<ExpressionNode> m_subscript;
1264 };
1265
1266 class PreIncBracketNode : public PrefixBracketNode {
1267 public:
1268 PreIncBracketNode(ExpressionNode* base, ExpressionNode* subscript) KJS_FAST_CALL
1269 : PrefixBracketNode(base, subscript)
1270 {
1271 }
1272
1273 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1274 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1275 };
1276
1277 class PreDecBracketNode : public PrefixBracketNode {
1278 public:
1279 PreDecBracketNode(ExpressionNode* base, ExpressionNode* subscript) KJS_FAST_CALL
1280 : PrefixBracketNode(base, subscript)
1281 {
1282 }
1283
1284 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1285 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1286 };
1287
1288 class PrefixDotNode : public ExpressionNode {
1289 public:
1290 PrefixDotNode(ExpressionNode* base, const Identifier& ident) KJS_FAST_CALL
1291 : m_base(base)
1292 , m_ident(ident)
1293 {
1294 }
1295
1296 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1297 virtual Precedence precedence() const { return PrecPostfix; }
1298
1299 protected:
1300 RefPtr<ExpressionNode> m_base;
1301 Identifier m_ident;
1302 };
1303
1304 class PreIncDotNode : public PrefixDotNode {
1305 public:
1306 PreIncDotNode(ExpressionNode* base, const Identifier& ident) KJS_FAST_CALL
1307 : PrefixDotNode(base, ident)
1308 {
1309 }
1310
1311 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1312 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1313 };
1314
1315 class PreDecDotNode : public PrefixDotNode {
1316 public:
1317 PreDecDotNode(ExpressionNode* base, const Identifier& ident) KJS_FAST_CALL
1318 : PrefixDotNode(base, ident)
1319 {
1320 }
1321
1322 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1323 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1324 };
1325
1326 class PrefixErrorNode : public ExpressionNode {
1327 public:
1328 PrefixErrorNode(ExpressionNode* expr, Operator oper) KJS_FAST_CALL
1329 : m_expr(expr)
1330 , m_operator(oper)
1331 {
1332 }
1333
1334 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1335 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1336 virtual Precedence precedence() const { return PrecUnary; }
1337
1338 private:
1339 RefPtr<ExpressionNode> m_expr;
1340 Operator m_operator;
1341 };
1342
1343 class UnaryPlusNode : public ExpressionNode {
1344 public:
1345 UnaryPlusNode(ExpressionNode* expr) KJS_FAST_CALL
1346 : ExpressionNode(NumberType)
1347 , m_expr(expr)
1348 {
1349 }
1350
1351 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1352 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1353 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1354 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1355 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1356 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1357 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1358 virtual Precedence precedence() const { return PrecUnary; }
1359
1360 private:
1361 RefPtr<ExpressionNode> m_expr;
1362 };
1363
1364 class NegateNode : public ExpressionNode {
1365 public:
1366 NegateNode(ExpressionNode* expr) KJS_FAST_CALL
1367 : ExpressionNode(NumberType)
1368 , m_expr(expr)
1369 {
1370 }
1371
1372 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1373 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1374 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1375 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1376 virtual Precedence precedence() const { return PrecUnary; }
1377
1378 private:
1379 RefPtr<ExpressionNode> m_expr;
1380 };
1381
1382 class BitwiseNotNode : public ExpressionNode {
1383 public:
1384 BitwiseNotNode(ExpressionNode* expr) KJS_FAST_CALL
1385 : ExpressionNode(NumberType)
1386 , m_expr(expr)
1387 {
1388 }
1389
1390 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1391 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1392 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1393 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1394 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1395 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1396 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1397 virtual Precedence precedence() const { return PrecUnary; }
1398
1399 private:
1400 ALWAYS_INLINE int32_t inlineEvaluateToInt32(ExecState*);
1401
1402 RefPtr<ExpressionNode> m_expr;
1403 };
1404
1405 class LogicalNotNode : public ExpressionNode {
1406 public:
1407 LogicalNotNode(ExpressionNode* expr) KJS_FAST_CALL
1408 : ExpressionNode(BooleanType)
1409 , m_expr(expr)
1410 {
1411 }
1412
1413 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1414 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1415 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1416 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1417 virtual Precedence precedence() const { return PrecUnary; }
1418
1419 private:
1420 RefPtr<ExpressionNode> m_expr;
1421 };
1422
1423 class MultNode : public ExpressionNode {
1424 public:
1425 MultNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1426 : ExpressionNode(NumberType)
1427 , m_term1(term1)
1428 , m_term2(term2)
1429 {
1430 }
1431
1432 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1433 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1434 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1435 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1436 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1437 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1438 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1439 virtual Precedence precedence() const { return PrecMultiplicitave; }
1440
1441 private:
1442 ALWAYS_INLINE double inlineEvaluateToNumber(ExecState*);
1443
1444 RefPtr<ExpressionNode> m_term1;
1445 RefPtr<ExpressionNode> m_term2;
1446 };
1447
1448 class DivNode : public ExpressionNode {
1449 public:
1450 DivNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1451 : ExpressionNode(NumberType)
1452 , m_term1(term1)
1453 , m_term2(term2)
1454 {
1455 }
1456
1457 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1458 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1459 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1460 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1461 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1462 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1463 virtual Precedence precedence() const { return PrecMultiplicitave; }
1464
1465 private:
1466 ALWAYS_INLINE double inlineEvaluateToNumber(ExecState*);
1467
1468 RefPtr<ExpressionNode> m_term1;
1469 RefPtr<ExpressionNode> m_term2;
1470 };
1471
1472 class ModNode : public ExpressionNode {
1473 public:
1474 ModNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1475 : ExpressionNode(NumberType)
1476 , m_term1(term1)
1477 , m_term2(term2)
1478 {
1479 }
1480
1481 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1482 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1483 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1484 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1485 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1486 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1487 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1488 virtual Precedence precedence() const { return PrecMultiplicitave; }
1489
1490 private:
1491 ALWAYS_INLINE double inlineEvaluateToNumber(ExecState*);
1492
1493 RefPtr<ExpressionNode> m_term1;
1494 RefPtr<ExpressionNode> m_term2;
1495 };
1496
1497 class AddNode : public ExpressionNode {
1498 public:
1499 AddNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1500 : m_term1(term1)
1501 , m_term2(term2)
1502 {
1503 }
1504
1505 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1506 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1507 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1508 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1509 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1510 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1511 virtual Precedence precedence() const { return PrecAdditive; }
1512
1513 protected:
1514 AddNode(ExpressionNode* term1, ExpressionNode* term2, JSType expectedReturn) KJS_FAST_CALL
1515 : ExpressionNode(expectedReturn)
1516 , m_term1(term1)
1517 , m_term2(term2)
1518 {
1519 }
1520
1521 RefPtr<ExpressionNode> m_term1;
1522 RefPtr<ExpressionNode> m_term2;
1523
1524 private:
1525 ALWAYS_INLINE double inlineEvaluateToNumber(ExecState*);
1526 };
1527
1528 class AddNumbersNode : public AddNode {
1529 public:
1530 AddNumbersNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1531 : AddNode(term1, term2, NumberType)
1532 {
1533 }
1534
1535 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1536 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1537 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1538 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1539
1540 private:
1541 ALWAYS_INLINE double inlineEvaluateToNumber(ExecState*) KJS_FAST_CALL;
1542 };
1543
1544 class AddStringLeftNode : public AddNode {
1545 public:
1546 AddStringLeftNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1547 : AddNode(term1, term2, StringType)
1548 {
1549 }
1550
1551 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1552 };
1553
1554 class AddStringRightNode : public AddNode {
1555 public:
1556 AddStringRightNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1557 : AddNode(term1, term2, StringType)
1558 {
1559 }
1560
1561 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1562 };
1563
1564 class AddStringsNode : public AddNode {
1565 public:
1566 AddStringsNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1567 : AddNode(term1, term2, StringType)
1568 {
1569 }
1570
1571 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1572 };
1573
1574 class SubNode : public ExpressionNode {
1575 public:
1576 SubNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1577 : ExpressionNode(NumberType)
1578 , m_term1(term1)
1579 , m_term2(term2)
1580 {
1581 }
1582
1583 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1584 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1585 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1586 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1587 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1588 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1589 virtual Precedence precedence() const { return PrecAdditive; }
1590
1591 private:
1592 ALWAYS_INLINE double inlineEvaluateToNumber(ExecState*);
1593
1594 RefPtr<ExpressionNode> m_term1;
1595 RefPtr<ExpressionNode> m_term2;
1596 };
1597
1598 class LeftShiftNode : public ExpressionNode {
1599 public:
1600 LeftShiftNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1601 : ExpressionNode(NumberType)
1602 , m_term1(term1)
1603 , m_term2(term2)
1604 {
1605 }
1606
1607 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1608 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1609 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1610 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1611 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1612 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1613 virtual Precedence precedence() const { return PrecShift; }
1614
1615 private:
1616 ALWAYS_INLINE int32_t inlineEvaluateToInt32(ExecState*);
1617
1618 RefPtr<ExpressionNode> m_term1;
1619 RefPtr<ExpressionNode> m_term2;
1620 };
1621
1622 class RightShiftNode : public ExpressionNode {
1623 public:
1624 RightShiftNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1625 : ExpressionNode(NumberType)
1626 , m_term1(term1)
1627 , m_term2(term2)
1628 {
1629 }
1630
1631 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1632 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1633 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1634 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1635 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1636 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1637 virtual Precedence precedence() const { return PrecShift; }
1638
1639 private:
1640 ALWAYS_INLINE int32_t inlineEvaluateToInt32(ExecState*);
1641
1642 RefPtr<ExpressionNode> m_term1;
1643 RefPtr<ExpressionNode> m_term2;
1644 };
1645
1646 class UnsignedRightShiftNode : public ExpressionNode {
1647 public:
1648 UnsignedRightShiftNode(ExpressionNode* term1, ExpressionNode* term2) KJS_FAST_CALL
1649 : ExpressionNode(NumberType)
1650 , m_term1(term1)
1651 , m_term2(term2)
1652 {
1653 }
1654
1655 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1656 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1657 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1658 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1659 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1660 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1661 virtual Precedence precedence() const { return PrecShift; }
1662 private:
1663 ALWAYS_INLINE uint32_t inlineEvaluateToUInt32(ExecState*);
1664
1665 RefPtr<ExpressionNode> m_term1;
1666 RefPtr<ExpressionNode> m_term2;
1667 };
1668
1669 class LessNode : public ExpressionNode {
1670 public:
1671 LessNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1672 : ExpressionNode(BooleanType)
1673 , m_expr1(expr1)
1674 , m_expr2(expr2)
1675 {
1676 }
1677
1678 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1679 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1680 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1681 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1682 virtual Precedence precedence() const { return PrecRelational; }
1683
1684 private:
1685 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
1686
1687 protected:
1688 RefPtr<ExpressionNode> m_expr1;
1689 RefPtr<ExpressionNode> m_expr2;
1690 };
1691
1692 class LessNumbersNode : public LessNode {
1693 public:
1694 LessNumbersNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1695 : LessNode(expr1, expr2)
1696 {
1697 }
1698
1699 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1700 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1701
1702 private:
1703 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
1704 };
1705
1706 class LessStringsNode : public LessNode {
1707 public:
1708 LessStringsNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1709 : LessNode(expr1, expr2)
1710 {
1711 }
1712
1713 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1714 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1715
1716 private:
1717 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
1718 };
1719
1720 class GreaterNode : public ExpressionNode {
1721 public:
1722 GreaterNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1723 : m_expr1(expr1)
1724 , m_expr2(expr2)
1725 {
1726 }
1727
1728 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1729 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1730 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1731 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1732 virtual Precedence precedence() const { return PrecRelational; }
1733
1734 private:
1735 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
1736
1737 RefPtr<ExpressionNode> m_expr1;
1738 RefPtr<ExpressionNode> m_expr2;
1739 };
1740
1741 class LessEqNode : public ExpressionNode {
1742 public:
1743 LessEqNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1744 : m_expr1(expr1)
1745 , m_expr2(expr2)
1746 {
1747 }
1748
1749 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1750 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1751 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1752 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1753 virtual Precedence precedence() const { return PrecRelational; }
1754
1755 private:
1756 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
1757
1758 RefPtr<ExpressionNode> m_expr1;
1759 RefPtr<ExpressionNode> m_expr2;
1760 };
1761
1762 class GreaterEqNode : public ExpressionNode {
1763 public:
1764 GreaterEqNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1765 : m_expr1(expr1)
1766 , m_expr2(expr2)
1767 {
1768 }
1769
1770 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1771 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1772 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1773 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1774 virtual Precedence precedence() const { return PrecRelational; }
1775
1776 private:
1777 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
1778
1779 RefPtr<ExpressionNode> m_expr1;
1780 RefPtr<ExpressionNode> m_expr2;
1781 };
1782
1783 class InstanceOfNode : public ExpressionNode {
1784 public:
1785 InstanceOfNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1786 : ExpressionNode(BooleanType)
1787 , m_expr1(expr1)
1788 , m_expr2(expr2)
1789 {
1790 }
1791
1792 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1793 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1794 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1795 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1796 virtual Precedence precedence() const { return PrecRelational; }
1797
1798 private:
1799 RefPtr<ExpressionNode> m_expr1;
1800 RefPtr<ExpressionNode> m_expr2;
1801 };
1802
1803 class InNode : public ExpressionNode {
1804 public:
1805 InNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1806 : m_expr1(expr1)
1807 , m_expr2(expr2)
1808 {
1809 }
1810
1811 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1812 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1813 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1814 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1815 virtual Precedence precedence() const { return PrecRelational; }
1816
1817 private:
1818 RefPtr<ExpressionNode> m_expr1;
1819 RefPtr<ExpressionNode> m_expr2;
1820 };
1821
1822 class EqualNode : public ExpressionNode {
1823 public:
1824 EqualNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1825 : ExpressionNode(BooleanType)
1826 , m_expr1(expr1)
1827 , m_expr2(expr2)
1828 {
1829 }
1830
1831 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1832 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1833 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1834 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1835 virtual Precedence precedence() const { return PrecEquality; }
1836
1837 private:
1838 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
1839
1840 RefPtr<ExpressionNode> m_expr1;
1841 RefPtr<ExpressionNode> m_expr2;
1842 };
1843
1844 class NotEqualNode : public ExpressionNode {
1845 public:
1846 NotEqualNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1847 : ExpressionNode(BooleanType)
1848 , m_expr1(expr1)
1849 , m_expr2(expr2)
1850 {
1851 }
1852
1853 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1854 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1855 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1856 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1857 virtual Precedence precedence() const { return PrecEquality; }
1858
1859 private:
1860 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
1861
1862 RefPtr<ExpressionNode> m_expr1;
1863 RefPtr<ExpressionNode> m_expr2;
1864 };
1865
1866 class StrictEqualNode : public ExpressionNode {
1867 public:
1868 StrictEqualNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1869 : ExpressionNode(BooleanType)
1870 , m_expr1(expr1)
1871 , m_expr2(expr2)
1872 {
1873 }
1874
1875 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1876 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1877 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1878 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1879 virtual Precedence precedence() const { return PrecEquality; }
1880
1881 private:
1882 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
1883
1884 RefPtr<ExpressionNode> m_expr1;
1885 RefPtr<ExpressionNode> m_expr2;
1886 };
1887
1888 class NotStrictEqualNode : public ExpressionNode {
1889 public:
1890 NotStrictEqualNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1891 : ExpressionNode(BooleanType)
1892 , m_expr1(expr1)
1893 , m_expr2(expr2)
1894 {
1895 }
1896
1897 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1898 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1899 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1900 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1901 virtual Precedence precedence() const { return PrecEquality; }
1902
1903 private:
1904 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
1905
1906 RefPtr<ExpressionNode> m_expr1;
1907 RefPtr<ExpressionNode> m_expr2;
1908 };
1909
1910 class BitAndNode : public ExpressionNode {
1911 public:
1912 BitAndNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1913 : ExpressionNode(NumberType)
1914 , m_expr1(expr1)
1915 , m_expr2(expr2)
1916 {
1917 }
1918
1919 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1920 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1921 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1922 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1923 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1924 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1925 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1926 virtual Precedence precedence() const { return PrecBitwiseAnd; }
1927
1928 private:
1929 ALWAYS_INLINE int32_t inlineEvaluateToInt32(ExecState*);
1930
1931 RefPtr<ExpressionNode> m_expr1;
1932 RefPtr<ExpressionNode> m_expr2;
1933 };
1934
1935 class BitOrNode : public ExpressionNode {
1936 public:
1937 BitOrNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1938 : ExpressionNode(NumberType)
1939 , m_expr1(expr1)
1940 , m_expr2(expr2)
1941 {
1942 }
1943
1944 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1945 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1946 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1947 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1948 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1949 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1950 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1951 virtual Precedence precedence() const { return PrecBitwiseOr; }
1952
1953 private:
1954 ALWAYS_INLINE int32_t inlineEvaluateToInt32(ExecState*);
1955
1956 RefPtr<ExpressionNode> m_expr1;
1957 RefPtr<ExpressionNode> m_expr2;
1958 };
1959
1960 class BitXOrNode : public ExpressionNode {
1961 public:
1962 BitXOrNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1963 : ExpressionNode(NumberType)
1964 , m_expr1(expr1)
1965 , m_expr2(expr2)
1966 {
1967 }
1968
1969 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1970 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1971 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
1972 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
1973 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
1974 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
1975 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
1976 virtual Precedence precedence() const { return PrecBitwiseXor; }
1977
1978 private:
1979 ALWAYS_INLINE int32_t inlineEvaluateToInt32(ExecState*);
1980
1981 RefPtr<ExpressionNode> m_expr1;
1982 RefPtr<ExpressionNode> m_expr2;
1983 };
1984
1985 /**
1986 * m_expr1 && m_expr2, m_expr1 || m_expr2
1987 */
1988 class LogicalAndNode : public ExpressionNode {
1989 public:
1990 LogicalAndNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
1991 : ExpressionNode(BooleanType)
1992 , m_expr1(expr1)
1993 , m_expr2(expr2)
1994 {
1995 }
1996
1997 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
1998 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
1999 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
2000 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2001 virtual Precedence precedence() const { return PrecLogicalAnd; }
2002
2003 private:
2004 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
2005
2006 RefPtr<ExpressionNode> m_expr1;
2007 RefPtr<ExpressionNode> m_expr2;
2008 };
2009
2010 class LogicalOrNode : public ExpressionNode {
2011 public:
2012 LogicalOrNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
2013 : ExpressionNode(BooleanType)
2014 , m_expr1(expr1)
2015 , m_expr2(expr2)
2016 {
2017 }
2018
2019 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2020 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2021 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
2022 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2023 virtual Precedence precedence() const { return PrecLogicalOr; }
2024
2025 private:
2026 ALWAYS_INLINE bool inlineEvaluateToBoolean(ExecState*);
2027
2028 RefPtr<ExpressionNode> m_expr1;
2029 RefPtr<ExpressionNode> m_expr2;
2030 };
2031
2032 /**
2033 * The ternary operator, "m_logical ? m_expr1 : m_expr2"
2034 */
2035 class ConditionalNode : public ExpressionNode {
2036 public:
2037 ConditionalNode(ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
2038 : m_logical(logical)
2039 , m_expr1(expr1)
2040 , m_expr2(expr2)
2041 {
2042 }
2043
2044 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2045 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2046 virtual bool evaluateToBoolean(ExecState*) KJS_FAST_CALL;
2047 virtual double evaluateToNumber(ExecState*) KJS_FAST_CALL;
2048 virtual int32_t evaluateToInt32(ExecState*) KJS_FAST_CALL;
2049 virtual uint32_t evaluateToUInt32(ExecState*) KJS_FAST_CALL;
2050 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2051 virtual Precedence precedence() const { return PrecConditional; }
2052
2053 private:
2054 RefPtr<ExpressionNode> m_logical;
2055 RefPtr<ExpressionNode> m_expr1;
2056 RefPtr<ExpressionNode> m_expr2;
2057 };
2058
2059 class ReadModifyResolveNode : public ExpressionNode {
2060 public:
2061 ReadModifyResolveNode(const Identifier& ident, Operator oper, ExpressionNode* right) KJS_FAST_CALL
2062 : m_ident(ident)
2063 , m_operator(oper)
2064 , m_right(right)
2065 {
2066 }
2067
2068 ReadModifyResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
2069 : ExpressionNode(PlacementNewAdopt)
2070 , m_ident(PlacementNewAdopt)
2071 , m_right(PlacementNewAdopt)
2072 {
2073 }
2074
2075 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2076 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2077 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2078 virtual Precedence precedence() const { return PrecAssignment; }
2079
2080 protected:
2081 Identifier m_ident;
2082 Operator m_operator;
2083 RefPtr<ExpressionNode> m_right;
2084 size_t m_index; // Used by ReadModifyLocalVarNode.
2085 };
2086
2087 class ReadModifyLocalVarNode : public ReadModifyResolveNode {
2088 public:
2089 ReadModifyLocalVarNode(size_t i) KJS_FAST_CALL
2090 : ReadModifyResolveNode(PlacementNewAdopt)
2091 {
2092 ASSERT(i != missingSymbolMarker());
2093 m_index = i;
2094 }
2095
2096 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2097 };
2098
2099 class ReadModifyConstNode : public ReadModifyResolveNode {
2100 public:
2101 ReadModifyConstNode(size_t i) KJS_FAST_CALL
2102 : ReadModifyResolveNode(PlacementNewAdopt)
2103 {
2104 ASSERT(i != missingSymbolMarker());
2105 m_index = i;
2106 }
2107
2108 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2109 };
2110
2111 class AssignResolveNode : public ExpressionNode {
2112 public:
2113 AssignResolveNode(const Identifier& ident, ExpressionNode* right) KJS_FAST_CALL
2114 : m_ident(ident)
2115 , m_right(right)
2116 {
2117 }
2118
2119 AssignResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
2120 : ExpressionNode(PlacementNewAdopt)
2121 , m_ident(PlacementNewAdopt)
2122 , m_right(PlacementNewAdopt)
2123 {
2124 }
2125
2126 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2127 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2128 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2129 virtual Precedence precedence() const { return PrecAssignment; }
2130
2131 protected:
2132 Identifier m_ident;
2133 RefPtr<ExpressionNode> m_right;
2134 size_t m_index; // Used by ReadModifyLocalVarNode.
2135 };
2136
2137 class AssignLocalVarNode : public AssignResolveNode {
2138 public:
2139 AssignLocalVarNode(size_t i) KJS_FAST_CALL
2140 : AssignResolveNode(PlacementNewAdopt)
2141 {
2142 ASSERT(i != missingSymbolMarker());
2143 m_index = i;
2144 }
2145
2146 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2147 };
2148
2149 class AssignConstNode : public AssignResolveNode {
2150 public:
2151 AssignConstNode() KJS_FAST_CALL
2152 : AssignResolveNode(PlacementNewAdopt)
2153 {
2154 }
2155
2156 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2157 };
2158
2159 class ReadModifyBracketNode : public ExpressionNode {
2160 public:
2161 ReadModifyBracketNode(ExpressionNode* base, ExpressionNode* subscript, Operator oper, ExpressionNode* right) KJS_FAST_CALL
2162 : m_base(base)
2163 , m_subscript(subscript)
2164 , m_operator(oper)
2165 , m_right(right)
2166 {
2167 }
2168
2169 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2170 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2171 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2172 virtual Precedence precedence() const { return PrecAssignment; }
2173
2174 protected:
2175 RefPtr<ExpressionNode> m_base;
2176 RefPtr<ExpressionNode> m_subscript;
2177 Operator m_operator;
2178 RefPtr<ExpressionNode> m_right;
2179 };
2180
2181 class AssignBracketNode : public ExpressionNode {
2182 public:
2183 AssignBracketNode(ExpressionNode* base, ExpressionNode* subscript, ExpressionNode* right) KJS_FAST_CALL
2184 : m_base(base)
2185 , m_subscript(subscript)
2186 , m_right(right)
2187 {
2188 }
2189
2190 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2191 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2192 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2193 virtual Precedence precedence() const { return PrecAssignment; }
2194
2195 protected:
2196 RefPtr<ExpressionNode> m_base;
2197 RefPtr<ExpressionNode> m_subscript;
2198 RefPtr<ExpressionNode> m_right;
2199 };
2200
2201 class AssignDotNode : public ExpressionNode {
2202 public:
2203 AssignDotNode(ExpressionNode* base, const Identifier& ident, ExpressionNode* right) KJS_FAST_CALL
2204 : m_base(base)
2205 , m_ident(ident)
2206 , m_right(right)
2207 {
2208 }
2209
2210 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2211 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2212 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2213 virtual Precedence precedence() const { return PrecAssignment; }
2214
2215 protected:
2216 RefPtr<ExpressionNode> m_base;
2217 Identifier m_ident;
2218 RefPtr<ExpressionNode> m_right;
2219 };
2220
2221 class ReadModifyDotNode : public ExpressionNode {
2222 public:
2223 ReadModifyDotNode(ExpressionNode* base, const Identifier& ident, Operator oper, ExpressionNode* right) KJS_FAST_CALL
2224 : m_base(base)
2225 , m_ident(ident)
2226 , m_operator(oper)
2227 , m_right(right)
2228 {
2229 }
2230
2231 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2232 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2233 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2234 virtual Precedence precedence() const { return PrecAssignment; }
2235
2236 protected:
2237 RefPtr<ExpressionNode> m_base;
2238 Identifier m_ident;
2239 Operator m_operator;
2240 RefPtr<ExpressionNode> m_right;
2241 };
2242
2243 class AssignErrorNode : public ExpressionNode {
2244 public:
2245 AssignErrorNode(ExpressionNode* left, Operator oper, ExpressionNode* right) KJS_FAST_CALL
2246 : m_left(left)
2247 , m_operator(oper)
2248 , m_right(right)
2249 {
2250 }
2251
2252 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2253 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2254 virtual Precedence precedence() const { return PrecAssignment; }
2255
2256 protected:
2257 RefPtr<ExpressionNode> m_left;
2258 Operator m_operator;
2259 RefPtr<ExpressionNode> m_right;
2260 };
2261
2262 class CommaNode : public ExpressionNode {
2263 public:
2264 CommaNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
2265 : m_expr1(expr1)
2266 , m_expr2(expr2)
2267 {
2268 m_expr1->optimizeForUnnecessaryResult();
2269 }
2270
2271 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2272 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2273 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2274 virtual Precedence precedence() const { return PrecExpression; }
2275
2276 private:
2277 RefPtr<ExpressionNode> m_expr1;
2278 RefPtr<ExpressionNode> m_expr2;
2279 };
2280
2281 class VarDeclCommaNode : public CommaNode {
2282 public:
2283 VarDeclCommaNode(ExpressionNode* expr1, ExpressionNode* expr2) KJS_FAST_CALL
2284 : CommaNode(expr1, expr2)
2285 {
2286 }
2287 virtual Precedence precedence() const { return PrecAssignment; }
2288 };
2289
2290 class ConstDeclNode : public ExpressionNode {
2291 public:
2292 ConstDeclNode(const Identifier& ident, ExpressionNode* in) KJS_FAST_CALL;
2293
2294 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2295 virtual KJS::JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2296 void evaluateSingle(ExecState*) KJS_FAST_CALL;
2297 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2298 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
2299 PassRefPtr<ConstDeclNode> releaseNext() KJS_FAST_CALL { return m_next.release(); }
2300
2301 Identifier m_ident;
2302 ListRefPtr<ConstDeclNode> m_next;
2303 RefPtr<ExpressionNode> m_init;
2304
2305 private:
2306 void handleSlowCase(ExecState*, const ScopeChain&, JSValue*) KJS_FAST_CALL NEVER_INLINE;
2307 };
2308
2309 class ConstStatementNode : public StatementNode {
2310 public:
2311 ConstStatementNode(ConstDeclNode* next) KJS_FAST_CALL
2312 : m_next(next)
2313 {
2314 }
2315
2316 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2317 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2318 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2319
2320 private:
2321 RefPtr<ConstDeclNode> m_next;
2322 };
2323
2324 typedef Vector<RefPtr<StatementNode> > StatementVector;
2325
2326 class SourceElements : public ParserRefCounted {
2327 public:
2328 void append(PassRefPtr<StatementNode>);
2329 void releaseContentsIntoVector(StatementVector& destination)
2330 {
2331 ASSERT(destination.isEmpty());
2332 m_statements.swap(destination);
2333 }
2334
2335 private:
2336 StatementVector m_statements;
2337 };
2338
2339 class BlockNode : public StatementNode {
2340 public:
2341 BlockNode(SourceElements* children) KJS_FAST_CALL;
2342
2343 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2344 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2345 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2346
2347 protected:
2348 StatementVector m_children;
2349 };
2350
2351 class EmptyStatementNode : public StatementNode {
2352 public:
2353 EmptyStatementNode() KJS_FAST_CALL // debug
2354 {
2355 }
2356
2357 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2358 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2359 virtual bool isEmptyStatement() const KJS_FAST_CALL { return true; }
2360 };
2361
2362 class ExprStatementNode : public StatementNode {
2363 public:
2364 ExprStatementNode(ExpressionNode* expr) KJS_FAST_CALL
2365 : m_expr(expr)
2366 {
2367 }
2368
2369 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2370 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2371 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2372
2373 private:
2374 RefPtr<ExpressionNode> m_expr;
2375 };
2376
2377 class VarStatementNode : public StatementNode {
2378 public:
2379 VarStatementNode(ExpressionNode* expr) KJS_FAST_CALL
2380 : m_expr(expr)
2381 {
2382 }
2383
2384 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2385 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2386 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2387
2388 private:
2389 RefPtr<ExpressionNode> m_expr;
2390 };
2391
2392 class IfNode : public StatementNode {
2393 public:
2394 IfNode(ExpressionNode* condition, StatementNode* ifBlock) KJS_FAST_CALL
2395 : m_condition(condition)
2396 , m_ifBlock(ifBlock)
2397 {
2398 }
2399
2400 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2401 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2402 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2403
2404 protected:
2405 RefPtr<ExpressionNode> m_condition;
2406 RefPtr<StatementNode> m_ifBlock;
2407 };
2408
2409 class IfElseNode : public IfNode {
2410 public:
2411 IfElseNode(ExpressionNode* condtion, StatementNode* ifBlock, StatementNode* elseBlock) KJS_FAST_CALL
2412 : IfNode(condtion, ifBlock)
2413 , m_elseBlock(elseBlock)
2414 {
2415 }
2416
2417 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2418 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2419 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2420
2421 private:
2422 RefPtr<StatementNode> m_elseBlock;
2423 };
2424
2425 class DoWhileNode : public StatementNode {
2426 public:
2427 DoWhileNode(StatementNode* statement, ExpressionNode* expr) KJS_FAST_CALL
2428 : m_statement(statement)
2429 , m_expr(expr)
2430 {
2431 }
2432
2433 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2434 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2435 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2436
2437 private:
2438 RefPtr<StatementNode> m_statement;
2439 RefPtr<ExpressionNode> m_expr;
2440 };
2441
2442 class WhileNode : public StatementNode {
2443 public:
2444 WhileNode(ExpressionNode* expr, StatementNode* statement) KJS_FAST_CALL
2445 : m_expr(expr)
2446 , m_statement(statement)
2447 {
2448 }
2449
2450 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2451 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2452 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2453
2454 private:
2455 RefPtr<ExpressionNode> m_expr;
2456 RefPtr<StatementNode> m_statement;
2457 };
2458
2459 class ForNode : public StatementNode {
2460 public:
2461 ForNode(ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode* statement, bool expr1WasVarDecl) KJS_FAST_CALL
2462 : m_expr1(expr1 ? expr1 : new PlaceholderTrueNode)
2463 , m_expr2(expr2 ? expr2 : new PlaceholderTrueNode)
2464 , m_expr3(expr3 ? expr3 : new PlaceholderTrueNode)
2465 , m_statement(statement)
2466 , m_expr1WasVarDecl(expr1 && expr1WasVarDecl)
2467 {
2468 ASSERT(m_expr1);
2469 ASSERT(m_expr2);
2470 ASSERT(m_expr3);
2471 ASSERT(statement);
2472
2473 m_expr1->optimizeForUnnecessaryResult();
2474 m_expr3->optimizeForUnnecessaryResult();
2475 }
2476
2477 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2478 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2479 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2480
2481 private:
2482 RefPtr<ExpressionNode> m_expr1;
2483 RefPtr<ExpressionNode> m_expr2;
2484 RefPtr<ExpressionNode> m_expr3;
2485 RefPtr<StatementNode> m_statement;
2486 bool m_expr1WasVarDecl;
2487 };
2488
2489 class ForInNode : public StatementNode {
2490 public:
2491 ForInNode(ExpressionNode*, ExpressionNode*, StatementNode*) KJS_FAST_CALL;
2492 ForInNode(const Identifier&, ExpressionNode*, ExpressionNode*, StatementNode*) KJS_FAST_CALL;
2493
2494 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2495 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2496 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2497
2498 private:
2499 Identifier m_ident;
2500 RefPtr<ExpressionNode> m_init;
2501 RefPtr<ExpressionNode> m_lexpr;
2502 RefPtr<ExpressionNode> m_expr;
2503 RefPtr<StatementNode> m_statement;
2504 bool m_identIsVarDecl;
2505 };
2506
2507 class ContinueNode : public StatementNode {
2508 public:
2509 ContinueNode() KJS_FAST_CALL
2510 {
2511 }
2512
2513 ContinueNode(const Identifier& ident) KJS_FAST_CALL
2514 : m_ident(ident)
2515 {
2516 }
2517
2518 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2519 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2520
2521 private:
2522 Identifier m_ident;
2523 };
2524
2525 class BreakNode : public StatementNode {
2526 public:
2527 BreakNode() KJS_FAST_CALL
2528 {
2529 }
2530
2531 BreakNode(const Identifier& ident) KJS_FAST_CALL
2532 : m_ident(ident)
2533 {
2534 }
2535
2536 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2537 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2538
2539 private:
2540 Identifier m_ident;
2541 };
2542
2543 class ReturnNode : public StatementNode {
2544 public:
2545 ReturnNode(ExpressionNode* value) KJS_FAST_CALL
2546 : m_value(value)
2547 {
2548 }
2549
2550 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2551 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2552 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2553
2554 private:
2555 RefPtr<ExpressionNode> m_value;
2556 };
2557
2558 class WithNode : public StatementNode {
2559 public:
2560 WithNode(ExpressionNode* expr, StatementNode* statement) KJS_FAST_CALL
2561 : m_expr(expr)
2562 , m_statement(statement)
2563 {
2564 }
2565
2566 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2567 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2568 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2569
2570 private:
2571 RefPtr<ExpressionNode> m_expr;
2572 RefPtr<StatementNode> m_statement;
2573 };
2574
2575 class LabelNode : public StatementNode {
2576 public:
2577 LabelNode(const Identifier& label, StatementNode* statement) KJS_FAST_CALL
2578 : m_label(label)
2579 , m_statement(statement)
2580 {
2581 }
2582
2583 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2584 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2585 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2586
2587 private:
2588 Identifier m_label;
2589 RefPtr<StatementNode> m_statement;
2590 };
2591
2592 class ThrowNode : public StatementNode {
2593 public:
2594 ThrowNode(ExpressionNode* expr) KJS_FAST_CALL
2595 : m_expr(expr)
2596 {
2597 }
2598
2599 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2600 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2601 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2602
2603 private:
2604 RefPtr<ExpressionNode> m_expr;
2605 };
2606
2607 class TryNode : public StatementNode {
2608 public:
2609 TryNode(StatementNode* tryBlock, const Identifier& exceptionIdent, StatementNode* catchBlock, StatementNode* finallyBlock) KJS_FAST_CALL
2610 : m_tryBlock(tryBlock)
2611 , m_exceptionIdent(exceptionIdent)
2612 , m_catchBlock(catchBlock)
2613 , m_finallyBlock(finallyBlock)
2614 {
2615 }
2616
2617 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2618 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2619 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2620
2621 private:
2622 RefPtr<StatementNode> m_tryBlock;
2623 Identifier m_exceptionIdent;
2624 RefPtr<StatementNode> m_catchBlock;
2625 RefPtr<StatementNode> m_finallyBlock;
2626 };
2627
2628 class ParameterNode : public Node {
2629 public:
2630 ParameterNode(const Identifier& ident) KJS_FAST_CALL
2631 : m_ident(ident)
2632 {
2633 }
2634
2635 ParameterNode(ParameterNode* l, const Identifier& ident) KJS_FAST_CALL
2636 : m_ident(ident)
2637 {
2638 l->m_next = this;
2639 }
2640
2641 Identifier ident() KJS_FAST_CALL { return m_ident; }
2642 ParameterNode *nextParam() KJS_FAST_CALL { return m_next.get(); }
2643 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2644 PassRefPtr<ParameterNode> releaseNext() KJS_FAST_CALL { return m_next.release(); }
2645 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
2646
2647 private:
2648 friend class FuncDeclNode;
2649 friend class FuncExprNode;
2650 Identifier m_ident;
2651 ListRefPtr<ParameterNode> m_next;
2652 };
2653
2654 class ScopeNode : public BlockNode {
2655 public:
2656 ScopeNode(SourceElements*, VarStack*, FunctionStack*) KJS_FAST_CALL;
2657
2658 int sourceId() const KJS_FAST_CALL { return m_sourceId; }
2659 const UString& sourceURL() const KJS_FAST_CALL { return m_sourceURL; }
2660 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2661
2662 protected:
2663 void optimizeVariableAccess(ExecState*) KJS_FAST_CALL;
2664
2665 VarStack m_varStack;
2666 FunctionStack m_functionStack;
2667
2668 private:
2669 UString m_sourceURL;
2670 int m_sourceId;
2671 };
2672
2673 class ProgramNode : public ScopeNode {
2674 public:
2675 static ProgramNode* create(SourceElements*, VarStack*, FunctionStack*) KJS_FAST_CALL;
2676
2677 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2678
2679 private:
2680 ProgramNode(SourceElements*, VarStack*, FunctionStack*) KJS_FAST_CALL;
2681
2682 void initializeSymbolTable(ExecState*) KJS_FAST_CALL;
2683 ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL;
2684
2685 Vector<size_t> m_varIndexes; // Storage indexes belonging to the nodes in m_varStack. (Recorded to avoid double lookup.)
2686 Vector<size_t> m_functionIndexes; // Storage indexes belonging to the nodes in m_functionStack. (Recorded to avoid double lookup.)
2687 };
2688
2689 class EvalNode : public ScopeNode {
2690 public:
2691 static EvalNode* create(SourceElements*, VarStack*, FunctionStack*) KJS_FAST_CALL;
2692
2693 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2694
2695 private:
2696 EvalNode(SourceElements*, VarStack*, FunctionStack*) KJS_FAST_CALL;
2697
2698 ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL;
2699 };
2700
2701 class FunctionBodyNode : public ScopeNode {
2702 public:
2703 static FunctionBodyNode* create(SourceElements*, VarStack*, FunctionStack*) KJS_FAST_CALL;
2704
2705 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2706
2707 SymbolTable& symbolTable() KJS_FAST_CALL { return m_symbolTable; }
2708
2709 Vector<Identifier>& parameters() KJS_FAST_CALL { return m_parameters; }
2710 UString paramString() const KJS_FAST_CALL;
2711
2712 protected:
2713 FunctionBodyNode(SourceElements*, VarStack*, FunctionStack*) KJS_FAST_CALL;
2714
2715 private:
2716 void initializeSymbolTable(ExecState*) KJS_FAST_CALL;
2717 ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL;
2718
2719 bool m_initialized;
2720 Vector<Identifier> m_parameters;
2721 SymbolTable m_symbolTable;
2722 };
2723
2724 class FuncExprNode : public ExpressionNode {
2725 public:
2726 FuncExprNode(const Identifier& ident, FunctionBodyNode* body, ParameterNode* parameter = 0) KJS_FAST_CALL
2727 : m_ident(ident)
2728 , m_parameter(parameter)
2729 , m_body(body)
2730 {
2731 addParams();
2732 }
2733
2734 virtual JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2735 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2736 virtual Precedence precedence() const { return PrecMember; }
2737 virtual bool needsParensIfLeftmost() const { return true; }
2738
2739 private:
2740 void addParams() KJS_FAST_CALL;
2741
2742 // Used for streamTo
2743 friend class PropertyNode;
2744 Identifier m_ident;
2745 RefPtr<ParameterNode> m_parameter;
2746 RefPtr<FunctionBodyNode> m_body;
2747 };
2748
2749 class FuncDeclNode : public StatementNode {
2750 public:
2751 FuncDeclNode(const Identifier& ident, FunctionBodyNode* body) KJS_FAST_CALL
2752 : m_ident(ident)
2753 , m_body(body)
2754 {
2755 addParams();
2756 }
2757
2758 FuncDeclNode(const Identifier& ident, ParameterNode* parameter, FunctionBodyNode* body) KJS_FAST_CALL
2759 : m_ident(ident)
2760 , m_parameter(parameter)
2761 , m_body(body)
2762 {
2763 addParams();
2764 }
2765
2766 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2767 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2768 ALWAYS_INLINE FunctionImp* makeFunction(ExecState*) KJS_FAST_CALL;
2769
2770 Identifier m_ident;
2771
2772 private:
2773 void addParams() KJS_FAST_CALL;
2774
2775 RefPtr<ParameterNode> m_parameter;
2776 RefPtr<FunctionBodyNode> m_body;
2777 };
2778
2779 class CaseClauseNode : public Node {
2780 public:
2781 CaseClauseNode(ExpressionNode* expr) KJS_FAST_CALL
2782 : m_expr(expr)
2783 {
2784 }
2785
2786 CaseClauseNode(ExpressionNode* expr, SourceElements* children) KJS_FAST_CALL
2787 : m_expr(expr)
2788 {
2789 if (children)
2790 children->releaseContentsIntoVector(m_children);
2791 }
2792
2793 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2794 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2795 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
2796
2797 JSValue* evaluate(ExecState*) KJS_FAST_CALL;
2798 JSValue* executeStatements(ExecState*) KJS_FAST_CALL;
2799
2800 private:
2801 RefPtr<ExpressionNode> m_expr;
2802 StatementVector m_children;
2803 };
2804
2805 class ClauseListNode : public Node {
2806 public:
2807 ClauseListNode(CaseClauseNode* clause) KJS_FAST_CALL
2808 : m_clause(clause)
2809 {
2810 }
2811
2812 ClauseListNode(ClauseListNode* clauseList, CaseClauseNode* clause) KJS_FAST_CALL
2813 : m_clause(clause)
2814 {
2815 clauseList->m_next = this;
2816 }
2817
2818 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2819 CaseClauseNode* getClause() const KJS_FAST_CALL { return m_clause.get(); }
2820 ClauseListNode* getNext() const KJS_FAST_CALL { return m_next.get(); }
2821 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2822 PassRefPtr<ClauseListNode> releaseNext() KJS_FAST_CALL { return m_next.release(); }
2823 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
2824
2825 private:
2826 friend class CaseBlockNode;
2827 RefPtr<CaseClauseNode> m_clause;
2828 ListRefPtr<ClauseListNode> m_next;
2829 };
2830
2831 class CaseBlockNode : public Node {
2832 public:
2833 CaseBlockNode(ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2) KJS_FAST_CALL;
2834
2835 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2836 JSValue* executeBlock(ExecState*, JSValue *input) KJS_FAST_CALL;
2837 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2838 virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
2839
2840 private:
2841 RefPtr<ClauseListNode> m_list1;
2842 RefPtr<CaseClauseNode> m_defaultClause;
2843 RefPtr<ClauseListNode> m_list2;
2844 };
2845
2846 class SwitchNode : public StatementNode {
2847 public:
2848 SwitchNode(ExpressionNode* expr, CaseBlockNode* block) KJS_FAST_CALL
2849 : m_expr(expr)
2850 , m_block(block)
2851 {
2852 }
2853
2854 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2855 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2856 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2857
2858 private:
2859 RefPtr<ExpressionNode> m_expr;
2860 RefPtr<CaseBlockNode> m_block;
2861 };
2862
2863 class BreakpointCheckStatement : public StatementNode {
2864 public:
2865 BreakpointCheckStatement(PassRefPtr<StatementNode>) KJS_FAST_CALL;
2866
2867 virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
2868 virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
2869 virtual void optimizeVariableAccess(const SymbolTable&, const LocalStorage&, NodeStack&) KJS_FAST_CALL;
2870
2871 private:
2872 RefPtr<StatementNode> m_statement;
2873 };
2874
2875 struct ElementList {
2876 ElementNode* head;
2877 ElementNode* tail;
2878 };
2879
2880 struct PropertyList {
2881 PropertyListNode* head;
2882 PropertyListNode* tail;
2883 };
2884
2885 struct ArgumentList {
2886 ArgumentListNode* head;
2887 ArgumentListNode* tail;
2888 };
2889
2890 struct ConstDeclList {
2891 ConstDeclNode* head;
2892 ConstDeclNode* tail;
2893 };
2894
2895 struct ParameterList {
2896 ParameterNode* head;
2897 ParameterNode* tail;
2898 };
2899
2900 struct ClauseList {
2901 ClauseListNode* head;
2902 ClauseListNode* tail;
2903 };
2904
2905 } // namespace KJS
2906
2907 #endif // NODES_H_