source: webkit/trunk/JavaScriptCore/kjs/nodes.h@ 30810

Last change on this file since 30810 was 30109, checked in by Darin Adler, 17 years ago

Reviewed by Mitz.

We'll want to do this to every RefCounted class, one at a time.

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