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