• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (C) 2009 Apple Inc. All rights reserved.
3  *
4  *  This library is free software; you can redistribute it and/or
5  *  modify it under the terms of the GNU Library General Public
6  *  License as published by the Free Software Foundation; either
7  *  version 2 of the License, or (at your option) any later version.
8  *
9  *  This library is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  *  Library General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Library General Public License
15  *  along with this library; see the file COPYING.LIB.  If not, write to
16  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  *  Boston, MA 02110-1301, USA.
18  *
19  */
20 
21 #ifndef NodeConstructors_h
22 #define NodeConstructors_h
23 
24 #include "Nodes.h"
25 #include "Lexer.h"
26 #include "Parser.h"
27 
28 namespace JSC {
29 
new(size_t size,JSGlobalData * globalData)30     inline void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData)
31     {
32         ParserArenaDeletable* deletable = static_cast<ParserArenaDeletable*>(fastMalloc(size));
33         globalData->parser->arena().deleteWithArena(deletable);
34         return deletable;
35     }
36 
new(size_t size)37     inline void* ParserArenaDeletable::operator new(size_t size)
38     {
39         return fastMalloc(size);
40     }
41 
delete(void * p)42     inline void ParserArenaDeletable::operator delete(void* p)
43     {
44         fastFree(p);
45     }
46 
ParserArenaRefCounted(JSGlobalData * globalData)47     inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData)
48     {
49         globalData->parser->arena().derefWithArena(adoptRef(this));
50     }
51 
Node(JSGlobalData * globalData)52     inline Node::Node(JSGlobalData* globalData)
53         : m_line(globalData->lexer->lineNumber())
54     {
55     }
56 
ExpressionNode(JSGlobalData * globalData,ResultType resultType)57     inline ExpressionNode::ExpressionNode(JSGlobalData* globalData, ResultType resultType)
58         : Node(globalData)
59         , m_resultType(resultType)
60     {
61     }
62 
StatementNode(JSGlobalData * globalData)63     inline StatementNode::StatementNode(JSGlobalData* globalData)
64         : Node(globalData)
65         , m_lastLine(-1)
66     {
67     }
68 
NullNode(JSGlobalData * globalData)69     inline NullNode::NullNode(JSGlobalData* globalData)
70         : ExpressionNode(globalData, ResultType::nullType())
71     {
72     }
73 
BooleanNode(JSGlobalData * globalData,bool value)74     inline BooleanNode::BooleanNode(JSGlobalData* globalData, bool value)
75         : ExpressionNode(globalData, ResultType::booleanType())
76         , m_value(value)
77     {
78     }
79 
NumberNode(JSGlobalData * globalData,double v)80     inline NumberNode::NumberNode(JSGlobalData* globalData, double v)
81         : ExpressionNode(globalData, ResultType::numberType())
82         , m_double(v)
83     {
84     }
85 
StringNode(JSGlobalData * globalData,const Identifier & v)86     inline StringNode::StringNode(JSGlobalData* globalData, const Identifier& v)
87         : ExpressionNode(globalData, ResultType::stringType())
88         , m_value(v)
89     {
90     }
91 
RegExpNode(JSGlobalData * globalData,const UString & pattern,const UString & flags)92     inline RegExpNode::RegExpNode(JSGlobalData* globalData, const UString& pattern, const UString& flags)
93         : ExpressionNode(globalData)
94         , m_pattern(pattern)
95         , m_flags(flags)
96     {
97     }
98 
ThisNode(JSGlobalData * globalData)99     inline ThisNode::ThisNode(JSGlobalData* globalData)
100         : ExpressionNode(globalData)
101     {
102     }
103 
ResolveNode(JSGlobalData * globalData,const Identifier & ident,int startOffset)104     inline ResolveNode::ResolveNode(JSGlobalData* globalData, const Identifier& ident, int startOffset)
105         : ExpressionNode(globalData)
106         , m_ident(ident)
107         , m_startOffset(startOffset)
108     {
109     }
110 
ElementNode(JSGlobalData *,int elision,ExpressionNode * node)111     inline ElementNode::ElementNode(JSGlobalData*, int elision, ExpressionNode* node)
112         : m_next(0)
113         , m_elision(elision)
114         , m_node(node)
115     {
116     }
117 
ElementNode(JSGlobalData *,ElementNode * l,int elision,ExpressionNode * node)118     inline ElementNode::ElementNode(JSGlobalData*, ElementNode* l, int elision, ExpressionNode* node)
119         : m_next(0)
120         , m_elision(elision)
121         , m_node(node)
122     {
123         l->m_next = this;
124     }
125 
ArrayNode(JSGlobalData * globalData,int elision)126     inline ArrayNode::ArrayNode(JSGlobalData* globalData, int elision)
127         : ExpressionNode(globalData)
128         , m_element(0)
129         , m_elision(elision)
130         , m_optional(true)
131     {
132     }
133 
ArrayNode(JSGlobalData * globalData,ElementNode * element)134     inline ArrayNode::ArrayNode(JSGlobalData* globalData, ElementNode* element)
135         : ExpressionNode(globalData)
136         , m_element(element)
137         , m_elision(0)
138         , m_optional(false)
139     {
140     }
141 
ArrayNode(JSGlobalData * globalData,int elision,ElementNode * element)142     inline ArrayNode::ArrayNode(JSGlobalData* globalData, int elision, ElementNode* element)
143         : ExpressionNode(globalData)
144         , m_element(element)
145         , m_elision(elision)
146         , m_optional(true)
147     {
148     }
149 
PropertyNode(JSGlobalData *,const Identifier & name,ExpressionNode * assign,Type type)150     inline PropertyNode::PropertyNode(JSGlobalData*, const Identifier& name, ExpressionNode* assign, Type type)
151         : m_name(name)
152         , m_assign(assign)
153         , m_type(type)
154     {
155     }
156 
PropertyListNode(JSGlobalData * globalData,PropertyNode * node)157     inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node)
158         : Node(globalData)
159         , m_node(node)
160         , m_next(0)
161     {
162     }
163 
PropertyListNode(JSGlobalData * globalData,PropertyNode * node,PropertyListNode * list)164     inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node, PropertyListNode* list)
165         : Node(globalData)
166         , m_node(node)
167         , m_next(0)
168     {
169         list->m_next = this;
170     }
171 
ObjectLiteralNode(JSGlobalData * globalData)172     inline ObjectLiteralNode::ObjectLiteralNode(JSGlobalData* globalData)
173         : ExpressionNode(globalData)
174         , m_list(0)
175     {
176     }
177 
ObjectLiteralNode(JSGlobalData * globalData,PropertyListNode * list)178     inline ObjectLiteralNode::ObjectLiteralNode(JSGlobalData* globalData, PropertyListNode* list)
179         : ExpressionNode(globalData)
180         , m_list(list)
181     {
182     }
183 
BracketAccessorNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,bool subscriptHasAssignments)184     inline BracketAccessorNode::BracketAccessorNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments)
185         : ExpressionNode(globalData)
186         , m_base(base)
187         , m_subscript(subscript)
188         , m_subscriptHasAssignments(subscriptHasAssignments)
189     {
190     }
191 
DotAccessorNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident)192     inline DotAccessorNode::DotAccessorNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident)
193         : ExpressionNode(globalData)
194         , m_base(base)
195         , m_ident(ident)
196     {
197     }
198 
ArgumentListNode(JSGlobalData * globalData,ExpressionNode * expr)199     inline ArgumentListNode::ArgumentListNode(JSGlobalData* globalData, ExpressionNode* expr)
200         : Node(globalData)
201         , m_next(0)
202         , m_expr(expr)
203     {
204     }
205 
ArgumentListNode(JSGlobalData * globalData,ArgumentListNode * listNode,ExpressionNode * expr)206     inline ArgumentListNode::ArgumentListNode(JSGlobalData* globalData, ArgumentListNode* listNode, ExpressionNode* expr)
207         : Node(globalData)
208         , m_next(0)
209         , m_expr(expr)
210     {
211         listNode->m_next = this;
212     }
213 
ArgumentsNode(JSGlobalData *)214     inline ArgumentsNode::ArgumentsNode(JSGlobalData*)
215         : m_listNode(0)
216     {
217     }
218 
ArgumentsNode(JSGlobalData *,ArgumentListNode * listNode)219     inline ArgumentsNode::ArgumentsNode(JSGlobalData*, ArgumentListNode* listNode)
220         : m_listNode(listNode)
221     {
222     }
223 
NewExprNode(JSGlobalData * globalData,ExpressionNode * expr)224     inline NewExprNode::NewExprNode(JSGlobalData* globalData, ExpressionNode* expr)
225         : ExpressionNode(globalData)
226         , m_expr(expr)
227         , m_args(0)
228     {
229     }
230 
NewExprNode(JSGlobalData * globalData,ExpressionNode * expr,ArgumentsNode * args)231     inline NewExprNode::NewExprNode(JSGlobalData* globalData, ExpressionNode* expr, ArgumentsNode* args)
232         : ExpressionNode(globalData)
233         , m_expr(expr)
234         , m_args(args)
235     {
236     }
237 
EvalFunctionCallNode(JSGlobalData * globalData,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)238     inline EvalFunctionCallNode::EvalFunctionCallNode(JSGlobalData* globalData, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
239         : ExpressionNode(globalData)
240         , ThrowableExpressionData(divot, startOffset, endOffset)
241         , m_args(args)
242     {
243     }
244 
FunctionCallValueNode(JSGlobalData * globalData,ExpressionNode * expr,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)245     inline FunctionCallValueNode::FunctionCallValueNode(JSGlobalData* globalData, ExpressionNode* expr, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
246         : ExpressionNode(globalData)
247         , ThrowableExpressionData(divot, startOffset, endOffset)
248         , m_expr(expr)
249         , m_args(args)
250     {
251     }
252 
FunctionCallResolveNode(JSGlobalData * globalData,const Identifier & ident,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)253     inline FunctionCallResolveNode::FunctionCallResolveNode(JSGlobalData* globalData, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
254         : ExpressionNode(globalData)
255         , ThrowableExpressionData(divot, startOffset, endOffset)
256         , m_ident(ident)
257         , m_args(args)
258     {
259     }
260 
FunctionCallBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)261     inline FunctionCallBracketNode::FunctionCallBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
262         : ExpressionNode(globalData)
263         , ThrowableSubExpressionData(divot, startOffset, endOffset)
264         , m_base(base)
265         , m_subscript(subscript)
266         , m_args(args)
267     {
268     }
269 
FunctionCallDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)270     inline FunctionCallDotNode::FunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
271         : ExpressionNode(globalData)
272         , ThrowableSubExpressionData(divot, startOffset, endOffset)
273         , m_base(base)
274         , m_ident(ident)
275         , m_args(args)
276     {
277     }
278 
CallFunctionCallDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)279     inline CallFunctionCallDotNode::CallFunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
280         : FunctionCallDotNode(globalData, base, ident, args, divot, startOffset, endOffset)
281     {
282     }
283 
ApplyFunctionCallDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,ArgumentsNode * args,unsigned divot,unsigned startOffset,unsigned endOffset)284     inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
285         : FunctionCallDotNode(globalData, base, ident, args, divot, startOffset, endOffset)
286     {
287     }
288 
PrePostResolveNode(JSGlobalData * globalData,const Identifier & ident,unsigned divot,unsigned startOffset,unsigned endOffset)289     inline PrePostResolveNode::PrePostResolveNode(JSGlobalData* globalData, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
290         : ExpressionNode(globalData, ResultType::numberType()) // could be reusable for pre?
291         , ThrowableExpressionData(divot, startOffset, endOffset)
292         , m_ident(ident)
293     {
294     }
295 
PostfixResolveNode(JSGlobalData * globalData,const Identifier & ident,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)296     inline PostfixResolveNode::PostfixResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
297         : PrePostResolveNode(globalData, ident, divot, startOffset, endOffset)
298         , m_operator(oper)
299     {
300     }
301 
PostfixBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)302     inline PostfixBracketNode::PostfixBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
303         : ExpressionNode(globalData)
304         , ThrowableSubExpressionData(divot, startOffset, endOffset)
305         , m_base(base)
306         , m_subscript(subscript)
307         , m_operator(oper)
308     {
309     }
310 
PostfixDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)311     inline PostfixDotNode::PostfixDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
312         : ExpressionNode(globalData)
313         , ThrowableSubExpressionData(divot, startOffset, endOffset)
314         , m_base(base)
315         , m_ident(ident)
316         , m_operator(oper)
317     {
318     }
319 
PostfixErrorNode(JSGlobalData * globalData,ExpressionNode * expr,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)320     inline PostfixErrorNode::PostfixErrorNode(JSGlobalData* globalData, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
321         : ExpressionNode(globalData)
322         , ThrowableSubExpressionData(divot, startOffset, endOffset)
323         , m_expr(expr)
324         , m_operator(oper)
325     {
326     }
327 
DeleteResolveNode(JSGlobalData * globalData,const Identifier & ident,unsigned divot,unsigned startOffset,unsigned endOffset)328     inline DeleteResolveNode::DeleteResolveNode(JSGlobalData* globalData, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
329         : ExpressionNode(globalData)
330         , ThrowableExpressionData(divot, startOffset, endOffset)
331         , m_ident(ident)
332     {
333     }
334 
DeleteBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,unsigned divot,unsigned startOffset,unsigned endOffset)335     inline DeleteBracketNode::DeleteBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, unsigned divot, unsigned startOffset, unsigned endOffset)
336         : ExpressionNode(globalData)
337         , ThrowableExpressionData(divot, startOffset, endOffset)
338         , m_base(base)
339         , m_subscript(subscript)
340     {
341     }
342 
DeleteDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,unsigned divot,unsigned startOffset,unsigned endOffset)343     inline DeleteDotNode::DeleteDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
344         : ExpressionNode(globalData)
345         , ThrowableExpressionData(divot, startOffset, endOffset)
346         , m_base(base)
347         , m_ident(ident)
348     {
349     }
350 
DeleteValueNode(JSGlobalData * globalData,ExpressionNode * expr)351     inline DeleteValueNode::DeleteValueNode(JSGlobalData* globalData, ExpressionNode* expr)
352         : ExpressionNode(globalData)
353         , m_expr(expr)
354     {
355     }
356 
VoidNode(JSGlobalData * globalData,ExpressionNode * expr)357     inline VoidNode::VoidNode(JSGlobalData* globalData, ExpressionNode* expr)
358         : ExpressionNode(globalData)
359         , m_expr(expr)
360     {
361     }
362 
TypeOfResolveNode(JSGlobalData * globalData,const Identifier & ident)363     inline TypeOfResolveNode::TypeOfResolveNode(JSGlobalData* globalData, const Identifier& ident)
364         : ExpressionNode(globalData, ResultType::stringType())
365         , m_ident(ident)
366     {
367     }
368 
TypeOfValueNode(JSGlobalData * globalData,ExpressionNode * expr)369     inline TypeOfValueNode::TypeOfValueNode(JSGlobalData* globalData, ExpressionNode* expr)
370         : ExpressionNode(globalData, ResultType::stringType())
371         , m_expr(expr)
372     {
373     }
374 
PrefixResolveNode(JSGlobalData * globalData,const Identifier & ident,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)375     inline PrefixResolveNode::PrefixResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
376         : PrePostResolveNode(globalData, ident, divot, startOffset, endOffset)
377         , m_operator(oper)
378     {
379     }
380 
PrefixBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)381     inline PrefixBracketNode::PrefixBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
382         : ExpressionNode(globalData)
383         , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset)
384         , m_base(base)
385         , m_subscript(subscript)
386         , m_operator(oper)
387     {
388     }
389 
PrefixDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)390     inline PrefixDotNode::PrefixDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
391         : ExpressionNode(globalData)
392         , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset)
393         , m_base(base)
394         , m_ident(ident)
395         , m_operator(oper)
396     {
397     }
398 
PrefixErrorNode(JSGlobalData * globalData,ExpressionNode * expr,Operator oper,unsigned divot,unsigned startOffset,unsigned endOffset)399     inline PrefixErrorNode::PrefixErrorNode(JSGlobalData* globalData, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
400         : ExpressionNode(globalData)
401         , ThrowableExpressionData(divot, startOffset, endOffset)
402         , m_expr(expr)
403         , m_operator(oper)
404     {
405     }
406 
UnaryOpNode(JSGlobalData * globalData,ResultType type,ExpressionNode * expr,OpcodeID opcodeID)407     inline UnaryOpNode::UnaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr, OpcodeID opcodeID)
408         : ExpressionNode(globalData, type)
409         , m_expr(expr)
410         , m_opcodeID(opcodeID)
411     {
412     }
413 
UnaryPlusNode(JSGlobalData * globalData,ExpressionNode * expr)414     inline UnaryPlusNode::UnaryPlusNode(JSGlobalData* globalData, ExpressionNode* expr)
415         : UnaryOpNode(globalData, ResultType::numberType(), expr, op_to_jsnumber)
416     {
417     }
418 
NegateNode(JSGlobalData * globalData,ExpressionNode * expr)419     inline NegateNode::NegateNode(JSGlobalData* globalData, ExpressionNode* expr)
420         : UnaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr, op_negate)
421     {
422     }
423 
BitwiseNotNode(JSGlobalData * globalData,ExpressionNode * expr)424     inline BitwiseNotNode::BitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr)
425         : UnaryOpNode(globalData, ResultType::forBitOp(), expr, op_bitnot)
426     {
427     }
428 
LogicalNotNode(JSGlobalData * globalData,ExpressionNode * expr)429     inline LogicalNotNode::LogicalNotNode(JSGlobalData* globalData, ExpressionNode* expr)
430         : UnaryOpNode(globalData, ResultType::booleanType(), expr, op_not)
431     {
432     }
433 
BinaryOpNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)434     inline BinaryOpNode::BinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
435         : ExpressionNode(globalData)
436         , m_expr1(expr1)
437         , m_expr2(expr2)
438         , m_opcodeID(opcodeID)
439         , m_rightHasAssignments(rightHasAssignments)
440     {
441     }
442 
BinaryOpNode(JSGlobalData * globalData,ResultType type,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)443     inline BinaryOpNode::BinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
444         : ExpressionNode(globalData, type)
445         , m_expr1(expr1)
446         , m_expr2(expr2)
447         , m_opcodeID(opcodeID)
448         , m_rightHasAssignments(rightHasAssignments)
449     {
450     }
451 
ReverseBinaryOpNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)452     inline ReverseBinaryOpNode::ReverseBinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
453         : BinaryOpNode(globalData, expr1, expr2, opcodeID, rightHasAssignments)
454     {
455     }
456 
ReverseBinaryOpNode(JSGlobalData * globalData,ResultType type,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)457     inline ReverseBinaryOpNode::ReverseBinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
458         : BinaryOpNode(globalData, type, expr1, expr2, opcodeID, rightHasAssignments)
459     {
460     }
461 
MultNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)462     inline MultNode::MultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
463         : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_mul, rightHasAssignments)
464     {
465     }
466 
DivNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)467     inline DivNode::DivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
468         : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_div, rightHasAssignments)
469     {
470     }
471 
472 
ModNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)473     inline ModNode::ModNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
474         : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_mod, rightHasAssignments)
475     {
476     }
477 
AddNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)478     inline AddNode::AddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
479         : BinaryOpNode(globalData, ResultType::forAdd(expr1->resultDescriptor(), expr2->resultDescriptor()), expr1, expr2, op_add, rightHasAssignments)
480     {
481     }
482 
SubNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)483     inline SubNode::SubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
484         : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_sub, rightHasAssignments)
485     {
486     }
487 
LeftShiftNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)488     inline LeftShiftNode::LeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
489         : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_lshift, rightHasAssignments)
490     {
491     }
492 
RightShiftNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)493     inline RightShiftNode::RightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
494         : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_rshift, rightHasAssignments)
495     {
496     }
497 
UnsignedRightShiftNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)498     inline UnsignedRightShiftNode::UnsignedRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
499         : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_urshift, rightHasAssignments)
500     {
501     }
502 
LessNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)503     inline LessNode::LessNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
504         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments)
505     {
506     }
507 
GreaterNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)508     inline GreaterNode::GreaterNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
509         : ReverseBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments)
510     {
511     }
512 
LessEqNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)513     inline LessEqNode::LessEqNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
514         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments)
515     {
516     }
517 
GreaterEqNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)518     inline GreaterEqNode::GreaterEqNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
519         : ReverseBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments)
520     {
521     }
522 
ThrowableBinaryOpNode(JSGlobalData * globalData,ResultType type,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)523     inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
524         : BinaryOpNode(globalData, type, expr1, expr2, opcodeID, rightHasAssignments)
525     {
526     }
527 
ThrowableBinaryOpNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,OpcodeID opcodeID,bool rightHasAssignments)528     inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
529         : BinaryOpNode(globalData, expr1, expr2, opcodeID, rightHasAssignments)
530     {
531     }
532 
InstanceOfNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)533     inline InstanceOfNode::InstanceOfNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
534         : ThrowableBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_instanceof, rightHasAssignments)
535     {
536     }
537 
InNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)538     inline InNode::InNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
539         : ThrowableBinaryOpNode(globalData, expr1, expr2, op_in, rightHasAssignments)
540     {
541     }
542 
EqualNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)543     inline EqualNode::EqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
544         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_eq, rightHasAssignments)
545     {
546     }
547 
NotEqualNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)548     inline NotEqualNode::NotEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
549         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_neq, rightHasAssignments)
550     {
551     }
552 
StrictEqualNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)553     inline StrictEqualNode::StrictEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
554         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_stricteq, rightHasAssignments)
555     {
556     }
557 
NotStrictEqualNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)558     inline NotStrictEqualNode::NotStrictEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
559         : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_nstricteq, rightHasAssignments)
560     {
561     }
562 
BitAndNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)563     inline BitAndNode::BitAndNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
564         : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitand, rightHasAssignments)
565     {
566     }
567 
BitOrNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)568     inline BitOrNode::BitOrNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
569         : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitor, rightHasAssignments)
570     {
571     }
572 
BitXOrNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,bool rightHasAssignments)573     inline BitXOrNode::BitXOrNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
574         : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitxor, rightHasAssignments)
575     {
576     }
577 
LogicalOpNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,LogicalOperator oper)578     inline LogicalOpNode::LogicalOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator oper)
579         : ExpressionNode(globalData, ResultType::booleanType())
580         , m_expr1(expr1)
581         , m_expr2(expr2)
582         , m_operator(oper)
583     {
584     }
585 
ConditionalNode(JSGlobalData * globalData,ExpressionNode * logical,ExpressionNode * expr1,ExpressionNode * expr2)586     inline ConditionalNode::ConditionalNode(JSGlobalData* globalData, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2)
587         : ExpressionNode(globalData)
588         , m_logical(logical)
589         , m_expr1(expr1)
590         , m_expr2(expr2)
591     {
592     }
593 
ReadModifyResolveNode(JSGlobalData * globalData,const Identifier & ident,Operator oper,ExpressionNode * right,bool rightHasAssignments,unsigned divot,unsigned startOffset,unsigned endOffset)594     inline ReadModifyResolveNode::ReadModifyResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, ExpressionNode*  right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
595         : ExpressionNode(globalData)
596         , ThrowableExpressionData(divot, startOffset, endOffset)
597         , m_ident(ident)
598         , m_right(right)
599         , m_operator(oper)
600         , m_rightHasAssignments(rightHasAssignments)
601     {
602     }
603 
AssignResolveNode(JSGlobalData * globalData,const Identifier & ident,ExpressionNode * right,bool rightHasAssignments)604     inline AssignResolveNode::AssignResolveNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments)
605         : ExpressionNode(globalData)
606         , m_ident(ident)
607         , m_right(right)
608         , m_rightHasAssignments(rightHasAssignments)
609     {
610     }
611 
ReadModifyBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,Operator oper,ExpressionNode * right,bool subscriptHasAssignments,bool rightHasAssignments,unsigned divot,unsigned startOffset,unsigned endOffset)612     inline ReadModifyBracketNode::ReadModifyBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
613         : ExpressionNode(globalData)
614         , ThrowableSubExpressionData(divot, startOffset, endOffset)
615         , m_base(base)
616         , m_subscript(subscript)
617         , m_right(right)
618         , m_operator(oper)
619         , m_subscriptHasAssignments(subscriptHasAssignments)
620         , m_rightHasAssignments(rightHasAssignments)
621     {
622     }
623 
AssignBracketNode(JSGlobalData * globalData,ExpressionNode * base,ExpressionNode * subscript,ExpressionNode * right,bool subscriptHasAssignments,bool rightHasAssignments,unsigned divot,unsigned startOffset,unsigned endOffset)624     inline AssignBracketNode::AssignBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
625         : ExpressionNode(globalData)
626         , ThrowableExpressionData(divot, startOffset, endOffset)
627         , m_base(base)
628         , m_subscript(subscript)
629         , m_right(right)
630         , m_subscriptHasAssignments(subscriptHasAssignments)
631         , m_rightHasAssignments(rightHasAssignments)
632     {
633     }
634 
AssignDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,ExpressionNode * right,bool rightHasAssignments,unsigned divot,unsigned startOffset,unsigned endOffset)635     inline AssignDotNode::AssignDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
636         : ExpressionNode(globalData)
637         , ThrowableExpressionData(divot, startOffset, endOffset)
638         , m_base(base)
639         , m_ident(ident)
640         , m_right(right)
641         , m_rightHasAssignments(rightHasAssignments)
642     {
643     }
644 
ReadModifyDotNode(JSGlobalData * globalData,ExpressionNode * base,const Identifier & ident,Operator oper,ExpressionNode * right,bool rightHasAssignments,unsigned divot,unsigned startOffset,unsigned endOffset)645     inline ReadModifyDotNode::ReadModifyDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
646         : ExpressionNode(globalData)
647         , ThrowableSubExpressionData(divot, startOffset, endOffset)
648         , m_base(base)
649         , m_ident(ident)
650         , m_right(right)
651         , m_operator(oper)
652         , m_rightHasAssignments(rightHasAssignments)
653     {
654     }
655 
AssignErrorNode(JSGlobalData * globalData,ExpressionNode * left,Operator oper,ExpressionNode * right,unsigned divot,unsigned startOffset,unsigned endOffset)656     inline AssignErrorNode::AssignErrorNode(JSGlobalData* globalData, ExpressionNode* left, Operator oper, ExpressionNode* right, unsigned divot, unsigned startOffset, unsigned endOffset)
657         : ExpressionNode(globalData)
658         , ThrowableExpressionData(divot, startOffset, endOffset)
659         , m_left(left)
660         , m_operator(oper)
661         , m_right(right)
662     {
663     }
664 
CommaNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2)665     inline CommaNode::CommaNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2)
666         : ExpressionNode(globalData)
667     {
668         m_expressions.append(expr1);
669         m_expressions.append(expr2);
670     }
671 
ConstStatementNode(JSGlobalData * globalData,ConstDeclNode * next)672     inline ConstStatementNode::ConstStatementNode(JSGlobalData* globalData, ConstDeclNode* next)
673         : StatementNode(globalData)
674         , m_next(next)
675     {
676     }
677 
SourceElements(JSGlobalData *)678     inline SourceElements::SourceElements(JSGlobalData*)
679     {
680     }
681 
EmptyStatementNode(JSGlobalData * globalData)682     inline EmptyStatementNode::EmptyStatementNode(JSGlobalData* globalData)
683         : StatementNode(globalData)
684     {
685     }
686 
DebuggerStatementNode(JSGlobalData * globalData)687     inline DebuggerStatementNode::DebuggerStatementNode(JSGlobalData* globalData)
688         : StatementNode(globalData)
689     {
690     }
691 
ExprStatementNode(JSGlobalData * globalData,ExpressionNode * expr)692     inline ExprStatementNode::ExprStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
693         : StatementNode(globalData)
694         , m_expr(expr)
695     {
696     }
697 
VarStatementNode(JSGlobalData * globalData,ExpressionNode * expr)698     inline VarStatementNode::VarStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
699         : StatementNode(globalData)
700         , m_expr(expr)
701     {
702     }
703 
IfNode(JSGlobalData * globalData,ExpressionNode * condition,StatementNode * ifBlock)704     inline IfNode::IfNode(JSGlobalData* globalData, ExpressionNode* condition, StatementNode* ifBlock)
705         : StatementNode(globalData)
706         , m_condition(condition)
707         , m_ifBlock(ifBlock)
708     {
709     }
710 
IfElseNode(JSGlobalData * globalData,ExpressionNode * condition,StatementNode * ifBlock,StatementNode * elseBlock)711     inline IfElseNode::IfElseNode(JSGlobalData* globalData, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock)
712         : IfNode(globalData, condition, ifBlock)
713         , m_elseBlock(elseBlock)
714     {
715     }
716 
DoWhileNode(JSGlobalData * globalData,StatementNode * statement,ExpressionNode * expr)717     inline DoWhileNode::DoWhileNode(JSGlobalData* globalData, StatementNode* statement, ExpressionNode* expr)
718         : StatementNode(globalData)
719         , m_statement(statement)
720         , m_expr(expr)
721     {
722     }
723 
WhileNode(JSGlobalData * globalData,ExpressionNode * expr,StatementNode * statement)724     inline WhileNode::WhileNode(JSGlobalData* globalData, ExpressionNode* expr, StatementNode* statement)
725         : StatementNode(globalData)
726         , m_expr(expr)
727         , m_statement(statement)
728     {
729     }
730 
ForNode(JSGlobalData * globalData,ExpressionNode * expr1,ExpressionNode * expr2,ExpressionNode * expr3,StatementNode * statement,bool expr1WasVarDecl)731     inline ForNode::ForNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode* statement, bool expr1WasVarDecl)
732         : StatementNode(globalData)
733         , m_expr1(expr1)
734         , m_expr2(expr2)
735         , m_expr3(expr3)
736         , m_statement(statement)
737         , m_expr1WasVarDecl(expr1 && expr1WasVarDecl)
738     {
739         ASSERT(statement);
740     }
741 
ContinueNode(JSGlobalData * globalData)742     inline ContinueNode::ContinueNode(JSGlobalData* globalData)
743         : StatementNode(globalData)
744     {
745     }
746 
ContinueNode(JSGlobalData * globalData,const Identifier & ident)747     inline ContinueNode::ContinueNode(JSGlobalData* globalData, const Identifier& ident)
748         : StatementNode(globalData)
749         , m_ident(ident)
750     {
751     }
752 
BreakNode(JSGlobalData * globalData)753     inline BreakNode::BreakNode(JSGlobalData* globalData)
754         : StatementNode(globalData)
755     {
756     }
757 
BreakNode(JSGlobalData * globalData,const Identifier & ident)758     inline BreakNode::BreakNode(JSGlobalData* globalData, const Identifier& ident)
759         : StatementNode(globalData)
760         , m_ident(ident)
761     {
762     }
763 
ReturnNode(JSGlobalData * globalData,ExpressionNode * value)764     inline ReturnNode::ReturnNode(JSGlobalData* globalData, ExpressionNode* value)
765         : StatementNode(globalData)
766         , m_value(value)
767     {
768     }
769 
WithNode(JSGlobalData * globalData,ExpressionNode * expr,StatementNode * statement,uint32_t divot,uint32_t expressionLength)770     inline WithNode::WithNode(JSGlobalData* globalData, ExpressionNode* expr, StatementNode* statement, uint32_t divot, uint32_t expressionLength)
771         : StatementNode(globalData)
772         , m_expr(expr)
773         , m_statement(statement)
774         , m_divot(divot)
775         , m_expressionLength(expressionLength)
776     {
777     }
778 
LabelNode(JSGlobalData * globalData,const Identifier & name,StatementNode * statement)779     inline LabelNode::LabelNode(JSGlobalData* globalData, const Identifier& name, StatementNode* statement)
780         : StatementNode(globalData)
781         , m_name(name)
782         , m_statement(statement)
783     {
784     }
785 
ThrowNode(JSGlobalData * globalData,ExpressionNode * expr)786     inline ThrowNode::ThrowNode(JSGlobalData* globalData, ExpressionNode* expr)
787         : StatementNode(globalData)
788         , m_expr(expr)
789     {
790     }
791 
TryNode(JSGlobalData * globalData,StatementNode * tryBlock,const Identifier & exceptionIdent,bool catchHasEval,StatementNode * catchBlock,StatementNode * finallyBlock)792     inline TryNode::TryNode(JSGlobalData* globalData, StatementNode* tryBlock, const Identifier& exceptionIdent, bool catchHasEval, StatementNode* catchBlock, StatementNode* finallyBlock)
793         : StatementNode(globalData)
794         , m_tryBlock(tryBlock)
795         , m_exceptionIdent(exceptionIdent)
796         , m_catchBlock(catchBlock)
797         , m_finallyBlock(finallyBlock)
798         , m_catchHasEval(catchHasEval)
799     {
800     }
801 
ParameterNode(JSGlobalData *,const Identifier & ident)802     inline ParameterNode::ParameterNode(JSGlobalData*, const Identifier& ident)
803         : m_ident(ident)
804         , m_next(0)
805     {
806     }
807 
ParameterNode(JSGlobalData *,ParameterNode * l,const Identifier & ident)808     inline ParameterNode::ParameterNode(JSGlobalData*, ParameterNode* l, const Identifier& ident)
809         : m_ident(ident)
810         , m_next(0)
811     {
812         l->m_next = this;
813     }
814 
FuncExprNode(JSGlobalData * globalData,const Identifier & ident,FunctionBodyNode * body,const SourceCode & source,ParameterNode * parameter)815     inline FuncExprNode::FuncExprNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
816         : ExpressionNode(globalData)
817         , ParserArenaRefCounted(globalData)
818         , m_ident(ident)
819         , m_body(body)
820     {
821         m_body->finishParsing(source, parameter);
822     }
823 
FuncDeclNode(JSGlobalData * globalData,const Identifier & ident,FunctionBodyNode * body,const SourceCode & source,ParameterNode * parameter)824     inline FuncDeclNode::FuncDeclNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
825         : StatementNode(globalData)
826         , ParserArenaRefCounted(globalData)
827         , m_ident(ident)
828         , m_body(body)
829     {
830         m_body->finishParsing(source, parameter);
831     }
832 
CaseClauseNode(JSGlobalData *,ExpressionNode * expr)833     inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr)
834         : m_expr(expr)
835     {
836     }
837 
CaseClauseNode(JSGlobalData *,ExpressionNode * expr,SourceElements * children)838     inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr, SourceElements* children)
839         : m_expr(expr)
840     {
841         if (children)
842             children->releaseContentsIntoVector(m_children);
843     }
844 
ClauseListNode(JSGlobalData *,CaseClauseNode * clause)845     inline ClauseListNode::ClauseListNode(JSGlobalData*, CaseClauseNode* clause)
846         : m_clause(clause)
847         , m_next(0)
848     {
849     }
850 
ClauseListNode(JSGlobalData *,ClauseListNode * clauseList,CaseClauseNode * clause)851     inline ClauseListNode::ClauseListNode(JSGlobalData*, ClauseListNode* clauseList, CaseClauseNode* clause)
852         : m_clause(clause)
853         , m_next(0)
854     {
855         clauseList->m_next = this;
856     }
857 
CaseBlockNode(JSGlobalData *,ClauseListNode * list1,CaseClauseNode * defaultClause,ClauseListNode * list2)858     inline CaseBlockNode::CaseBlockNode(JSGlobalData*, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2)
859         : m_list1(list1)
860         , m_defaultClause(defaultClause)
861         , m_list2(list2)
862     {
863     }
864 
SwitchNode(JSGlobalData * globalData,ExpressionNode * expr,CaseBlockNode * block)865     inline SwitchNode::SwitchNode(JSGlobalData* globalData, ExpressionNode* expr, CaseBlockNode* block)
866         : StatementNode(globalData)
867         , m_expr(expr)
868         , m_block(block)
869     {
870     }
871 
ConstDeclNode(JSGlobalData * globalData,const Identifier & ident,ExpressionNode * init)872     inline ConstDeclNode::ConstDeclNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* init)
873         : ExpressionNode(globalData)
874         , m_ident(ident)
875         , m_next(0)
876         , m_init(init)
877     {
878     }
879 
BlockNode(JSGlobalData * globalData,SourceElements * children)880     inline BlockNode::BlockNode(JSGlobalData* globalData, SourceElements* children)
881         : StatementNode(globalData)
882     {
883         if (children)
884             children->releaseContentsIntoVector(m_children);
885     }
886 
ForInNode(JSGlobalData * globalData,ExpressionNode * l,ExpressionNode * expr,StatementNode * statement)887     inline ForInNode::ForInNode(JSGlobalData* globalData, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
888         : StatementNode(globalData)
889         , m_init(0)
890         , m_lexpr(l)
891         , m_expr(expr)
892         , m_statement(statement)
893         , m_identIsVarDecl(false)
894     {
895     }
896 
ForInNode(JSGlobalData * globalData,const Identifier & ident,ExpressionNode * in,ExpressionNode * expr,StatementNode * statement,int divot,int startOffset,int endOffset)897     inline ForInNode::ForInNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* in, ExpressionNode* expr, StatementNode* statement, int divot, int startOffset, int endOffset)
898         : StatementNode(globalData)
899         , m_ident(ident)
900         , m_init(0)
901         , m_lexpr(new (globalData) ResolveNode(globalData, ident, divot - startOffset))
902         , m_expr(expr)
903         , m_statement(statement)
904         , m_identIsVarDecl(true)
905     {
906         if (in) {
907             AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, ident, in, true);
908             node->setExceptionSourceCode(divot, divot - startOffset, endOffset - divot);
909             m_init = node;
910         }
911         // for( var foo = bar in baz )
912     }
913 
914 } // namespace JSC
915 
916 #endif // NodeConstructors_h
917