blob: 792e43c63073d43632c72063f420cd77391c2390 [file] [log] [blame]
kocienda66a6d362001-08-24 14:24:45 +00001/*
kocienda66a6d362001-08-24 14:24:45 +00002 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
mjs6f821c82002-03-22 00:31:57 +00003 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
mark.lam@apple.com4b79ce72016-03-11 21:08:08 +00004 * Copyright (C) 2003-2009, 2013, 2015-2016 Apple Inc. All rights reserved.
ggaren6c0384f2007-10-29 05:32:23 +00005 * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
6 * Copyright (C) 2007 Maks Orlovich
eric@webkit.orgf02d3792007-11-08 07:58:15 +00007 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
kocienda66a6d362001-08-24 14:24:45 +00008 *
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
mjscdff33b2006-01-23 21:41:36 +000021 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
ggaren07d4ce62005-07-14 18:27:04 +000022 * Boston, MA 02110-1301, USA.
mjs6f821c82002-03-22 00:31:57 +000023 *
kocienda66a6d362001-08-24 14:24:45 +000024 */
25
ryanhaddad@apple.com22104f52016-09-28 17:08:17 +000026#pragma once
kocienda66a6d362001-08-24 14:24:45 +000027
keith_miller@apple.com1ec869c2016-06-21 17:54:33 +000028#include "BuiltinNames.h"
weinig@apple.comf157abf2008-07-05 05:35:09 +000029#include "Error.h"
joepeck@webkit.orgf26f3b12016-09-30 19:22:50 +000030#include "Interpreter.h"
oliver@apple.come79807b2009-05-05 11:34:23 +000031#include "JITCode.h"
darin@apple.com7bf9de12009-05-11 04:30:14 +000032#include "ParserArena.h"
fpizlo@apple.combb8aa752013-02-18 06:28:54 +000033#include "ParserTokens.h"
barraclough@apple.comb8b15e22008-09-27 01:44:15 +000034#include "ResultType.h"
cwzwarich@webkit.org16e38912008-11-01 01:05:21 +000035#include "SourceCode.h"
weinigc45980a2007-10-27 01:01:20 +000036#include "SymbolTable.h"
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +000037#include "VariableEnvironment.h"
darin@apple.com5b82a722008-01-27 04:21:43 +000038#include <wtf/MathExtras.h>
sbarati@apple.com432a3c92016-04-03 19:45:05 +000039#include <wtf/SmallPtrSet.h>
kocienda66a6d362001-08-24 14:24:45 +000040
cwzwarich@webkit.org3f782f62008-09-08 01:28:33 +000041namespace JSC {
kocienda66a6d362001-08-24 14:24:45 +000042
fpizlo@apple.combc16ddb2016-09-06 01:02:22 +000043 enum OpcodeID : unsigned;
44
oliver@apple.com65e286e2009-04-08 23:08:28 +000045 class ArgumentListNode;
ggaren@apple.com8e06f202008-11-15 21:05:23 +000046 class BytecodeGenerator;
ggaren@apple.come7afe402015-08-10 20:24:35 +000047 class FunctionMetadataNode;
saambarati1@gmail.comc497d152015-07-17 18:48:30 +000048 class FunctionParameters;
mjs@apple.coma46c49c2009-12-06 09:42:03 +000049 class Label;
joepeck@webkit.org7e07f392016-09-22 18:59:47 +000050 class ModuleAnalyzer;
51 class ModuleScopeData;
darin761633b2007-10-28 22:50:59 +000052 class PropertyListNode;
barraclough@apple.com4b2fc992009-05-07 08:27:58 +000053 class ReadModifyResolveNode;
darin@apple.com97ea2422008-11-10 01:28:10 +000054 class RegisterID;
darin@apple.com85a65c32009-08-22 06:40:53 +000055 class ScopeNode;
kocienda66a6d362001-08-24 14:24:45 +000056
sbarati@apple.com432a3c92016-04-03 19:45:05 +000057 typedef SmallPtrSet<UniquedStringImpl*> UniquedStringImplPtrSet;
58
darin761633b2007-10-28 22:50:59 +000059 enum Operator {
60 OpEqual,
61 OpPlusEq,
62 OpMinusEq,
63 OpMultEq,
64 OpDivEq,
65 OpPlusPlus,
66 OpMinusMinus,
67 OpAndEq,
68 OpXOrEq,
69 OpOrEq,
70 OpModEq,
utatane.tea@gmail.come9906382016-07-21 07:33:28 +000071 OpPowEq,
darin761633b2007-10-28 22:50:59 +000072 OpLShift,
73 OpRShift,
barraclough@apple.comfcb5dd72008-07-17 12:06:13 +000074 OpURShift
75 };
76
77 enum LogicalOperator {
78 OpLogicalAnd,
79 OpLogicalOr
darin761633b2007-10-28 22:50:59 +000080 };
81
ggaren@apple.comd7cf35d2013-03-29 19:12:18 +000082 enum FallThroughMode {
83 FallThroughMeansTrue = 0,
84 FallThroughMeansFalse = 1
85 };
86 inline FallThroughMode invert(FallThroughMode fallThroughMode) { return static_cast<FallThroughMode>(!fallThroughMode); }
87
darin@apple.com8c2bac02008-10-09 00:40:43 +000088 namespace DeclarationStacks {
ggaren@apple.come7afe402015-08-10 20:24:35 +000089 typedef Vector<FunctionMetadataNode*> FunctionStack;
darin@apple.com8c2bac02008-10-09 00:40:43 +000090 }
darin@apple.com1076ac22008-01-27 09:38:01 +000091
oliver@apple.com8007f462008-07-24 00:49:46 +000092 struct SwitchInfo {
93 enum SwitchType { SwitchNone, SwitchImmediate, SwitchCharacter, SwitchString };
ggaren@apple.com77dd3c62008-11-15 20:34:40 +000094 uint32_t bytecodeOffset;
oliver@apple.com8007f462008-07-24 00:49:46 +000095 SwitchType switchType;
96 };
97
saambarati1@gmail.come4556722015-07-19 16:57:44 +000098 enum class AssignmentContext {
99 DeclarationStatement,
100 ConstDeclarationStatement,
101 AssignmentExpression
102 };
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +0000103
darin@apple.com85a65c32009-08-22 06:40:53 +0000104 class ParserArenaFreeable {
105 public:
106 // ParserArenaFreeable objects are are freed when the arena is deleted.
107 // Destructors are not called. Clients must not call delete on such objects.
ggaren@apple.comc0ccae02014-12-03 23:23:56 +0000108 void* operator new(size_t, ParserArena&);
darin@apple.com85a65c32009-08-22 06:40:53 +0000109 };
mrowe@apple.com224b7e82009-08-20 18:04:37 +0000110
darin@apple.com85a65c32009-08-22 06:40:53 +0000111 class ParserArenaDeletable {
weinig@apple.coma4436412008-01-28 20:50:45 +0000112 public:
darin@apple.com7bf9de12009-05-11 04:30:14 +0000113 virtual ~ParserArenaDeletable() { }
darin@apple.com97ea2422008-11-10 01:28:10 +0000114
darin@apple.com85a65c32009-08-22 06:40:53 +0000115 // ParserArenaDeletable objects are deleted when the arena is deleted.
116 // Clients must not call delete directly on such objects.
ggaren@apple.comc0ccae02014-12-03 23:23:56 +0000117 void* operator new(size_t, ParserArena&);
weinig@apple.coma4436412008-01-28 20:50:45 +0000118 };
ggaren62a50b22007-10-16 21:35:50 +0000119
ggaren@apple.com9e5d58e2014-12-05 00:59:33 +0000120 class ParserArenaRoot {
andersca@apple.com1ad612f2014-02-18 01:32:18 +0000121 WTF_MAKE_FAST_ALLOCATED;
darin@apple.com7bf9de12009-05-11 04:30:14 +0000122 protected:
ggaren@apple.com9e5d58e2014-12-05 00:59:33 +0000123 ParserArenaRoot(ParserArena&);
darin@apple.come615d312009-05-05 23:09:52 +0000124
weinig@apple.coma4436412008-01-28 20:50:45 +0000125 public:
ggaren@apple.com9e5d58e2014-12-05 00:59:33 +0000126 ParserArena& parserArena() { return m_arena; }
127 virtual ~ParserArenaRoot() { }
128
129 protected:
130 ParserArena m_arena;
darin@apple.com7bf9de12009-05-11 04:30:14 +0000131 };
132
darin@apple.com85a65c32009-08-22 06:40:53 +0000133 class Node : public ParserArenaFreeable {
darin@apple.com7bf9de12009-05-11 04:30:14 +0000134 protected:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000135 Node(const JSTokenLocation&);
darin@apple.com74da9e02007-12-20 21:57:18 +0000136
darin@apple.com7bf9de12009-05-11 04:30:14 +0000137 public:
darin@apple.com85a65c32009-08-22 06:40:53 +0000138 virtual ~Node() { }
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000139
ggaren@apple.com8e8bac42015-03-26 23:35:47 +0000140 int firstLine() const { return m_position.line; }
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000141 int startOffset() const { return m_position.offset; }
saambarati1@gmail.comd6961462014-10-30 23:50:54 +0000142 int endOffset() const { return m_endOffset; }
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000143 int lineStartOffset() const { return m_position.lineStartOffset; }
144 const JSTextPosition& position() const { return m_position; }
saambarati1@gmail.comd6961462014-10-30 23:50:54 +0000145 void setEndOffset(int offset) { m_endOffset = offset; }
saambarati1@gmail.com15952502015-02-23 22:10:51 +0000146 void setStartOffset(int offset) { m_position.offset = offset; }
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000147
joepeck@webkit.orgb5fbd452016-10-12 18:47:48 +0000148 bool needsDebugHook() const { return m_needsDebugHook; }
149 void setNeedsDebugHook() { m_needsDebugHook = true; }
150
weinig@apple.coma4436412008-01-28 20:50:45 +0000151 protected:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000152 JSTextPosition m_position;
saambarati1@gmail.comd6961462014-10-30 23:50:54 +0000153 int m_endOffset;
joepeck@webkit.orgb5fbd452016-10-12 18:47:48 +0000154 bool m_needsDebugHook { false };
weinig@apple.coma4436412008-01-28 20:50:45 +0000155 };
156
eseidel93b803f2007-11-09 00:43:52 +0000157 class ExpressionNode : public Node {
darin@apple.com85a65c32009-08-22 06:40:53 +0000158 protected:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000159 ExpressionNode(const JSTokenLocation&, ResultType = ResultType::unknownType());
weinig@apple.coma4436412008-01-28 20:50:45 +0000160
darin@apple.com85a65c32009-08-22 06:40:53 +0000161 public:
ggaren@apple.comd786e6b2013-04-04 23:16:20 +0000162 virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* destination = 0) = 0;
163
oliver@apple.com62cee782009-05-20 01:18:05 +0000164 virtual bool isNumber() const { return false; }
165 virtual bool isString() const { return false; }
commit-queue@webkit.org88a74762015-11-19 22:54:46 +0000166 virtual bool isObjectLiteral() const { return false; }
167 virtual bool isArrayLiteral() const { return false; }
oliver@apple.com62cee782009-05-20 01:18:05 +0000168 virtual bool isNull() const { return false; }
169 virtual bool isPure(BytecodeGenerator&) const { return false; }
ggaren@apple.com81c68cc2013-04-27 06:43:33 +0000170 virtual bool isConstant() const { return false; }
oliver@apple.com62cee782009-05-20 01:18:05 +0000171 virtual bool isLocation() const { return false; }
oliver@apple.com313fcd62014-03-25 20:06:07 +0000172 virtual bool isAssignmentLocation() const { return isLocation(); }
oliver@apple.com62cee782009-05-20 01:18:05 +0000173 virtual bool isResolveNode() const { return false; }
gskachkov@gmail.comad01d6b2016-08-24 13:35:38 +0000174 virtual bool isAssignResolveNode() const { return false; }
oliver@apple.com62cee782009-05-20 01:18:05 +0000175 virtual bool isBracketAccessorNode() const { return false; }
176 virtual bool isDotAccessorNode() const { return false; }
saambarati1@gmail.comcc3bcb62015-07-02 23:53:10 +0000177 virtual bool isDestructuringNode() const { return false; }
commit-queue@webkit.orgc4df9c02016-09-29 19:01:42 +0000178 virtual bool isBaseFuncExprNode() const { return false; }
oliver@apple.com52428202009-06-24 22:01:34 +0000179 virtual bool isFuncExprNode() const { return false; }
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +0000180 virtual bool isArrowFuncExprNode() const { return false; }
mark.lam@apple.com4b79ce72016-03-11 21:08:08 +0000181 virtual bool isClassExprNode() const { return false; }
oliver@apple.com52428202009-06-24 22:01:34 +0000182 virtual bool isCommaNode() const { return false; }
oliver@apple.com62cee782009-05-20 01:18:05 +0000183 virtual bool isSimpleArray() const { return false; }
184 virtual bool isAdd() const { return false; }
barraclough@apple.comb467c4c2010-07-13 20:34:11 +0000185 virtual bool isSubtract() const { return false; }
ggaren@apple.com81c68cc2013-04-27 06:43:33 +0000186 virtual bool isBoolean() const { return false; }
oliver@apple.com72f8a822013-10-17 01:02:34 +0000187 virtual bool isSpreadExpression() const { return false; }
rniwa@webkit.org059ef9b2015-03-09 23:47:06 +0000188 virtual bool isSuperNode() const { return false; }
utatane.tea@gmail.com5e639122017-01-09 22:02:47 +0000189 virtual bool isImportNode() const { return false; }
sbarati@apple.comfa0c1472016-03-14 18:38:28 +0000190 virtual bool isNewTarget() const { return false; }
utatane.tea@gmail.combf8978b2016-02-02 19:33:05 +0000191 virtual bool isBytecodeIntrinsicNode() const { return false; }
mjs@apple.coma46c49c2009-12-06 09:42:03 +0000192
utatane.tea@gmail.com6f1b3f32017-02-16 07:56:48 +0000193 virtual void emitBytecodeInConditionContext(BytecodeGenerator&, Label&, Label&, FallThroughMode);
weinig@apple.coma4436412008-01-28 20:50:45 +0000194
mjs@apple.com9b5c6192008-10-08 10:53:13 +0000195 virtual ExpressionNode* stripUnaryPlus() { return this; }
196
oliver@apple.com62cee782009-05-20 01:18:05 +0000197 ResultType resultDescriptor() const { return m_resultType; }
weinig@apple.coma4436412008-01-28 20:50:45 +0000198
barraclough@apple.comb8b15e22008-09-27 01:44:15 +0000199 private:
darin@apple.comd7f68222009-05-06 17:10:22 +0000200 ResultType m_resultType;
weinig@apple.coma4436412008-01-28 20:50:45 +0000201 };
kocienda66a6d362001-08-24 14:24:45 +0000202
weinig@apple.coma4436412008-01-28 20:50:45 +0000203 class StatementNode : public Node {
darin@apple.com85a65c32009-08-22 06:40:53 +0000204 protected:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000205 StatementNode(const JSTokenLocation&);
darin@apple.comd7f68222009-05-06 17:10:22 +0000206
darin@apple.com85a65c32009-08-22 06:40:53 +0000207 public:
ggaren@apple.comd786e6b2013-04-04 23:16:20 +0000208 virtual void emitBytecode(BytecodeGenerator&, RegisterID* destination = 0) = 0;
209
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000210 void setLoc(unsigned firstLine, unsigned lastLine, int startOffset, int lineStartOffset);
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000211 unsigned lastLine() const { return m_lastLine; }
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000212
ggaren@apple.com86cb7be2014-12-09 01:53:53 +0000213 StatementNode* next() { return m_next; }
214 void setNext(StatementNode* next) { m_next = next; }
215
oliver@apple.com62cee782009-05-20 01:18:05 +0000216 virtual bool isEmptyStatement() const { return false; }
joepeck@webkit.orgb5fbd452016-10-12 18:47:48 +0000217 virtual bool isDebuggerStatement() const { return false; }
joepeck@webkit.orgbb70ac62016-09-30 19:22:37 +0000218 virtual bool isFunctionNode() const { return false; }
oliver@apple.com62cee782009-05-20 01:18:05 +0000219 virtual bool isReturnNode() const { return false; }
220 virtual bool isExprStatement() const { return false; }
ggaren@apple.com81c68cc2013-04-27 06:43:33 +0000221 virtual bool isBreak() const { return false; }
222 virtual bool isContinue() const { return false; }
joepeck@webkit.orgf26f3b12016-09-30 19:22:50 +0000223 virtual bool isLabel() const { return false; }
oliver@apple.com62cee782009-05-20 01:18:05 +0000224 virtual bool isBlock() const { return false; }
ggaren@apple.comddc6f102015-03-20 20:12:10 +0000225 virtual bool isFuncDeclNode() const { return false; }
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +0000226 virtual bool isModuleDeclarationNode() const { return false; }
joepeck@webkit.orgbb70ac62016-09-30 19:22:37 +0000227 virtual bool isForOfNode() const { return false; }
timothy@apple.comdbdf24432009-03-01 20:14:44 +0000228
mark.lam@apple.comfa35e782013-11-19 21:55:16 +0000229 protected:
ggaren@apple.com86cb7be2014-12-09 01:53:53 +0000230 StatementNode* m_next;
weinig@apple.coma4436412008-01-28 20:50:45 +0000231 int m_lastLine;
232 };
233
sbarati@apple.com62be0b02015-09-19 15:36:46 +0000234 class VariableEnvironmentNode : public ParserArenaDeletable {
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +0000235 public:
sbarati@apple.com8e614bd2016-03-10 02:04:20 +0000236 typedef DeclarationStacks::FunctionStack FunctionStack;
237
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +0000238 VariableEnvironmentNode()
239 {
240 }
241
242 VariableEnvironmentNode(VariableEnvironment& lexicalDeclaredVariables);
sbarati@apple.com8e614bd2016-03-10 02:04:20 +0000243 VariableEnvironmentNode(VariableEnvironment& lexicalDeclaredVariables, FunctionStack&&);
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +0000244
245 VariableEnvironment& lexicalVariables() { return m_lexicalVariables; }
sbarati@apple.com8e614bd2016-03-10 02:04:20 +0000246 FunctionStack& functionStack() { return m_functionStack; }
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +0000247
248 protected:
249 VariableEnvironment m_lexicalVariables;
sbarati@apple.com8e614bd2016-03-10 02:04:20 +0000250 FunctionStack m_functionStack;
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +0000251 };
252
ggaren@apple.com81c68cc2013-04-27 06:43:33 +0000253 class ConstantNode : public ExpressionNode {
254 public:
255 ConstantNode(const JSTokenLocation&, ResultType);
darin@apple.com11ff47c2016-03-04 16:47:55 +0000256 bool isPure(BytecodeGenerator&) const override { return true; }
257 bool isConstant() const override { return true; }
ggaren@apple.com81c68cc2013-04-27 06:43:33 +0000258 virtual JSValue jsValue(BytecodeGenerator&) const = 0;
259 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000260 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
utatane.tea@gmail.com6f1b3f32017-02-16 07:56:48 +0000261 void emitBytecodeInConditionContext(BytecodeGenerator&, Label& trueTarget, Label& falseTarget, FallThroughMode) override;
ggaren@apple.com81c68cc2013-04-27 06:43:33 +0000262 };
263
264 class NullNode : public ConstantNode {
weinig@apple.coma4436412008-01-28 20:50:45 +0000265 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000266 NullNode(const JSTokenLocation&);
darin@apple.comd7f68222009-05-06 17:10:22 +0000267
268 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000269 bool isNull() const override { return true; }
270 JSValue jsValue(BytecodeGenerator&) const override { return jsNull(); }
weinig@apple.coma4436412008-01-28 20:50:45 +0000271 };
272
ggaren@apple.com81c68cc2013-04-27 06:43:33 +0000273 class BooleanNode : public ConstantNode {
weinig@apple.coma4436412008-01-28 20:50:45 +0000274 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000275 BooleanNode(const JSTokenLocation&, bool value);
ggaren@apple.com81c68cc2013-04-27 06:43:33 +0000276 bool value() { return m_value; }
oliver@apple.com3812e422014-04-13 18:01:54 +0000277
commit-queue@webkit.org5fb80322014-04-15 17:46:42 +0000278 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000279 bool isBoolean() const override { return true; }
280 JSValue jsValue(BytecodeGenerator&) const override { return jsBoolean(m_value); }
weinig@apple.coma4436412008-01-28 20:50:45 +0000281
cwzwarich@webkit.org9cb74e32008-06-14 05:06:21 +0000282 bool m_value;
weinig@apple.coma4436412008-01-28 20:50:45 +0000283 };
284
ggaren@apple.com81c68cc2013-04-27 06:43:33 +0000285 class NumberNode : public ConstantNode {
weinig@apple.coma4436412008-01-28 20:50:45 +0000286 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000287 NumberNode(const JSTokenLocation&, double value);
benjamin@webkit.org54d94f52015-02-28 03:21:37 +0000288 double value() const { return m_value; }
289 virtual bool isIntegerNode() const = 0;
darin@apple.com49cc03e2016-03-04 17:20:46 +0000290 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) final;
weinig@apple.coma4436412008-01-28 20:50:45 +0000291
292 private:
darin@apple.com49cc03e2016-03-04 17:20:46 +0000293 bool isNumber() const final { return true; }
darin@apple.com11ff47c2016-03-04 16:47:55 +0000294 JSValue jsValue(BytecodeGenerator&) const override { return jsNumber(m_value); }
darin@apple.comd7f68222009-05-06 17:10:22 +0000295
darin@apple.com85a65c32009-08-22 06:40:53 +0000296 double m_value;
weinig@apple.coma4436412008-01-28 20:50:45 +0000297 };
298
benjamin@webkit.org54d94f52015-02-28 03:21:37 +0000299 class DoubleNode : public NumberNode {
300 public:
301 DoubleNode(const JSTokenLocation&, double value);
302
303 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000304 bool isIntegerNode() const override { return false; }
benjamin@webkit.org54d94f52015-02-28 03:21:37 +0000305 };
306
307 // An integer node represent a number represented as an integer (e.g. 42 instead of 42., 42.0, 42e0)
308 class IntegerNode : public DoubleNode {
309 public:
310 IntegerNode(const JSTokenLocation&, double value);
darin@apple.com49cc03e2016-03-04 17:20:46 +0000311 bool isIntegerNode() const final { return true; }
benjamin@webkit.org54d94f52015-02-28 03:21:37 +0000312 };
313
ggaren@apple.com81c68cc2013-04-27 06:43:33 +0000314 class StringNode : public ConstantNode {
weinig@apple.coma4436412008-01-28 20:50:45 +0000315 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000316 StringNode(const JSTokenLocation&, const Identifier&);
darin@apple.com2543b4d2008-09-19 06:32:12 +0000317 const Identifier& value() { return m_value; }
darin@apple.comde5d6e22009-08-20 14:24:49 +0000318
mrowe@apple.com224b7e82009-08-20 18:04:37 +0000319 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000320 bool isString() const override { return true; }
321 JSValue jsValue(BytecodeGenerator&) const override;
darin@apple.comd7f68222009-05-06 17:10:22 +0000322
darin@apple.com85a65c32009-08-22 06:40:53 +0000323 const Identifier& m_value;
weinig@apple.coma4436412008-01-28 20:50:45 +0000324 };
utatane.tea@gmail.com4014aea2015-04-27 00:27:28 +0000325
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000326 class ThrowableExpressionData {
327 public:
328 ThrowableExpressionData()
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000329 : m_divot(-1, -1, -1)
330 , m_divotStart(-1, -1, -1)
331 , m_divotEnd(-1, -1, -1)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000332 {
333 }
334
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000335 ThrowableExpressionData(const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000336 : m_divot(divot)
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000337 , m_divotStart(start)
338 , m_divotEnd(end)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000339 {
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000340 ASSERT(m_divot.offset >= m_divot.lineStartOffset);
341 ASSERT(m_divotStart.offset >= m_divotStart.lineStartOffset);
342 ASSERT(m_divotEnd.offset >= m_divotEnd.lineStartOffset);
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000343 }
weinig@apple.coma4436412008-01-28 20:50:45 +0000344
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000345 void setExceptionSourceCode(const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
346 {
347 ASSERT(divot.offset >= divot.lineStartOffset);
348 ASSERT(divotStart.offset >= divotStart.lineStartOffset);
349 ASSERT(divotEnd.offset >= divotEnd.lineStartOffset);
350 m_divot = divot;
351 m_divotStart = divotStart;
352 m_divotEnd = divotEnd;
353 }
354
355 const JSTextPosition& divot() const { return m_divot; }
356 const JSTextPosition& divotStart() const { return m_divotStart; }
357 const JSTextPosition& divotEnd() const { return m_divotEnd; }
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000358
359 protected:
benjamin@webkit.orgcff06e42012-08-30 21:23:51 +0000360 RegisterID* emitThrowReferenceError(BytecodeGenerator&, const String& message);
darin@apple.com97ea2422008-11-10 01:28:10 +0000361
362 private:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000363 JSTextPosition m_divot;
364 JSTextPosition m_divotStart;
365 JSTextPosition m_divotEnd;
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000366 };
367
368 class ThrowableSubExpressionData : public ThrowableExpressionData {
369 public:
370 ThrowableSubExpressionData()
darin@apple.com85a65c32009-08-22 06:40:53 +0000371 : m_subexpressionDivotOffset(0)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000372 , m_subexpressionEndOffset(0)
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000373 , m_subexpressionLineOffset(0)
374 , m_subexpressionLineStartOffset(0)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000375 {
376 }
377
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000378 ThrowableSubExpressionData(const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
379 : ThrowableExpressionData(divot, divotStart, divotEnd)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000380 , m_subexpressionDivotOffset(0)
381 , m_subexpressionEndOffset(0)
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000382 , m_subexpressionLineOffset(0)
383 , m_subexpressionLineStartOffset(0)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000384 {
385 }
386
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000387 void setSubexpressionInfo(const JSTextPosition& subexpressionDivot, int subexpressionOffset)
darin@apple.com97ea2422008-11-10 01:28:10 +0000388 {
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000389 ASSERT(subexpressionDivot.offset <= divot().offset);
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000390 // Overflow means we can't do this safely, so just point at the primary divot,
391 // divotLine, or divotLineStart.
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000392 if ((divot() - subexpressionDivot.offset) & ~0xFFFF)
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000393 return;
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000394 if ((divot().line - subexpressionDivot.line) & ~0xFFFF)
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000395 return;
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000396 if ((divot().lineStartOffset - subexpressionDivot.lineStartOffset) & ~0xFFFF)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000397 return;
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000398 if ((divotEnd() - subexpressionOffset) & ~0xFFFF)
399 return;
400 m_subexpressionDivotOffset = divot() - subexpressionDivot.offset;
401 m_subexpressionEndOffset = divotEnd() - subexpressionOffset;
402 m_subexpressionLineOffset = divot().line - subexpressionDivot.line;
403 m_subexpressionLineStartOffset = divot().lineStartOffset - subexpressionDivot.lineStartOffset;
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000404 }
405
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000406 JSTextPosition subexpressionDivot()
407 {
408 int newLine = divot().line - m_subexpressionLineOffset;
409 int newOffset = divot().offset - m_subexpressionDivotOffset;
410 int newLineStartOffset = divot().lineStartOffset - m_subexpressionLineStartOffset;
411 return JSTextPosition(newLine, newOffset, newLineStartOffset);
412 }
413 JSTextPosition subexpressionStart() { return divotStart(); }
414 JSTextPosition subexpressionEnd() { return divotEnd() - static_cast<int>(m_subexpressionEndOffset); }
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000415
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000416 protected:
417 uint16_t m_subexpressionDivotOffset;
418 uint16_t m_subexpressionEndOffset;
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000419 uint16_t m_subexpressionLineOffset;
420 uint16_t m_subexpressionLineStartOffset;
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000421 };
422
423 class ThrowablePrefixedSubExpressionData : public ThrowableExpressionData {
424 public:
425 ThrowablePrefixedSubExpressionData()
darin@apple.com85a65c32009-08-22 06:40:53 +0000426 : m_subexpressionDivotOffset(0)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000427 , m_subexpressionStartOffset(0)
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000428 , m_subexpressionLineOffset(0)
429 , m_subexpressionLineStartOffset(0)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000430 {
431 }
432
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000433 ThrowablePrefixedSubExpressionData(const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end)
434 : ThrowableExpressionData(divot, start, end)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000435 , m_subexpressionDivotOffset(0)
436 , m_subexpressionStartOffset(0)
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000437 , m_subexpressionLineOffset(0)
438 , m_subexpressionLineStartOffset(0)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000439 {
440 }
441
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000442 void setSubexpressionInfo(const JSTextPosition& subexpressionDivot, int subexpressionOffset)
darin@apple.com97ea2422008-11-10 01:28:10 +0000443 {
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000444 ASSERT(subexpressionDivot.offset >= divot().offset);
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000445 // Overflow means we can't do this safely, so just point at the primary divot,
446 // divotLine, or divotLineStart.
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000447 if ((subexpressionDivot.offset - divot()) & ~0xFFFF)
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000448 return;
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000449 if ((subexpressionDivot.line - divot().line) & ~0xFFFF)
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000450 return;
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000451 if ((subexpressionDivot.lineStartOffset - divot().lineStartOffset) & ~0xFFFF)
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000452 return;
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000453 if ((subexpressionOffset - divotStart()) & ~0xFFFF)
454 return;
455 m_subexpressionDivotOffset = subexpressionDivot.offset - divot();
456 m_subexpressionStartOffset = subexpressionOffset - divotStart();
457 m_subexpressionLineOffset = subexpressionDivot.line - divot().line;
458 m_subexpressionLineStartOffset = subexpressionDivot.lineStartOffset - divot().lineStartOffset;
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000459 }
460
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000461 JSTextPosition subexpressionDivot()
462 {
463 int newLine = divot().line + m_subexpressionLineOffset;
464 int newOffset = divot().offset + m_subexpressionDivotOffset;
465 int newLineStartOffset = divot().lineStartOffset + m_subexpressionLineStartOffset;
466 return JSTextPosition(newLine, newOffset, newLineStartOffset);
467 }
468 JSTextPosition subexpressionStart() { return divotStart() + static_cast<int>(m_subexpressionStartOffset); }
469 JSTextPosition subexpressionEnd() { return divotEnd(); }
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000470
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000471 protected:
472 uint16_t m_subexpressionDivotOffset;
473 uint16_t m_subexpressionStartOffset;
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000474 uint16_t m_subexpressionLineOffset;
475 uint16_t m_subexpressionLineStartOffset;
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000476 };
477
utatane.tea@gmail.com4014aea2015-04-27 00:27:28 +0000478 class TemplateExpressionListNode : public ParserArenaFreeable {
479 public:
480 TemplateExpressionListNode(ExpressionNode*);
481 TemplateExpressionListNode(TemplateExpressionListNode*, ExpressionNode*);
482
483 ExpressionNode* value() { return m_node; }
484 TemplateExpressionListNode* next() { return m_next; }
485
486 private:
487 TemplateExpressionListNode* m_next { nullptr };
488 ExpressionNode* m_node { nullptr };
489 };
490
491 class TemplateStringNode : public ExpressionNode {
492 public:
utatane.tea@gmail.coma10944d2017-01-28 03:09:12 +0000493 TemplateStringNode(const JSTokenLocation&, const Identifier* cooked, const Identifier* raw);
utatane.tea@gmail.com4014aea2015-04-27 00:27:28 +0000494
utatane.tea@gmail.coma10944d2017-01-28 03:09:12 +0000495 const Identifier* cooked() { return m_cooked; }
496 const Identifier* raw() { return m_raw; }
utatane.tea@gmail.com4014aea2015-04-27 00:27:28 +0000497
498 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000499 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
utatane.tea@gmail.com4014aea2015-04-27 00:27:28 +0000500
utatane.tea@gmail.coma10944d2017-01-28 03:09:12 +0000501 const Identifier* m_cooked;
502 const Identifier* m_raw;
utatane.tea@gmail.com4014aea2015-04-27 00:27:28 +0000503 };
504
505 class TemplateStringListNode : public ParserArenaFreeable {
506 public:
507 TemplateStringListNode(TemplateStringNode*);
508 TemplateStringListNode(TemplateStringListNode*, TemplateStringNode*);
509
510 TemplateStringNode* value() { return m_node; }
511 TemplateStringListNode* next() { return m_next; }
512
513 private:
514 TemplateStringListNode* m_next { nullptr };
515 TemplateStringNode* m_node { nullptr };
516 };
517
518 class TemplateLiteralNode : public ExpressionNode {
519 public:
520 TemplateLiteralNode(const JSTokenLocation&, TemplateStringListNode*);
521 TemplateLiteralNode(const JSTokenLocation&, TemplateStringListNode*, TemplateExpressionListNode*);
522
utatane.tea@gmail.comd68d2482015-05-14 16:07:54 +0000523 TemplateStringListNode* templateStrings() const { return m_templateStrings; }
524 TemplateExpressionListNode* templateExpressions() const { return m_templateExpressions; }
525
utatane.tea@gmail.com4014aea2015-04-27 00:27:28 +0000526 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000527 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
utatane.tea@gmail.com4014aea2015-04-27 00:27:28 +0000528
529 TemplateStringListNode* m_templateStrings;
530 TemplateExpressionListNode* m_templateExpressions;
531 };
utatane.tea@gmail.comd68d2482015-05-14 16:07:54 +0000532
533 class TaggedTemplateNode : public ExpressionNode, public ThrowableExpressionData {
534 public:
535 TaggedTemplateNode(const JSTokenLocation&, ExpressionNode*, TemplateLiteralNode*);
536
537 TemplateLiteralNode* templateLiteral() const { return m_templateLiteral; }
538
539 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000540 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
utatane.tea@gmail.comd68d2482015-05-14 16:07:54 +0000541
542 ExpressionNode* m_tag;
543 TemplateLiteralNode* m_templateLiteral;
544 };
utatane.tea@gmail.com4014aea2015-04-27 00:27:28 +0000545
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000546 class RegExpNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000547 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000548 RegExpNode(const JSTokenLocation&, const Identifier& pattern, const Identifier& flags);
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000549
weinig@apple.coma4436412008-01-28 20:50:45 +0000550 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000551 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +0000552
darin@apple.com85a65c32009-08-22 06:40:53 +0000553 const Identifier& m_pattern;
554 const Identifier& m_flags;
weinig@apple.coma4436412008-01-28 20:50:45 +0000555 };
556
557 class ThisNode : public ExpressionNode {
558 public:
utatane.tea@gmail.comc2029072016-05-24 12:04:35 +0000559 ThisNode(const JSTokenLocation&);
weinig@apple.coma4436412008-01-28 20:50:45 +0000560
darin@apple.comd7f68222009-05-06 17:10:22 +0000561 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000562 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +0000563 };
564
rniwa@webkit.org059ef9b2015-03-09 23:47:06 +0000565 class SuperNode final : public ExpressionNode {
566 public:
567 SuperNode(const JSTokenLocation&);
568
569 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000570 bool isSuperNode() const override { return true; }
571 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
rniwa@webkit.org059ef9b2015-03-09 23:47:06 +0000572 };
573
utatane.tea@gmail.com5e639122017-01-09 22:02:47 +0000574 class ImportNode : public ExpressionNode, public ThrowableExpressionData {
575 public:
576 ImportNode(const JSTokenLocation&, ExpressionNode*);
577
578 private:
579 bool isImportNode() const override { return true; }
580 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
581
582 ExpressionNode* m_expr;
583 };
584
commit-queue@webkit.org17f99e42015-07-21 18:18:42 +0000585 class NewTargetNode final : public ExpressionNode {
586 public:
587 NewTargetNode(const JSTokenLocation&);
588
589 private:
sbarati@apple.comfa0c1472016-03-14 18:38:28 +0000590 bool isNewTarget() const final { return true; }
darin@apple.com11ff47c2016-03-04 16:47:55 +0000591 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
commit-queue@webkit.org17f99e42015-07-21 18:18:42 +0000592 };
593
weinig@apple.coma4436412008-01-28 20:50:45 +0000594 class ResolveNode : public ExpressionNode {
595 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000596 ResolveNode(const JSTokenLocation&, const Identifier&, const JSTextPosition& start);
weinig@apple.coma4436412008-01-28 20:50:45 +0000597
oliver@apple.com62cee782009-05-20 01:18:05 +0000598 const Identifier& identifier() const { return m_ident; }
darin@apple.comd7f68222009-05-06 17:10:22 +0000599
600 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000601 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +0000602
darin@apple.com11ff47c2016-03-04 16:47:55 +0000603 bool isPure(BytecodeGenerator&) const override;
604 bool isLocation() const override { return true; }
605 bool isResolveNode() const override { return true; }
weinig@apple.coma4436412008-01-28 20:50:45 +0000606
darin@apple.com85a65c32009-08-22 06:40:53 +0000607 const Identifier& m_ident;
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000608 JSTextPosition m_start;
weinig@apple.coma4436412008-01-28 20:50:45 +0000609 };
610
darin@apple.com85a65c32009-08-22 06:40:53 +0000611 class ElementNode : public ParserArenaFreeable {
weinig@apple.coma4436412008-01-28 20:50:45 +0000612 public:
msaboff@apple.com2e5003e2011-10-31 22:13:01 +0000613 ElementNode(int elision, ExpressionNode*);
614 ElementNode(ElementNode*, int elision, ExpressionNode*);
darin@apple.comfa069502008-11-10 01:04:30 +0000615
darin@apple.com9ce79022008-06-28 15:50:49 +0000616 int elision() const { return m_elision; }
darin@apple.com59c37152009-05-10 22:32:34 +0000617 ExpressionNode* value() { return m_node; }
618 ElementNode* next() { return m_next; }
weinig@apple.coma4436412008-01-28 20:50:45 +0000619
weinig@apple.coma4436412008-01-28 20:50:45 +0000620 private:
darin@apple.com59c37152009-05-10 22:32:34 +0000621 ElementNode* m_next;
weinig@apple.coma4436412008-01-28 20:50:45 +0000622 int m_elision;
darin@apple.com59c37152009-05-10 22:32:34 +0000623 ExpressionNode* m_node;
weinig@apple.coma4436412008-01-28 20:50:45 +0000624 };
625
626 class ArrayNode : public ExpressionNode {
627 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000628 ArrayNode(const JSTokenLocation&, int elision);
629 ArrayNode(const JSTokenLocation&, ElementNode*);
630 ArrayNode(const JSTokenLocation&, int elision, ElementNode*);
darin@apple.comfa069502008-11-10 01:04:30 +0000631
darin@apple.com11ff47c2016-03-04 16:47:55 +0000632 bool isArrayLiteral() const override { return true; }
commit-queue@webkit.org88a74762015-11-19 22:54:46 +0000633
ggaren@apple.comc0ccae02014-12-03 23:23:56 +0000634 ArgumentListNode* toArgumentList(ParserArena&, int, int) const;
darin@apple.comd7f68222009-05-06 17:10:22 +0000635
oliver@apple.comd055db62013-10-02 19:11:04 +0000636 ElementNode* elements() const { ASSERT(isSimpleArray()); return m_element; }
darin@apple.comd7f68222009-05-06 17:10:22 +0000637 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000638 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000639
darin@apple.com11ff47c2016-03-04 16:47:55 +0000640 bool isSimpleArray() const override;
darin@apple.comd7f68222009-05-06 17:10:22 +0000641
darin@apple.com59c37152009-05-10 22:32:34 +0000642 ElementNode* m_element;
weinig@apple.coma4436412008-01-28 20:50:45 +0000643 int m_elision;
644 bool m_optional;
645 };
646
darin@apple.com85a65c32009-08-22 06:40:53 +0000647 class PropertyNode : public ParserArenaFreeable {
weinig@apple.coma4436412008-01-28 20:50:45 +0000648 public:
commit-queue@webkit.org17b48702015-05-20 16:54:09 +0000649 enum Type { Constant = 1, Getter = 2, Setter = 4, Computed = 8, Shorthand = 16 };
joepeck@webkit.orga26e6e52015-03-06 21:31:27 +0000650 enum PutType { Unknown, KnownDirect };
weinig@apple.coma4436412008-01-28 20:50:45 +0000651
ggaren@apple.comcadd8c52016-04-22 23:04:55 +0000652 PropertyNode(const Identifier&, ExpressionNode*, Type, PutType, SuperBinding, bool isClassProperty);
653 PropertyNode(ExpressionNode* propertyName, ExpressionNode*, Type, PutType, SuperBinding, bool isClassProperty);
rniwa@webkit.org059ef9b2015-03-09 23:47:06 +0000654
oliver@apple.com72d38322013-10-21 19:23:24 +0000655 ExpressionNode* expressionName() const { return m_expression; }
656 const Identifier* name() const { return m_name; }
darin@apple.comfa069502008-11-10 01:04:30 +0000657
rniwa@webkit.org059ef9b2015-03-09 23:47:06 +0000658 Type type() const { return static_cast<Type>(m_type); }
659 bool needsSuperBinding() const { return m_needsSuperBinding; }
ggaren@apple.comcadd8c52016-04-22 23:04:55 +0000660 bool isClassProperty() const { return m_isClassProperty; }
rniwa@webkit.org059ef9b2015-03-09 23:47:06 +0000661 PutType putType() const { return static_cast<PutType>(m_putType); }
weinig@apple.coma4436412008-01-28 20:50:45 +0000662
663 private:
664 friend class PropertyListNode;
oliver@apple.com72d38322013-10-21 19:23:24 +0000665 const Identifier* m_name;
666 ExpressionNode* m_expression;
darin@apple.com59c37152009-05-10 22:32:34 +0000667 ExpressionNode* m_assign;
commit-queue@webkit.org17b48702015-05-20 16:54:09 +0000668 unsigned m_type : 5;
rniwa@webkit.org059ef9b2015-03-09 23:47:06 +0000669 unsigned m_needsSuperBinding : 1;
670 unsigned m_putType : 1;
ggaren@apple.comcadd8c52016-04-22 23:04:55 +0000671 unsigned m_isClassProperty: 1;
weinig@apple.coma4436412008-01-28 20:50:45 +0000672 };
673
ggaren@apple.comd786e6b2013-04-04 23:16:20 +0000674 class PropertyListNode : public ExpressionNode {
weinig@apple.coma4436412008-01-28 20:50:45 +0000675 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000676 PropertyListNode(const JSTokenLocation&, PropertyNode*);
677 PropertyListNode(const JSTokenLocation&, PropertyNode*, PropertyListNode*);
darin@apple.comfa069502008-11-10 01:04:30 +0000678
mark.lam@apple.com47c2f142016-03-16 18:16:32 +0000679 bool hasStaticallyNamedProperty(const Identifier& propName);
680
weinig@apple.coma4436412008-01-28 20:50:45 +0000681 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000682 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
rniwa@webkit.org95698ee2015-01-22 18:07:16 +0000683 void emitPutConstantProperty(BytecodeGenerator&, RegisterID*, PropertyNode&);
684
darin@apple.com59c37152009-05-10 22:32:34 +0000685 PropertyNode* m_node;
686 PropertyListNode* m_next;
weinig@apple.coma4436412008-01-28 20:50:45 +0000687 };
688
689 class ObjectLiteralNode : public ExpressionNode {
690 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000691 ObjectLiteralNode(const JSTokenLocation&);
692 ObjectLiteralNode(const JSTokenLocation&, PropertyListNode*);
darin@apple.com11ff47c2016-03-04 16:47:55 +0000693 bool isObjectLiteral() const override { return true; }
darin@apple.comfa069502008-11-10 01:04:30 +0000694
darin@apple.comd7f68222009-05-06 17:10:22 +0000695 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000696 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +0000697
darin@apple.com59c37152009-05-10 22:32:34 +0000698 PropertyListNode* m_list;
weinig@apple.coma4436412008-01-28 20:50:45 +0000699 };
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000700
701 class BracketAccessorNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000702 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000703 BracketAccessorNode(const JSTokenLocation&, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments);
darin@apple.comfa069502008-11-10 01:04:30 +0000704
darin@apple.com59c37152009-05-10 22:32:34 +0000705 ExpressionNode* base() const { return m_base; }
706 ExpressionNode* subscript() const { return m_subscript; }
weinig@apple.coma4436412008-01-28 20:50:45 +0000707
barraclough@apple.come3aa3f52012-09-06 00:55:46 +0000708 bool subscriptHasAssignments() const { return m_subscriptHasAssignments; }
709
weinig@apple.coma4436412008-01-28 20:50:45 +0000710 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000711 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +0000712
darin@apple.com11ff47c2016-03-04 16:47:55 +0000713 bool isLocation() const override { return true; }
714 bool isBracketAccessorNode() const override { return true; }
darin@apple.comd7f68222009-05-06 17:10:22 +0000715
darin@apple.com59c37152009-05-10 22:32:34 +0000716 ExpressionNode* m_base;
717 ExpressionNode* m_subscript;
cwzwarich@webkit.org1cb10a12008-06-05 09:19:48 +0000718 bool m_subscriptHasAssignments;
weinig@apple.coma4436412008-01-28 20:50:45 +0000719 };
720
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000721 class DotAccessorNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000722 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000723 DotAccessorNode(const JSTokenLocation&, ExpressionNode* base, const Identifier&);
darin@apple.comfa069502008-11-10 01:04:30 +0000724
oliver@apple.com62cee782009-05-20 01:18:05 +0000725 ExpressionNode* base() const { return m_base; }
726 const Identifier& identifier() const { return m_ident; }
weinig@apple.coma4436412008-01-28 20:50:45 +0000727
728 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000729 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +0000730
darin@apple.com11ff47c2016-03-04 16:47:55 +0000731 bool isLocation() const override { return true; }
732 bool isDotAccessorNode() const override { return true; }
darin@apple.comd7f68222009-05-06 17:10:22 +0000733
darin@apple.com59c37152009-05-10 22:32:34 +0000734 ExpressionNode* m_base;
darin@apple.com85a65c32009-08-22 06:40:53 +0000735 const Identifier& m_ident;
weinig@apple.coma4436412008-01-28 20:50:45 +0000736 };
737
oliver@apple.com72f8a822013-10-17 01:02:34 +0000738 class SpreadExpressionNode : public ExpressionNode, public ThrowableExpressionData {
739 public:
740 SpreadExpressionNode(const JSTokenLocation&, ExpressionNode*);
741
742 ExpressionNode* expression() const { return m_expression; }
743
744 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000745 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
oliver@apple.com72f8a822013-10-17 01:02:34 +0000746
darin@apple.com11ff47c2016-03-04 16:47:55 +0000747 bool isSpreadExpression() const override { return true; }
oliver@apple.com72f8a822013-10-17 01:02:34 +0000748 ExpressionNode* m_expression;
749 };
750
ggaren@apple.comd786e6b2013-04-04 23:16:20 +0000751 class ArgumentListNode : public ExpressionNode {
weinig@apple.coma4436412008-01-28 20:50:45 +0000752 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000753 ArgumentListNode(const JSTokenLocation&, ExpressionNode*);
754 ArgumentListNode(const JSTokenLocation&, ArgumentListNode*, ExpressionNode*);
darin@apple.comfa069502008-11-10 01:04:30 +0000755
darin@apple.com59c37152009-05-10 22:32:34 +0000756 ArgumentListNode* m_next;
757 ExpressionNode* m_expr;
darin@apple.comd7f68222009-05-06 17:10:22 +0000758
759 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000760 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +0000761 };
762
darin@apple.com85a65c32009-08-22 06:40:53 +0000763 class ArgumentsNode : public ParserArenaFreeable {
weinig@apple.coma4436412008-01-28 20:50:45 +0000764 public:
msaboff@apple.com2e5003e2011-10-31 22:13:01 +0000765 ArgumentsNode();
766 ArgumentsNode(ArgumentListNode*);
darin@apple.comfa069502008-11-10 01:04:30 +0000767
darin@apple.com59c37152009-05-10 22:32:34 +0000768 ArgumentListNode* m_listNode;
weinig@apple.coma4436412008-01-28 20:50:45 +0000769 };
770
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000771 class NewExprNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000772 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000773 NewExprNode(const JSTokenLocation&, ExpressionNode*);
774 NewExprNode(const JSTokenLocation&, ExpressionNode*, ArgumentsNode*);
darin@apple.comfa069502008-11-10 01:04:30 +0000775
darin@apple.comd7f68222009-05-06 17:10:22 +0000776 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000777 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000778
darin@apple.com59c37152009-05-10 22:32:34 +0000779 ExpressionNode* m_expr;
780 ArgumentsNode* m_args;
weinig@apple.coma4436412008-01-28 20:50:45 +0000781 };
782
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000783 class EvalFunctionCallNode : public ExpressionNode, public ThrowableExpressionData {
ggaren@apple.com61716732008-03-07 19:46:33 +0000784 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000785 EvalFunctionCallNode(const JSTokenLocation&, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +0000786
darin@apple.comd7f68222009-05-06 17:10:22 +0000787 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000788 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
ggaren@apple.com61716732008-03-07 19:46:33 +0000789
darin@apple.com59c37152009-05-10 22:32:34 +0000790 ArgumentsNode* m_args;
ggaren@apple.com61716732008-03-07 19:46:33 +0000791 };
792
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000793 class FunctionCallValueNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000794 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000795 FunctionCallValueNode(const JSTokenLocation&, ExpressionNode*, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +0000796
darin@apple.comd7f68222009-05-06 17:10:22 +0000797 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000798 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +0000799
darin@apple.com59c37152009-05-10 22:32:34 +0000800 ExpressionNode* m_expr;
801 ArgumentsNode* m_args;
weinig@apple.coma4436412008-01-28 20:50:45 +0000802 };
803
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000804 class FunctionCallResolveNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000805 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000806 FunctionCallResolveNode(const JSTokenLocation&, const Identifier&, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
weinig@apple.coma4436412008-01-28 20:50:45 +0000807
darin@apple.comd7f68222009-05-06 17:10:22 +0000808 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000809 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000810
darin@apple.com85a65c32009-08-22 06:40:53 +0000811 const Identifier& m_ident;
darin@apple.com59c37152009-05-10 22:32:34 +0000812 ArgumentsNode* m_args;
weinig@apple.coma4436412008-01-28 20:50:45 +0000813 };
oliver@apple.comc11549e2008-03-18 05:36:26 +0000814
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000815 class FunctionCallBracketNode : public ExpressionNode, public ThrowableSubExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000816 public:
utatane.tea@gmail.comc85b06f2015-05-07 22:35:56 +0000817 FunctionCallBracketNode(const JSTokenLocation&, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +0000818
darin@apple.comd7f68222009-05-06 17:10:22 +0000819 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000820 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +0000821
darin@apple.com59c37152009-05-10 22:32:34 +0000822 ExpressionNode* m_base;
823 ExpressionNode* m_subscript;
824 ArgumentsNode* m_args;
utatane.tea@gmail.comc85b06f2015-05-07 22:35:56 +0000825 bool m_subscriptHasAssignments;
weinig@apple.coma4436412008-01-28 20:50:45 +0000826 };
827
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000828 class FunctionCallDotNode : public ExpressionNode, public ThrowableSubExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000829 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000830 FunctionCallDotNode(const JSTokenLocation&, ExpressionNode* base, const Identifier&, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +0000831
darin@apple.comd7f68222009-05-06 17:10:22 +0000832 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000833 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +0000834
oliver@apple.com6c106002009-03-28 03:50:39 +0000835 protected:
darin@apple.com59c37152009-05-10 22:32:34 +0000836 ExpressionNode* m_base;
darin@apple.com85a65c32009-08-22 06:40:53 +0000837 const Identifier& m_ident;
darin@apple.com59c37152009-05-10 22:32:34 +0000838 ArgumentsNode* m_args;
weinig@apple.coma4436412008-01-28 20:50:45 +0000839 };
840
utatane.tea@gmail.comdefc1662015-04-20 01:45:50 +0000841 class BytecodeIntrinsicNode : public ExpressionNode, public ThrowableExpressionData {
842 public:
utatane.tea@gmail.combf8978b2016-02-02 19:33:05 +0000843 enum class Type {
844 Constant,
845 Function
846 };
847
utatane.tea@gmail.comdefc1662015-04-20 01:45:50 +0000848 typedef RegisterID* (BytecodeIntrinsicNode::* EmitterType)(BytecodeGenerator&, RegisterID*);
849
utatane.tea@gmail.combf8978b2016-02-02 19:33:05 +0000850 BytecodeIntrinsicNode(Type, const JSTokenLocation&, EmitterType, const Identifier&, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
utatane.tea@gmail.comdefc1662015-04-20 01:45:50 +0000851
darin@apple.com11ff47c2016-03-04 16:47:55 +0000852 bool isBytecodeIntrinsicNode() const override { return true; }
utatane.tea@gmail.combf8978b2016-02-02 19:33:05 +0000853
854 Type type() const { return m_type; }
855 EmitterType emitter() const { return m_emitter; }
utatane.tea@gmail.comdefc1662015-04-20 01:45:50 +0000856 const Identifier& identifier() const { return m_ident; }
857
858#define JSC_DECLARE_BYTECODE_INTRINSIC_FUNCTIONS(name) RegisterID* emit_intrinsic_##name(BytecodeGenerator&, RegisterID*);
utatane.tea@gmail.combf8978b2016-02-02 19:33:05 +0000859 JSC_COMMON_BYTECODE_INTRINSIC_FUNCTIONS_EACH_NAME(JSC_DECLARE_BYTECODE_INTRINSIC_FUNCTIONS)
860 JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(JSC_DECLARE_BYTECODE_INTRINSIC_FUNCTIONS)
utatane.tea@gmail.comdefc1662015-04-20 01:45:50 +0000861#undef JSC_DECLARE_BYTECODE_INTRINSIC_FUNCTIONS
862
863 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000864 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
utatane.tea@gmail.comdefc1662015-04-20 01:45:50 +0000865
utatane.tea@gmail.combf8978b2016-02-02 19:33:05 +0000866 Type m_type;
utatane.tea@gmail.comdefc1662015-04-20 01:45:50 +0000867 EmitterType m_emitter;
868 const Identifier& m_ident;
869 ArgumentsNode* m_args;
870 };
871
oliver@apple.com6c106002009-03-28 03:50:39 +0000872 class CallFunctionCallDotNode : public FunctionCallDotNode {
873 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000874 CallFunctionCallDotNode(const JSTokenLocation&, ExpressionNode* base, const Identifier&, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comd7f68222009-05-06 17:10:22 +0000875
876 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000877 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
oliver@apple.com6c106002009-03-28 03:50:39 +0000878 };
oliver@apple.com65e286e2009-04-08 23:08:28 +0000879
880 class ApplyFunctionCallDotNode : public FunctionCallDotNode {
881 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000882 ApplyFunctionCallDotNode(const JSTokenLocation&, ExpressionNode* base, const Identifier&, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comd7f68222009-05-06 17:10:22 +0000883
884 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000885 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
oliver@apple.com65e286e2009-04-08 23:08:28 +0000886 };
oliver@apple.com6c106002009-03-28 03:50:39 +0000887
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000888 class DeleteResolveNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000889 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000890 DeleteResolveNode(const JSTokenLocation&, const Identifier&, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000891
weinig@apple.coma4436412008-01-28 20:50:45 +0000892 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000893 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +0000894
darin@apple.com85a65c32009-08-22 06:40:53 +0000895 const Identifier& m_ident;
weinig@apple.coma4436412008-01-28 20:50:45 +0000896 };
897
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000898 class DeleteBracketNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000899 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000900 DeleteBracketNode(const JSTokenLocation&, ExpressionNode* base, ExpressionNode* subscript, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +0000901
darin@apple.comd7f68222009-05-06 17:10:22 +0000902 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000903 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000904
darin@apple.com59c37152009-05-10 22:32:34 +0000905 ExpressionNode* m_base;
906 ExpressionNode* m_subscript;
weinig@apple.coma4436412008-01-28 20:50:45 +0000907 };
908
oliver@apple.com90b88ae2008-07-19 01:44:24 +0000909 class DeleteDotNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000910 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000911 DeleteDotNode(const JSTokenLocation&, ExpressionNode* base, const Identifier&, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +0000912
darin@apple.comd7f68222009-05-06 17:10:22 +0000913 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000914 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000915
darin@apple.com59c37152009-05-10 22:32:34 +0000916 ExpressionNode* m_base;
darin@apple.com85a65c32009-08-22 06:40:53 +0000917 const Identifier& m_ident;
weinig@apple.coma4436412008-01-28 20:50:45 +0000918 };
919
920 class DeleteValueNode : public ExpressionNode {
921 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000922 DeleteValueNode(const JSTokenLocation&, ExpressionNode*);
darin@apple.comfa069502008-11-10 01:04:30 +0000923
darin@apple.comd7f68222009-05-06 17:10:22 +0000924 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000925 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000926
darin@apple.com59c37152009-05-10 22:32:34 +0000927 ExpressionNode* m_expr;
weinig@apple.coma4436412008-01-28 20:50:45 +0000928 };
929
930 class VoidNode : public ExpressionNode {
931 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000932 VoidNode(const JSTokenLocation&, ExpressionNode*);
darin@apple.comfa069502008-11-10 01:04:30 +0000933
darin@apple.comd7f68222009-05-06 17:10:22 +0000934 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000935 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000936
darin@apple.com59c37152009-05-10 22:32:34 +0000937 ExpressionNode* m_expr;
weinig@apple.coma4436412008-01-28 20:50:45 +0000938 };
939
940 class TypeOfResolveNode : public ExpressionNode {
941 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000942 TypeOfResolveNode(const JSTokenLocation&, const Identifier&);
weinig@apple.coma4436412008-01-28 20:50:45 +0000943
oliver@apple.com62cee782009-05-20 01:18:05 +0000944 const Identifier& identifier() const { return m_ident; }
weinig@apple.coma4436412008-01-28 20:50:45 +0000945
darin@apple.com97ea2422008-11-10 01:28:10 +0000946 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000947 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +0000948
darin@apple.com85a65c32009-08-22 06:40:53 +0000949 const Identifier& m_ident;
weinig@apple.coma4436412008-01-28 20:50:45 +0000950 };
951
weinig@apple.coma4436412008-01-28 20:50:45 +0000952 class TypeOfValueNode : public ExpressionNode {
953 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000954 TypeOfValueNode(const JSTokenLocation&, ExpressionNode*);
weinig@apple.coma4436412008-01-28 20:50:45 +0000955
darin@apple.comd7f68222009-05-06 17:10:22 +0000956 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000957 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000958
darin@apple.com59c37152009-05-10 22:32:34 +0000959 ExpressionNode* m_expr;
weinig@apple.coma4436412008-01-28 20:50:45 +0000960 };
961
barraclough@apple.comff7867a2012-09-05 23:00:29 +0000962 class PrefixNode : public ExpressionNode, public ThrowablePrefixedSubExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +0000963 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000964 PrefixNode(const JSTokenLocation&, ExpressionNode*, Operator, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
weinig@apple.coma4436412008-01-28 20:50:45 +0000965
ggaren@apple.com20c0b6c2013-04-04 18:31:37 +0000966 protected:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000967 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
barraclough@apple.comff7867a2012-09-05 23:00:29 +0000968 virtual RegisterID* emitResolve(BytecodeGenerator&, RegisterID* = 0);
969 virtual RegisterID* emitBracket(BytecodeGenerator&, RegisterID* = 0);
970 virtual RegisterID* emitDot(BytecodeGenerator&, RegisterID* = 0);
darin@apple.comd7f68222009-05-06 17:10:22 +0000971
barraclough@apple.comff7867a2012-09-05 23:00:29 +0000972 ExpressionNode* m_expr;
weinig@apple.coma4436412008-01-28 20:50:45 +0000973 Operator m_operator;
974 };
975
ggaren@apple.com20c0b6c2013-04-04 18:31:37 +0000976 class PostfixNode : public PrefixNode {
977 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +0000978 PostfixNode(const JSTokenLocation&, ExpressionNode*, Operator, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
ggaren@apple.com20c0b6c2013-04-04 18:31:37 +0000979
980 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000981 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
982 RegisterID* emitResolve(BytecodeGenerator&, RegisterID* = 0) override;
983 RegisterID* emitBracket(BytecodeGenerator&, RegisterID* = 0) override;
984 RegisterID* emitDot(BytecodeGenerator&, RegisterID* = 0) override;
ggaren@apple.com20c0b6c2013-04-04 18:31:37 +0000985 };
986
cwzwarich@webkit.org65f5e2b2008-06-16 08:19:17 +0000987 class UnaryOpNode : public ExpressionNode {
988 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +0000989 UnaryOpNode(const JSTokenLocation&, ResultType, ExpressionNode*, OpcodeID);
darin@apple.comfa069502008-11-10 01:04:30 +0000990
cwzwarich@webkit.org65f5e2b2008-06-16 08:19:17 +0000991 protected:
darin@apple.com59c37152009-05-10 22:32:34 +0000992 ExpressionNode* expr() { return m_expr; }
mjs@apple.coma46c49c2009-12-06 09:42:03 +0000993 const ExpressionNode* expr() const { return m_expr; }
utatane.tea@gmail.comdb32c542016-06-30 15:26:47 +0000994 OpcodeID opcodeID() const { return m_opcodeID; }
darin@apple.comd7f68222009-05-06 17:10:22 +0000995
996 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +0000997 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +0000998
darin@apple.com59c37152009-05-10 22:32:34 +0000999 ExpressionNode* m_expr;
darin@apple.comd7f68222009-05-06 17:10:22 +00001000 OpcodeID m_opcodeID;
cwzwarich@webkit.org65f5e2b2008-06-16 08:19:17 +00001001 };
1002
1003 class UnaryPlusNode : public UnaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001004 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001005 UnaryPlusNode(const JSTokenLocation&, ExpressionNode*);
weinig@apple.coma4436412008-01-28 20:50:45 +00001006
darin@apple.comd7f68222009-05-06 17:10:22 +00001007 private:
utatane.tea@gmail.comdb32c542016-06-30 15:26:47 +00001008 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
1009
darin@apple.com11ff47c2016-03-04 16:47:55 +00001010 ExpressionNode* stripUnaryPlus() override { return expr(); }
weinig@apple.coma4436412008-01-28 20:50:45 +00001011 };
1012
cwzwarich@webkit.org65f5e2b2008-06-16 08:19:17 +00001013 class NegateNode : public UnaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001014 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001015 NegateNode(const JSTokenLocation&, ExpressionNode*);
weinig@apple.coma4436412008-01-28 20:50:45 +00001016 };
1017
barraclough@apple.coma6bdfc82012-02-27 18:26:23 +00001018 class BitwiseNotNode : public ExpressionNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001019 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001020 BitwiseNotNode(const JSTokenLocation&, ExpressionNode*);
weinig@apple.coma4436412008-01-28 20:50:45 +00001021
barraclough@apple.coma6bdfc82012-02-27 18:26:23 +00001022 protected:
1023 ExpressionNode* expr() { return m_expr; }
1024 const ExpressionNode* expr() const { return m_expr; }
1025
1026 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001027 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
barraclough@apple.coma6bdfc82012-02-27 18:26:23 +00001028
1029 ExpressionNode* m_expr;
1030 };
1031
cwzwarich@webkit.org65f5e2b2008-06-16 08:19:17 +00001032 class LogicalNotNode : public UnaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001033 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001034 LogicalNotNode(const JSTokenLocation&, ExpressionNode*);
mjs@apple.coma46c49c2009-12-06 09:42:03 +00001035 private:
utatane.tea@gmail.com6f1b3f32017-02-16 07:56:48 +00001036 void emitBytecodeInConditionContext(BytecodeGenerator&, Label& trueTarget, Label& falseTarget, FallThroughMode) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001037 };
1038
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001039 class BinaryOpNode : public ExpressionNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001040 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001041 BinaryOpNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
1042 BinaryOpNode(const JSTokenLocation&, ResultType, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
darin@apple.comfa069502008-11-10 01:04:30 +00001043
darin@apple.com85a65c32009-08-22 06:40:53 +00001044 RegisterID* emitStrcat(BytecodeGenerator& generator, RegisterID* destination, RegisterID* lhs = 0, ReadModifyResolveNode* emitExpressionInfoForMe = 0);
utatane.tea@gmail.com6f1b3f32017-02-16 07:56:48 +00001045 void emitBytecodeInConditionContext(BytecodeGenerator&, Label& trueTarget, Label& falseTarget, FallThroughMode) override;
barraclough@apple.com4b2fc992009-05-07 08:27:58 +00001046
barraclough@apple.comb467c4c2010-07-13 20:34:11 +00001047 ExpressionNode* lhs() { return m_expr1; };
1048 ExpressionNode* rhs() { return m_expr2; };
1049
darin@apple.comd7f68222009-05-06 17:10:22 +00001050 private:
ggaren@apple.com81c68cc2013-04-27 06:43:33 +00001051 void tryFoldToBranch(BytecodeGenerator&, TriState& branchCondition, ExpressionNode*& branchExpression);
darin@apple.com11ff47c2016-03-04 16:47:55 +00001052 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +00001053
1054 protected:
1055 OpcodeID opcodeID() const { return m_opcodeID; }
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001056
1057 protected:
darin@apple.com59c37152009-05-10 22:32:34 +00001058 ExpressionNode* m_expr1;
1059 ExpressionNode* m_expr2;
darin@apple.comd7f68222009-05-06 17:10:22 +00001060 private:
1061 OpcodeID m_opcodeID;
1062 protected:
cwzwarich@webkit.orgce46a1c2008-06-14 07:52:27 +00001063 bool m_rightHasAssignments;
eseideldc7c4972007-11-12 00:34:37 +00001064 };
1065
utatane.tea@gmail.come9906382016-07-21 07:33:28 +00001066 class PowNode : public BinaryOpNode {
1067 public:
1068 PowNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
1069 };
1070
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001071 class MultNode : public BinaryOpNode {
1072 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001073 MultNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001074 };
1075
1076 class DivNode : public BinaryOpNode {
1077 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001078 DivNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001079 };
1080
1081 class ModNode : public BinaryOpNode {
1082 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001083 ModNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001084 };
1085
1086 class AddNode : public BinaryOpNode {
1087 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001088 AddNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
barraclough@apple.com14dc4e12009-05-07 00:06:07 +00001089
darin@apple.com11ff47c2016-03-04 16:47:55 +00001090 bool isAdd() const override { return true; }
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001091 };
1092
1093 class SubNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001094 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001095 SubNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
barraclough@apple.comb467c4c2010-07-13 20:34:11 +00001096
darin@apple.com11ff47c2016-03-04 16:47:55 +00001097 bool isSubtract() const override { return true; }
weinig@apple.coma4436412008-01-28 20:50:45 +00001098 };
oliverc322dca2007-10-23 21:25:44 +00001099
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001100 class LeftShiftNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001101 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001102 LeftShiftNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001103 };
1104
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001105 class RightShiftNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001106 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001107 RightShiftNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001108 };
1109
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001110 class UnsignedRightShiftNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001111 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001112 UnsignedRightShiftNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001113 };
1114
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001115 class LessNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001116 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001117 LessNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001118 };
oliverc322dca2007-10-23 21:25:44 +00001119
barraclough@apple.com57b4bdb82011-07-04 19:26:05 +00001120 class GreaterNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001121 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001122 GreaterNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001123 };
1124
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001125 class LessEqNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001126 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001127 LessEqNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001128 };
1129
barraclough@apple.com57b4bdb82011-07-04 19:26:05 +00001130 class GreaterEqNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001131 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001132 GreaterEqNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001133 };
oliverc322dca2007-10-23 21:25:44 +00001134
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001135 class ThrowableBinaryOpNode : public BinaryOpNode, public ThrowableExpressionData {
1136 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001137 ThrowableBinaryOpNode(const JSTokenLocation&, ResultType, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
1138 ThrowableBinaryOpNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
darin@apple.comd7f68222009-05-06 17:10:22 +00001139
1140 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001141 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001142 };
1143
1144 class InstanceOfNode : public ThrowableBinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001145 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001146 InstanceOfNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001147
darin@apple.comd7f68222009-05-06 17:10:22 +00001148 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001149 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001150 };
oliverc322dca2007-10-23 21:25:44 +00001151
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001152 class InNode : public ThrowableBinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001153 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001154 InNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
keith_miller@apple.com6fc2fb72017-02-09 00:02:20 +00001155
1156 private:
1157 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001158 };
kocienda66a6d362001-08-24 14:24:45 +00001159
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001160 class EqualNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001161 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001162 EqualNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001163
darin@apple.comd7f68222009-05-06 17:10:22 +00001164 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001165 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001166 };
kocienda66a6d362001-08-24 14:24:45 +00001167
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001168 class NotEqualNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001169 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001170 NotEqualNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001171 };
oliverc322dca2007-10-23 21:25:44 +00001172
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001173 class StrictEqualNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001174 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001175 StrictEqualNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001176
darin@apple.comd7f68222009-05-06 17:10:22 +00001177 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001178 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001179 };
oliverc322dca2007-10-23 21:25:44 +00001180
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001181 class NotStrictEqualNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001182 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001183 NotStrictEqualNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001184 };
oliverc322dca2007-10-23 21:25:44 +00001185
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001186 class BitAndNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001187 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001188 BitAndNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001189 };
oliverc322dca2007-10-23 21:25:44 +00001190
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001191 class BitOrNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001192 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001193 BitOrNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001194 };
1195
cwzwarich@webkit.org875318a2008-06-15 09:30:56 +00001196 class BitXOrNode : public BinaryOpNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001197 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001198 BitXOrNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
weinig@apple.coma4436412008-01-28 20:50:45 +00001199 };
1200
darin@apple.comd7f68222009-05-06 17:10:22 +00001201 // m_expr1 && m_expr2, m_expr1 || m_expr2
barraclough@apple.comfcb5dd72008-07-17 12:06:13 +00001202 class LogicalOpNode : public ExpressionNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001203 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001204 LogicalOpNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator);
darin@apple.comfa069502008-11-10 01:04:30 +00001205
darin@apple.comd7f68222009-05-06 17:10:22 +00001206 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001207 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
utatane.tea@gmail.com6f1b3f32017-02-16 07:56:48 +00001208 void emitBytecodeInConditionContext(BytecodeGenerator&, Label& trueTarget, Label& falseTarget, FallThroughMode) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001209
darin@apple.com59c37152009-05-10 22:32:34 +00001210 ExpressionNode* m_expr1;
1211 ExpressionNode* m_expr2;
barraclough@apple.comfcb5dd72008-07-17 12:06:13 +00001212 LogicalOperator m_operator;
weinig@apple.coma4436412008-01-28 20:50:45 +00001213 };
oliverf885d882007-10-30 03:14:00 +00001214
darin@apple.comd7f68222009-05-06 17:10:22 +00001215 // The ternary operator, "m_logical ? m_expr1 : m_expr2"
weinig@apple.coma4436412008-01-28 20:50:45 +00001216 class ConditionalNode : public ExpressionNode {
1217 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001218 ConditionalNode(const JSTokenLocation&, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2);
darin@apple.comfa069502008-11-10 01:04:30 +00001219
darin@apple.comd7f68222009-05-06 17:10:22 +00001220 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001221 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
oliverf885d882007-10-30 03:14:00 +00001222
darin@apple.com59c37152009-05-10 22:32:34 +00001223 ExpressionNode* m_logical;
1224 ExpressionNode* m_expr1;
1225 ExpressionNode* m_expr2;
weinig@apple.coma4436412008-01-28 20:50:45 +00001226 };
darin@apple.com1076ac22008-01-27 09:38:01 +00001227
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001228 class ReadModifyResolveNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001229 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +00001230 ReadModifyResolveNode(const JSTokenLocation&, const Identifier&, Operator, ExpressionNode* right, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +00001231
darin@apple.comd7f68222009-05-06 17:10:22 +00001232 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001233 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001234
darin@apple.com85a65c32009-08-22 06:40:53 +00001235 const Identifier& m_ident;
darin@apple.com59c37152009-05-10 22:32:34 +00001236 ExpressionNode* m_right;
darin@apple.comd7f68222009-05-06 17:10:22 +00001237 Operator m_operator;
1238 bool m_rightHasAssignments;
weinig@apple.coma4436412008-01-28 20:50:45 +00001239 };
mjsf4a2a7f2005-08-11 10:26:54 +00001240
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001241 class AssignResolveNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001242 public:
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001243 AssignResolveNode(const JSTokenLocation&, const Identifier&, ExpressionNode* right, AssignmentContext);
gskachkov@gmail.comad01d6b2016-08-24 13:35:38 +00001244 bool isAssignResolveNode() const override { return true; }
1245 const Identifier& identifier() const { return m_ident; }
darin@apple.comfa069502008-11-10 01:04:30 +00001246
darin@apple.comd7f68222009-05-06 17:10:22 +00001247 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001248 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darined8ee1a2007-04-23 08:38:46 +00001249
darin@apple.com85a65c32009-08-22 06:40:53 +00001250 const Identifier& m_ident;
darin@apple.com59c37152009-05-10 22:32:34 +00001251 ExpressionNode* m_right;
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001252 AssignmentContext m_assignmentContext;
weinig@apple.coma4436412008-01-28 20:50:45 +00001253 };
mjsbb64c242007-11-03 10:09:45 +00001254
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001255 class ReadModifyBracketNode : public ExpressionNode, public ThrowableSubExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001256 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +00001257 ReadModifyBracketNode(const JSTokenLocation&, ExpressionNode* base, ExpressionNode* subscript, Operator, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +00001258
darin@apple.comd7f68222009-05-06 17:10:22 +00001259 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001260 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001261
darin@apple.com59c37152009-05-10 22:32:34 +00001262 ExpressionNode* m_base;
1263 ExpressionNode* m_subscript;
1264 ExpressionNode* m_right;
bfulgham@apple.com9c9b8a12014-06-24 19:49:25 +00001265 unsigned m_operator : 30;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001266 bool m_subscriptHasAssignments : 1;
1267 bool m_rightHasAssignments : 1;
weinig@apple.coma4436412008-01-28 20:50:45 +00001268 };
1269
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001270 class AssignBracketNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001271 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +00001272 AssignBracketNode(const JSTokenLocation&, ExpressionNode* base, ExpressionNode* subscript, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +00001273
darin@apple.comd7f68222009-05-06 17:10:22 +00001274 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001275 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001276
darin@apple.com59c37152009-05-10 22:32:34 +00001277 ExpressionNode* m_base;
1278 ExpressionNode* m_subscript;
1279 ExpressionNode* m_right;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001280 bool m_subscriptHasAssignments : 1;
1281 bool m_rightHasAssignments : 1;
weinig@apple.coma4436412008-01-28 20:50:45 +00001282 };
1283
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001284 class AssignDotNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001285 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +00001286 AssignDotNode(const JSTokenLocation&, ExpressionNode* base, const Identifier&, ExpressionNode* right, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +00001287
darin@apple.comd7f68222009-05-06 17:10:22 +00001288 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001289 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001290
darin@apple.com59c37152009-05-10 22:32:34 +00001291 ExpressionNode* m_base;
darin@apple.com85a65c32009-08-22 06:40:53 +00001292 const Identifier& m_ident;
darin@apple.com59c37152009-05-10 22:32:34 +00001293 ExpressionNode* m_right;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001294 bool m_rightHasAssignments;
weinig@apple.coma4436412008-01-28 20:50:45 +00001295 };
1296
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001297 class ReadModifyDotNode : public ExpressionNode, public ThrowableSubExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001298 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +00001299 ReadModifyDotNode(const JSTokenLocation&, ExpressionNode* base, const Identifier&, Operator, ExpressionNode* right, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +00001300
darin@apple.comd7f68222009-05-06 17:10:22 +00001301 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001302 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001303
darin@apple.com59c37152009-05-10 22:32:34 +00001304 ExpressionNode* m_base;
darin@apple.com85a65c32009-08-22 06:40:53 +00001305 const Identifier& m_ident;
darin@apple.com59c37152009-05-10 22:32:34 +00001306 ExpressionNode* m_right;
bfulgham@apple.com9c9b8a12014-06-24 19:49:25 +00001307 unsigned m_operator : 31;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001308 bool m_rightHasAssignments : 1;
weinig@apple.coma4436412008-01-28 20:50:45 +00001309 };
1310
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001311 class AssignErrorNode : public ExpressionNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001312 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +00001313 AssignErrorNode(const JSTokenLocation&, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
darin@apple.comfa069502008-11-10 01:04:30 +00001314
darin@apple.comd7f68222009-05-06 17:10:22 +00001315 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001316 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001317 };
oliver@apple.com52428202009-06-24 22:01:34 +00001318
gyuyoung.kim@samsung.com9ea47282014-12-09 05:53:00 +00001319 class CommaNode final : public ExpressionNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001320 public:
ggaren@apple.com86cb7be2014-12-09 01:53:53 +00001321 CommaNode(const JSTokenLocation&, ExpressionNode*);
darin@apple.comfa069502008-11-10 01:04:30 +00001322
ggaren@apple.com86cb7be2014-12-09 01:53:53 +00001323 void setNext(CommaNode* next) { m_next = next; }
1324 CommaNode* next() { return m_next; }
oliver@apple.com52428202009-06-24 22:01:34 +00001325
darin@apple.comd7f68222009-05-06 17:10:22 +00001326 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001327 bool isCommaNode() const override { return true; }
1328 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001329
ggaren@apple.com86cb7be2014-12-09 01:53:53 +00001330 ExpressionNode* m_expr;
1331 CommaNode* m_next;
weinig@apple.coma4436412008-01-28 20:50:45 +00001332 };
oliver@apple.com7e36d6a2008-02-09 05:17:06 +00001333
ggaren@apple.com86cb7be2014-12-09 01:53:53 +00001334 class SourceElements final : public ParserArenaFreeable {
darin@apple.com5e49bae2007-12-21 21:54:51 +00001335 public:
msaboff@apple.com2e5003e2011-10-31 22:13:01 +00001336 SourceElements();
ap@webkit.org9e7ecd32008-06-25 07:07:38 +00001337
darin@apple.com59c37152009-05-10 22:32:34 +00001338 void append(StatementNode*);
darin@apple.com85a65c32009-08-22 06:40:53 +00001339
1340 StatementNode* singleStatement() const;
1341 StatementNode* lastStatement() const;
1342
1343 void emitBytecode(BytecodeGenerator&, RegisterID* destination);
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001344 void analyzeModule(ModuleAnalyzer&);
weinig@apple.coma4436412008-01-28 20:50:45 +00001345
darin@apple.com5e49bae2007-12-21 21:54:51 +00001346 private:
ggaren@apple.com86cb7be2014-12-09 01:53:53 +00001347 StatementNode* m_head;
1348 StatementNode* m_tail;
darin@apple.com5e49bae2007-12-21 21:54:51 +00001349 };
1350
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001351 class BlockNode : public StatementNode, public VariableEnvironmentNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001352 public:
sbarati@apple.com62be0b02015-09-19 15:36:46 +00001353 using ParserArenaDeletable::operator new;
1354
sbarati@apple.com8e614bd2016-03-10 02:04:20 +00001355 BlockNode(const JSTokenLocation&, SourceElements*, VariableEnvironment&, FunctionStack&&);
kocienda66a6d362001-08-24 14:24:45 +00001356
barraclough@apple.comb467c4c2010-07-13 20:34:11 +00001357 StatementNode* singleStatement() const;
darin@apple.com85a65c32009-08-22 06:40:53 +00001358 StatementNode* lastStatement() const;
ggaren@apple.com873cb422008-06-02 20:45:13 +00001359
darin@apple.comd7f68222009-05-06 17:10:22 +00001360 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001361 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +00001362
darin@apple.com11ff47c2016-03-04 16:47:55 +00001363 bool isBlock() const override { return true; }
timothy@apple.comdbdf24432009-03-01 20:14:44 +00001364
darin@apple.com85a65c32009-08-22 06:40:53 +00001365 SourceElements* m_statements;
weinig@apple.coma4436412008-01-28 20:50:45 +00001366 };
kocienda66a6d362001-08-24 14:24:45 +00001367
weinig@apple.coma4436412008-01-28 20:50:45 +00001368 class EmptyStatementNode : public StatementNode {
1369 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001370 EmptyStatementNode(const JSTokenLocation&);
mjs@apple.comd0af8292007-12-24 10:13:00 +00001371
darin@apple.comd7f68222009-05-06 17:10:22 +00001372 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001373 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001374
darin@apple.com11ff47c2016-03-04 16:47:55 +00001375 bool isEmptyStatement() const override { return true; }
weinig@apple.coma4436412008-01-28 20:50:45 +00001376 };
oliver@apple.com139b5292008-06-03 22:48:52 +00001377
1378 class DebuggerStatementNode : public StatementNode {
1379 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001380 DebuggerStatementNode(const JSTokenLocation&);
joepeck@webkit.orgb5fbd452016-10-12 18:47:48 +00001381
1382 bool isDebuggerStatement() const override { return true; }
oliver@apple.com139b5292008-06-03 22:48:52 +00001383
darin@apple.comd7f68222009-05-06 17:10:22 +00001384 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001385 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
oliver@apple.com139b5292008-06-03 22:48:52 +00001386 };
weinig@apple.coma4436412008-01-28 20:50:45 +00001387
1388 class ExprStatementNode : public StatementNode {
1389 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001390 ExprStatementNode(const JSTokenLocation&, ExpressionNode*);
weinig@apple.coma4436412008-01-28 20:50:45 +00001391
darin@apple.com59c37152009-05-10 22:32:34 +00001392 ExpressionNode* expr() const { return m_expr; }
weinig@apple.com9b5bf062008-11-20 23:23:59 +00001393
weinig@apple.coma4436412008-01-28 20:50:45 +00001394 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001395 bool isExprStatement() const override { return true; }
darin@apple.comd7f68222009-05-06 17:10:22 +00001396
darin@apple.com11ff47c2016-03-04 16:47:55 +00001397 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +00001398
darin@apple.com59c37152009-05-10 22:32:34 +00001399 ExpressionNode* m_expr;
weinig@apple.coma4436412008-01-28 20:50:45 +00001400 };
1401
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001402 class DeclarationStatement : public StatementNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001403 public:
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001404 DeclarationStatement(const JSTokenLocation&, ExpressionNode*);
darin@apple.comd7f68222009-05-06 17:10:22 +00001405 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001406 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001407
darin@apple.com59c37152009-05-10 22:32:34 +00001408 ExpressionNode* m_expr;
weinig@apple.coma4436412008-01-28 20:50:45 +00001409 };
1410
commit-queue@webkit.org200ce5b2014-08-18 19:11:41 +00001411 class EmptyVarExpression : public ExpressionNode {
1412 public:
1413 EmptyVarExpression(const JSTokenLocation&, const Identifier&);
1414
1415 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001416 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
commit-queue@webkit.org200ce5b2014-08-18 19:11:41 +00001417
1418 const Identifier& m_ident;
1419 };
1420
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001421 class EmptyLetExpression : public ExpressionNode {
1422 public:
1423 EmptyLetExpression(const JSTokenLocation&, const Identifier&);
1424
1425 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001426 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001427
1428 const Identifier& m_ident;
1429 };
commit-queue@webkit.org200ce5b2014-08-18 19:11:41 +00001430
ggaren@apple.com81c68cc2013-04-27 06:43:33 +00001431 class IfElseNode : public StatementNode {
eric@webkit.org52f2ea32007-12-21 07:21:20 +00001432 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001433 IfElseNode(const JSTokenLocation&, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock);
darin@apple.comfa069502008-11-10 01:04:30 +00001434
darin@apple.comd7f68222009-05-06 17:10:22 +00001435 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001436 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
ggaren@apple.com81c68cc2013-04-27 06:43:33 +00001437 bool tryFoldBreakAndContinue(BytecodeGenerator&, StatementNode* ifBlock,
1438 Label*& trueTarget, FallThroughMode&);
weinig@apple.coma4436412008-01-28 20:50:45 +00001439
ggaren@apple.com81c68cc2013-04-27 06:43:33 +00001440 ExpressionNode* m_condition;
1441 StatementNode* m_ifBlock;
darin@apple.com59c37152009-05-10 22:32:34 +00001442 StatementNode* m_elseBlock;
eric@webkit.org52f2ea32007-12-21 07:21:20 +00001443 };
1444
weinig@apple.coma4436412008-01-28 20:50:45 +00001445 class DoWhileNode : public StatementNode {
1446 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001447 DoWhileNode(const JSTokenLocation&, StatementNode*, ExpressionNode*);
darin@apple.comfa069502008-11-10 01:04:30 +00001448
darin@apple.comd7f68222009-05-06 17:10:22 +00001449 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001450 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
kocienda66a6d362001-08-24 14:24:45 +00001451
darin@apple.com59c37152009-05-10 22:32:34 +00001452 StatementNode* m_statement;
1453 ExpressionNode* m_expr;
weinig@apple.coma4436412008-01-28 20:50:45 +00001454 };
1455
1456 class WhileNode : public StatementNode {
1457 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001458 WhileNode(const JSTokenLocation&, ExpressionNode*, StatementNode*);
darin@apple.comfa069502008-11-10 01:04:30 +00001459
darin@apple.comd7f68222009-05-06 17:10:22 +00001460 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001461 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001462
darin@apple.com59c37152009-05-10 22:32:34 +00001463 ExpressionNode* m_expr;
1464 StatementNode* m_statement;
weinig@apple.coma4436412008-01-28 20:50:45 +00001465 };
1466
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001467 class ForNode : public StatementNode, public VariableEnvironmentNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001468 public:
sbarati@apple.com62be0b02015-09-19 15:36:46 +00001469 using ParserArenaDeletable::operator new;
1470
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001471 ForNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode*, VariableEnvironment&);
darin@apple.comfa069502008-11-10 01:04:30 +00001472
darin@apple.comd7f68222009-05-06 17:10:22 +00001473 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001474 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001475
darin@apple.com59c37152009-05-10 22:32:34 +00001476 ExpressionNode* m_expr1;
1477 ExpressionNode* m_expr2;
1478 ExpressionNode* m_expr3;
1479 StatementNode* m_statement;
weinig@apple.coma4436412008-01-28 20:50:45 +00001480 };
oliver@apple.comd055db62013-10-02 19:11:04 +00001481
saambarati1@gmail.comcc3bcb62015-07-02 23:53:10 +00001482 class DestructuringPatternNode;
oliver@apple.com20a9bf02013-10-04 20:35:24 +00001483
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001484 class EnumerationNode : public StatementNode, public ThrowableExpressionData, public VariableEnvironmentNode {
oliver@apple.com20a9bf02013-10-04 20:35:24 +00001485 public:
sbarati@apple.com62be0b02015-09-19 15:36:46 +00001486 using ParserArenaDeletable::operator new;
1487
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001488 EnumerationNode(const JSTokenLocation&, ExpressionNode*, ExpressionNode*, StatementNode*, VariableEnvironment&);
joepeck@webkit.orgbb70ac62016-09-30 19:22:37 +00001489
joepeck@webkit.orgb5fbd452016-10-12 18:47:48 +00001490 ExpressionNode* lexpr() const { return m_lexpr; }
joepeck@webkit.orgbb70ac62016-09-30 19:22:37 +00001491 ExpressionNode* expr() const { return m_expr; }
1492
oliver@apple.com20a9bf02013-10-04 20:35:24 +00001493 protected:
1494 ExpressionNode* m_lexpr;
1495 ExpressionNode* m_expr;
1496 StatementNode* m_statement;
1497 };
1498
1499 class ForInNode : public EnumerationNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001500 public:
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001501 ForInNode(const JSTokenLocation&, ExpressionNode*, ExpressionNode*, StatementNode*, VariableEnvironment&);
darin@apple.comfa069502008-11-10 01:04:30 +00001502
darin@apple.comd7f68222009-05-06 17:10:22 +00001503 private:
fpizlo@apple.coma398a562014-08-06 21:32:55 +00001504 RegisterID* tryGetBoundLocal(BytecodeGenerator&);
1505 void emitLoopHeader(BytecodeGenerator&, RegisterID* propertyName);
fpizlo@apple.coma398a562014-08-06 21:32:55 +00001506
darin@apple.com11ff47c2016-03-04 16:47:55 +00001507 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
oliver@apple.com20a9bf02013-10-04 20:35:24 +00001508 };
1509
1510 class ForOfNode : public EnumerationNode {
1511 public:
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001512 ForOfNode(const JSTokenLocation&, ExpressionNode*, ExpressionNode*, StatementNode*, VariableEnvironment&);
joepeck@webkit.orgbb70ac62016-09-30 19:22:37 +00001513 bool isForOfNode() const override { return true; }
1514
oliver@apple.com20a9bf02013-10-04 20:35:24 +00001515 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001516 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001517 };
1518
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001519 class ContinueNode : public StatementNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001520 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001521 ContinueNode(const JSTokenLocation&, const Identifier&);
ggaren@apple.com81c68cc2013-04-27 06:43:33 +00001522 Label* trivialTarget(BytecodeGenerator&);
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001523
darin@apple.comd7f68222009-05-06 17:10:22 +00001524 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001525 bool isContinue() const override { return true; }
1526 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001527
darin@apple.com85a65c32009-08-22 06:40:53 +00001528 const Identifier& m_ident;
weinig@apple.coma4436412008-01-28 20:50:45 +00001529 };
1530
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001531 class BreakNode : public StatementNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001532 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001533 BreakNode(const JSTokenLocation&, const Identifier&);
ggaren@apple.com81c68cc2013-04-27 06:43:33 +00001534 Label* trivialTarget(BytecodeGenerator&);
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001535
darin@apple.comd7f68222009-05-06 17:10:22 +00001536 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001537 bool isBreak() const override { return true; }
1538 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001539
darin@apple.com85a65c32009-08-22 06:40:53 +00001540 const Identifier& m_ident;
weinig@apple.coma4436412008-01-28 20:50:45 +00001541 };
1542
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001543 class ReturnNode : public StatementNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001544 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001545 ReturnNode(const JSTokenLocation&, ExpressionNode* value);
darin@apple.comfa069502008-11-10 01:04:30 +00001546
barraclough@apple.comb467c4c2010-07-13 20:34:11 +00001547 ExpressionNode* value() { return m_value; }
1548
darin@apple.comd7f68222009-05-06 17:10:22 +00001549 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001550 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +00001551
darin@apple.com11ff47c2016-03-04 16:47:55 +00001552 bool isReturnNode() const override { return true; }
weinig@apple.coma4436412008-01-28 20:50:45 +00001553
darin@apple.com59c37152009-05-10 22:32:34 +00001554 ExpressionNode* m_value;
weinig@apple.coma4436412008-01-28 20:50:45 +00001555 };
1556
1557 class WithNode : public StatementNode {
1558 public:
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +00001559 WithNode(const JSTokenLocation&, ExpressionNode*, StatementNode*, const JSTextPosition& divot, uint32_t expressionLength);
darin@apple.comfa069502008-11-10 01:04:30 +00001560
darin@apple.comd7f68222009-05-06 17:10:22 +00001561 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001562 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
weinig@apple.coma4436412008-01-28 20:50:45 +00001563
darin@apple.com59c37152009-05-10 22:32:34 +00001564 ExpressionNode* m_expr;
1565 StatementNode* m_statement;
mark.lam@apple.com3b256ca2013-07-30 17:01:40 +00001566 JSTextPosition m_divot;
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001567 uint32_t m_expressionLength;
weinig@apple.coma4436412008-01-28 20:50:45 +00001568 };
1569
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001570 class LabelNode : public StatementNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001571 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001572 LabelNode(const JSTokenLocation&, const Identifier& name, StatementNode*);
darin@apple.comfa069502008-11-10 01:04:30 +00001573
joepeck@webkit.orgf26f3b12016-09-30 19:22:50 +00001574 bool isLabel() const override { return true; }
1575
darin@apple.comd7f68222009-05-06 17:10:22 +00001576 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001577 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
kocienda66a6d362001-08-24 14:24:45 +00001578
darin@apple.com85a65c32009-08-22 06:40:53 +00001579 const Identifier& m_name;
darin@apple.com59c37152009-05-10 22:32:34 +00001580 StatementNode* m_statement;
weinig@apple.coma4436412008-01-28 20:50:45 +00001581 };
kocienda66a6d362001-08-24 14:24:45 +00001582
oliver@apple.com90b88ae2008-07-19 01:44:24 +00001583 class ThrowNode : public StatementNode, public ThrowableExpressionData {
weinig@apple.coma4436412008-01-28 20:50:45 +00001584 public:
commit-queue@webkit.org1b331cb2012-08-06 03:16:46 +00001585 ThrowNode(const JSTokenLocation&, ExpressionNode*);
darin@apple.comfa069502008-11-10 01:04:30 +00001586
darin@apple.comd7f68222009-05-06 17:10:22 +00001587 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001588 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
kocienda66a6d362001-08-24 14:24:45 +00001589
darin@apple.com59c37152009-05-10 22:32:34 +00001590 ExpressionNode* m_expr;
weinig@apple.coma4436412008-01-28 20:50:45 +00001591 };
kocienda66a6d362001-08-24 14:24:45 +00001592
sbarati@apple.com62be0b02015-09-19 15:36:46 +00001593 class TryNode : public StatementNode, public VariableEnvironmentNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001594 public:
sbarati@apple.com62be0b02015-09-19 15:36:46 +00001595 using ParserArenaDeletable::operator new;
1596
utatane.tea@gmail.com08fe3112016-01-22 04:21:36 +00001597 TryNode(const JSTokenLocation&, StatementNode* tryBlock, DestructuringPatternNode* catchPattern, StatementNode* catchBlock, VariableEnvironment& catchEnvironment, StatementNode* finallyBlock);
darin@apple.comfa069502008-11-10 01:04:30 +00001598
darin@apple.comd7f68222009-05-06 17:10:22 +00001599 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001600 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001601
darin@apple.com59c37152009-05-10 22:32:34 +00001602 StatementNode* m_tryBlock;
utatane.tea@gmail.com08fe3112016-01-22 04:21:36 +00001603 DestructuringPatternNode* m_catchPattern;
darin@apple.com59c37152009-05-10 22:32:34 +00001604 StatementNode* m_catchBlock;
1605 StatementNode* m_finallyBlock;
weinig@apple.coma4436412008-01-28 20:50:45 +00001606 };
kocienda66a6d362001-08-24 14:24:45 +00001607
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001608 class ScopeNode : public StatementNode, public ParserArenaRoot, public VariableEnvironmentNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001609 public:
darin@apple.com97ea2422008-11-10 01:28:10 +00001610
ggaren@apple.comc0ccae02014-12-03 23:23:56 +00001611 ScopeNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, bool inStrictContext);
sbarati@apple.com432a3c92016-04-03 19:45:05 +00001612 ScopeNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, const SourceCode&, SourceElements*, VariableEnvironment&, FunctionStack&&, VariableEnvironment&, UniquedStringImplPtrSet&&, CodeFeatures, InnerArrowFunctionCodeFeatures, int numConstants);
weinig@apple.com9b5bf062008-11-20 23:23:59 +00001613
ggaren@apple.com9e5d58e2014-12-05 00:59:33 +00001614 using ParserArenaRoot::operator new;
darin@apple.com85a65c32009-08-22 06:40:53 +00001615
wingo@igalia.com0700f682012-03-09 12:06:48 +00001616 const SourceCode& source() const { return m_source; }
benjamin@webkit.orgcff06e42012-08-30 21:23:51 +00001617 const String& sourceURL() const { return m_source.provider()->url(); }
fpizlo@apple.comd55e8152012-05-30 21:04:23 +00001618 intptr_t sourceID() const { return m_source.providerID(); }
wingo@igalia.com0700f682012-03-09 12:06:48 +00001619
mark.lam@apple.comfaa53932013-03-20 09:09:38 +00001620 int startLine() const { return m_startLineNumber; }
mark.lam@apple.com5b45f902013-07-09 16:15:12 +00001621 int startStartOffset() const { return m_startStartOffset; }
1622 int startLineStartOffset() const { return m_startLineStartOffset; }
mark.lam@apple.comfaa53932013-03-20 09:09:38 +00001623
oliver@apple.com6bc11372012-05-07 23:35:52 +00001624 void setFeatures(CodeFeatures features) { m_features = features; }
1625 CodeFeatures features() { return m_features; }
gskachkov@gmail.coma198dd12016-02-28 19:14:26 +00001626 InnerArrowFunctionCodeFeatures innerArrowFunctionCodeFeatures() { return m_innerArrowFunctionCodeFeatures; }
gskachkov@gmail.com78667862016-03-01 21:28:45 +00001627 bool doAnyInnerArrowFunctionsUseAnyFeature() { return m_innerArrowFunctionCodeFeatures != NoInnerArrowFunctionFeatures; }
gskachkov@gmail.coma198dd12016-02-28 19:14:26 +00001628 bool doAnyInnerArrowFunctionsUseArguments() { return m_innerArrowFunctionCodeFeatures & ArgumentsInnerArrowFunctionFeature; }
1629 bool doAnyInnerArrowFunctionsUseSuperCall() { return m_innerArrowFunctionCodeFeatures & SuperCallInnerArrowFunctionFeature; }
1630 bool doAnyInnerArrowFunctionsUseSuperProperty() { return m_innerArrowFunctionCodeFeatures & SuperPropertyInnerArrowFunctionFeature; }
1631 bool doAnyInnerArrowFunctionsUseEval() { return m_innerArrowFunctionCodeFeatures & EvalInnerArrowFunctionFeature; }
1632 bool doAnyInnerArrowFunctionsUseThis() { return m_innerArrowFunctionCodeFeatures & ThisInnerArrowFunctionFeature; }
1633 bool doAnyInnerArrowFunctionsUseNewTarget() { return m_innerArrowFunctionCodeFeatures & NewTargetInnerArrowFunctionFeature; }
oliver@apple.com6bc11372012-05-07 23:35:52 +00001634
1635 bool usesEval() const { return m_features & EvalFeature; }
1636 bool usesArguments() const { return (m_features & ArgumentsFeature) && !(m_features & ShadowsArgumentsFeature); }
commit-queue@webkit.orgb2610c02015-12-08 20:24:04 +00001637 bool usesArrowFunction() const { return m_features & ArrowFunctionFeature; }
oliver@apple.com6bc11372012-05-07 23:35:52 +00001638 bool isStrictMode() const { return m_features & StrictModeFeature; }
1639 void setUsesArguments() { m_features |= ArgumentsFeature; }
1640 bool usesThis() const { return m_features & ThisFeature; }
gskachkov@gmail.coma198dd12016-02-28 19:14:26 +00001641 bool usesSuperCall() const { return m_features & SuperCallFeature; }
1642 bool usesSuperProperty() const { return m_features & SuperPropertyFeature; }
gskachkov@gmail.comf7ba3e42016-03-10 08:19:42 +00001643 bool usesNewTarget() const { return m_features & NewTargetFeature; }
commit-queue@webkit.orge4b5df82015-09-15 19:26:45 +00001644 bool needsActivation() const { return (hasCapturedVariables()) || (m_features & (EvalFeature | WithFeature)); }
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001645 bool hasCapturedVariables() const { return m_varDeclarations.hasCapturedVariables(); }
1646 bool captures(UniquedStringImpl* uid) { return m_varDeclarations.captures(uid); }
fpizlo@apple.comda834ae2015-03-26 04:28:43 +00001647 bool captures(const Identifier& ident) { return captures(ident.impl()); }
sbarati@apple.com432a3c92016-04-03 19:45:05 +00001648 bool hasSloppyModeHoistedFunction(UniquedStringImpl* uid) const { return m_sloppyModeHoistedFunctions.contains(uid); }
oliver@apple.com6bc11372012-05-07 23:35:52 +00001649
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001650 VariableEnvironment& varDeclarations() { return m_varDeclarations; }
weinig@apple.com9b5bf062008-11-20 23:23:59 +00001651
cwzwarich@webkit.org300bb752008-08-06 10:37:34 +00001652 int neededConstants()
1653 {
ggaren@apple.com68313b02008-11-13 00:48:23 +00001654 // We may need 2 more constants than the count given by the parser,
1655 // because of the various uses of jsUndefined() and jsNull().
wingo@igalia.com08f0e4c2012-03-07 10:18:43 +00001656 return m_numConstants + 2;
cwzwarich@webkit.org300bb752008-08-06 10:37:34 +00001657 }
1658
darin@apple.com85a65c32009-08-22 06:40:53 +00001659 StatementNode* singleStatement() const;
1660
1661 void emitStatementsBytecode(BytecodeGenerator&, RegisterID* destination);
oliver@apple.comba848d12014-02-12 17:14:23 +00001662
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001663 void analyzeModule(ModuleAnalyzer&);
1664
weinig@apple.coma4436412008-01-28 20:50:45 +00001665 protected:
mark.lam@apple.comfaa53932013-03-20 09:09:38 +00001666 int m_startLineNumber;
mark.lam@apple.com5b45f902013-07-09 16:15:12 +00001667 unsigned m_startStartOffset;
1668 unsigned m_startLineStartOffset;
mark.lam@apple.comfaa53932013-03-20 09:09:38 +00001669
weinig@apple.coma4436412008-01-28 20:50:45 +00001670 private:
oliver@apple.com6bc11372012-05-07 23:35:52 +00001671 CodeFeatures m_features;
gskachkov@gmail.coma198dd12016-02-28 19:14:26 +00001672 InnerArrowFunctionCodeFeatures m_innerArrowFunctionCodeFeatures;
weinig@apple.com9b5bf062008-11-20 23:23:59 +00001673 SourceCode m_source;
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00001674 VariableEnvironment m_varDeclarations;
sbarati@apple.com432a3c92016-04-03 19:45:05 +00001675 UniquedStringImplPtrSet m_sloppyModeHoistedFunctions;
wingo@igalia.com08f0e4c2012-03-07 10:18:43 +00001676 int m_numConstants;
1677 SourceElements* m_statements;
weinig@apple.coma4436412008-01-28 20:50:45 +00001678 };
ggaren76f1d812007-10-25 07:09:44 +00001679
weinig@apple.coma4436412008-01-28 20:50:45 +00001680 class ProgramNode : public ScopeNode {
1681 public:
utatane.tea@gmail.coma03b21b2016-07-31 07:04:57 +00001682 ProgramNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VariableEnvironment&, FunctionStack&&, VariableEnvironment&, UniquedStringImplPtrSet&&, FunctionParameters*, const SourceCode&, CodeFeatures, InnerArrowFunctionCodeFeatures, int numConstants, RefPtr<ModuleScopeData>&&);
mark.lam@apple.com5b45f902013-07-09 16:15:12 +00001683
mark.lam@apple.comfa35e782013-11-19 21:55:16 +00001684 unsigned startColumn() const { return m_startColumn; }
1685 unsigned endColumn() const { return m_endColumn; }
cwzwarich@webkit.orgf064af62008-06-21 06:32:25 +00001686
barraclough@apple.com1050f792009-08-25 02:53:51 +00001687 static const bool scopeIsFunction = false;
1688
ggaren@apple.com9e5d58e2014-12-05 00:59:33 +00001689 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001690 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mark.lam@apple.com5b45f902013-07-09 16:15:12 +00001691 unsigned m_startColumn;
mark.lam@apple.comfa35e782013-11-19 21:55:16 +00001692 unsigned m_endColumn;
weinig@apple.coma4436412008-01-28 20:50:45 +00001693 };
ggaren@apple.come65a2902007-12-11 05:47:41 +00001694
weinig@apple.coma4436412008-01-28 20:50:45 +00001695 class EvalNode : public ScopeNode {
1696 public:
utatane.tea@gmail.coma03b21b2016-07-31 07:04:57 +00001697 EvalNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VariableEnvironment&, FunctionStack&&, VariableEnvironment&, UniquedStringImplPtrSet&&, FunctionParameters*, const SourceCode&, CodeFeatures, InnerArrowFunctionCodeFeatures, int numConstants, RefPtr<ModuleScopeData>&&);
mark.lam@apple.com5b45f902013-07-09 16:15:12 +00001698
mark.lam@apple.comfa35e782013-11-19 21:55:16 +00001699 ALWAYS_INLINE unsigned startColumn() const { return 0; }
1700 unsigned endColumn() const { return m_endColumn; }
cwzwarich@webkit.orgf064af62008-06-21 06:32:25 +00001701
barraclough@apple.com1050f792009-08-25 02:53:51 +00001702 static const bool scopeIsFunction = false;
1703
weinig@apple.coma4436412008-01-28 20:50:45 +00001704 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001705 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mark.lam@apple.comfa35e782013-11-19 21:55:16 +00001706
1707 unsigned m_endColumn;
weinig@apple.coma4436412008-01-28 20:50:45 +00001708 };
mjsf06d2de2005-09-21 05:53:05 +00001709
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001710 class ModuleProgramNode : public ScopeNode {
1711 public:
utatane.tea@gmail.coma03b21b2016-07-31 07:04:57 +00001712 ModuleProgramNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VariableEnvironment&, FunctionStack&&, VariableEnvironment&, UniquedStringImplPtrSet&&, FunctionParameters*, const SourceCode&, CodeFeatures, InnerArrowFunctionCodeFeatures, int numConstants, RefPtr<ModuleScopeData>&&);
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001713
1714 unsigned startColumn() const { return m_startColumn; }
1715 unsigned endColumn() const { return m_endColumn; }
1716
1717 static const bool scopeIsFunction = false;
1718
utatane.tea@gmail.coma03b21b2016-07-31 07:04:57 +00001719 ModuleScopeData& moduleScopeData()
1720 {
1721 return m_moduleScopeData;
1722 }
1723
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001724 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001725 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001726 unsigned m_startColumn;
1727 unsigned m_endColumn;
utatane.tea@gmail.coma03b21b2016-07-31 07:04:57 +00001728 Ref<ModuleScopeData> m_moduleScopeData;
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001729 };
1730
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001731 class ModuleNameNode : public Node {
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001732 public:
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001733 ModuleNameNode(const JSTokenLocation&, const Identifier& moduleName);
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001734
1735 const Identifier& moduleName() { return m_moduleName; }
1736
1737 private:
1738 const Identifier& m_moduleName;
1739 };
1740
1741 class ImportSpecifierNode : public Node {
1742 public:
1743 ImportSpecifierNode(const JSTokenLocation&, const Identifier& importedName, const Identifier& localName);
1744
1745 const Identifier& importedName() { return m_importedName; }
1746 const Identifier& localName() { return m_localName; }
1747
1748 private:
1749 const Identifier& m_importedName;
1750 const Identifier& m_localName;
1751 };
1752
1753 class ImportSpecifierListNode : public ParserArenaDeletable {
1754 public:
1755 typedef Vector<ImportSpecifierNode*, 3> Specifiers;
1756
1757 const Specifiers& specifiers() const { return m_specifiers; }
1758 void append(ImportSpecifierNode* specifier)
1759 {
1760 m_specifiers.append(specifier);
1761 }
1762
1763 private:
1764 Specifiers m_specifiers;
1765 };
1766
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001767 class ModuleDeclarationNode : public StatementNode {
1768 public:
1769 virtual void analyzeModule(ModuleAnalyzer&) = 0;
annulen@yandex.rud6de8df2016-12-15 21:26:08 +00001770 bool isModuleDeclarationNode() const override { return true; }
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001771
1772 protected:
1773 ModuleDeclarationNode(const JSTokenLocation&);
1774 };
1775
1776 class ImportDeclarationNode : public ModuleDeclarationNode {
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001777 public:
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001778 ImportDeclarationNode(const JSTokenLocation&, ImportSpecifierListNode*, ModuleNameNode*);
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001779
1780 ImportSpecifierListNode* specifierList() const { return m_specifierList; }
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001781 ModuleNameNode* moduleName() const { return m_moduleName; }
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001782
1783 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001784 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
1785 void analyzeModule(ModuleAnalyzer&) override;
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001786
1787 ImportSpecifierListNode* m_specifierList;
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001788 ModuleNameNode* m_moduleName;
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001789 };
1790
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001791 class ExportAllDeclarationNode : public ModuleDeclarationNode {
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001792 public:
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001793 ExportAllDeclarationNode(const JSTokenLocation&, ModuleNameNode*);
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001794
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001795 ModuleNameNode* moduleName() const { return m_moduleName; }
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001796
1797 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001798 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
1799 void analyzeModule(ModuleAnalyzer&) override;
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001800
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001801 ModuleNameNode* m_moduleName;
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001802 };
1803
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001804 class ExportDefaultDeclarationNode : public ModuleDeclarationNode {
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001805 public:
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001806 ExportDefaultDeclarationNode(const JSTokenLocation&, StatementNode*, const Identifier& localName);
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001807
1808 const StatementNode& declaration() const { return *m_declaration; }
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001809 const Identifier& localName() const { return m_localName; }
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001810
1811 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001812 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
1813 void analyzeModule(ModuleAnalyzer&) override;
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001814 StatementNode* m_declaration;
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001815 const Identifier& m_localName;
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001816 };
1817
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001818 class ExportLocalDeclarationNode : public ModuleDeclarationNode {
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001819 public:
1820 ExportLocalDeclarationNode(const JSTokenLocation&, StatementNode*);
1821
1822 const StatementNode& declaration() const { return *m_declaration; }
1823
1824 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001825 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
1826 void analyzeModule(ModuleAnalyzer&) override;
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001827 StatementNode* m_declaration;
1828 };
1829
1830 class ExportSpecifierNode : public Node {
1831 public:
1832 ExportSpecifierNode(const JSTokenLocation&, const Identifier& localName, const Identifier& exportedName);
1833
1834 const Identifier& exportedName() { return m_exportedName; }
1835 const Identifier& localName() { return m_localName; }
1836
1837 private:
1838 const Identifier& m_localName;
1839 const Identifier& m_exportedName;
1840 };
1841
1842 class ExportSpecifierListNode : public ParserArenaDeletable {
1843 public:
1844 typedef Vector<ExportSpecifierNode*, 3> Specifiers;
1845
1846 const Specifiers& specifiers() const { return m_specifiers; }
1847 void append(ExportSpecifierNode* specifier)
1848 {
1849 m_specifiers.append(specifier);
1850 }
1851
1852 private:
1853 Specifiers m_specifiers;
1854 };
1855
utatane.tea@gmail.com1c1bac02015-08-12 20:38:45 +00001856 class ExportNamedDeclarationNode : public ModuleDeclarationNode {
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001857 public:
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001858 ExportNamedDeclarationNode(const JSTokenLocation&, ExportSpecifierListNode*, ModuleNameNode*);
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001859
1860 ExportSpecifierListNode* specifierList() const { return m_specifierList; }
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001861 ModuleNameNode* moduleName() const { return m_moduleName; }
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001862
1863 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001864 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
1865 void analyzeModule(ModuleAnalyzer&) override;
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001866 ExportSpecifierListNode* m_specifierList;
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001867 ModuleNameNode* m_moduleName { nullptr };
utatane.tea@gmail.com9f9c9752015-08-04 21:26:49 +00001868 };
1869
ggaren@apple.come7afe402015-08-10 20:24:35 +00001870 class FunctionMetadataNode final : public Node, public ParserArenaDeletable {
weinig@apple.coma4436412008-01-28 20:50:45 +00001871 public:
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001872 using ParserArenaDeletable::operator new;
1873
ggaren@apple.come7afe402015-08-10 20:24:35 +00001874 FunctionMetadataNode(
ggaren@apple.comd3e1f862015-03-20 23:37:51 +00001875 ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end,
1876 unsigned startColumn, unsigned endColumn, int functionKeywordStart,
1877 int functionNameStart, int parametersStart, bool isInStrictContext,
utatane.tea@gmail.com3e031ac2017-03-16 05:12:53 +00001878 ConstructorKind, SuperBinding, unsigned parameterCount,
commit-queue@webkit.orga1e1d572016-09-22 19:11:23 +00001879 SourceParseMode, bool isArrowFunctionBodyExpression);
weinig@apple.coma4436412008-01-28 20:50:45 +00001880
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00001881 void finishParsing(const SourceCode&, const Identifier&, FunctionMode);
ggaren@apple.com69e9ccf2008-10-02 06:44:37 +00001882
oliver@apple.com4cbc7012014-02-14 23:29:31 +00001883 void overrideName(const Identifier& ident) { m_ident = ident; }
barraclough@apple.com3dc12332009-08-12 05:22:33 +00001884 const Identifier& ident() { return m_ident; }
mark.lam@apple.com4b79ce72016-03-11 21:08:08 +00001885 void setEcmaName(const Identifier& ecmaName) { m_ecmaName = ecmaName; }
mark.lam@apple.comc7f7bdf2016-03-09 19:36:21 +00001886 const Identifier& ecmaName() { return m_ident.isEmpty() ? m_ecmaName : m_ident; }
oliver@apple.comddf4b482012-02-17 21:17:59 +00001887 void setInferredName(const Identifier& inferredName) { ASSERT(!inferredName.isNull()); m_inferredName = inferredName; }
oliver@apple.comf7190bf2012-02-01 23:23:30 +00001888 const Identifier& inferredName() { return m_inferredName.isEmpty() ? m_ident : m_inferredName; }
barraclough@apple.com3dc12332009-08-12 05:22:33 +00001889
ggaren@apple.com7d92d072014-02-03 20:39:38 +00001890 FunctionMode functionMode() { return m_functionMode; }
ggaren@apple.comf8200082012-09-07 01:42:53 +00001891
mark.lam@apple.comfa35e782013-11-19 21:55:16 +00001892 int functionNameStart() const { return m_functionNameStart; }
saambarati1@gmail.comb4f28a52014-12-05 05:58:07 +00001893 int functionKeywordStart() const { return m_functionKeywordStart; }
commit-queue@webkit.org157a4322015-03-24 20:07:26 +00001894 int parametersStart() const { return m_parametersStart; }
mark.lam@apple.com5b45f902013-07-09 16:15:12 +00001895 unsigned startColumn() const { return m_startColumn; }
mark.lam@apple.comfa35e782013-11-19 21:55:16 +00001896 unsigned endColumn() const { return m_endColumn; }
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00001897 unsigned parameterCount() const { return m_parameterCount; }
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001898 SourceParseMode parseMode() const { return m_parseMode; }
mark.lam@apple.comfa35e782013-11-19 21:55:16 +00001899
1900 void setEndPosition(JSTextPosition);
oliver@apple.com924afcb2012-12-06 19:34:27 +00001901
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001902 const SourceCode& source() const { return m_source; }
mark.lam@apple.com4b79ce72016-03-11 21:08:08 +00001903 const SourceCode& classSource() const { return m_classSource; }
1904 void setClassSource(const SourceCode& source) { m_classSource = source; }
barraclough@apple.com3dc12332009-08-12 05:22:33 +00001905
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001906 int startStartOffset() const { return m_startStartOffset; }
1907 bool isInStrictContext() const { return m_isInStrictContext; }
utatane.tea@gmail.comfdd9bf42015-12-02 03:16:28 +00001908 SuperBinding superBinding() { return static_cast<SuperBinding>(m_superBinding); }
rniwa@webkit.orge6f83492015-03-13 23:01:51 +00001909 ConstructorKind constructorKind() { return static_cast<ConstructorKind>(m_constructorKind); }
commit-queue@webkit.org04b24472015-08-25 19:10:29 +00001910 bool isArrowFunctionBodyExpression() const { return m_isArrowFunctionBodyExpression; }
darin@apple.com85a65c32009-08-22 06:40:53 +00001911
ggaren@apple.come7afe402015-08-10 20:24:35 +00001912 void setLoc(unsigned firstLine, unsigned lastLine, int startOffset, int lineStartOffset)
1913 {
1914 m_lastLine = lastLine;
1915 m_position = JSTextPosition(firstLine, startOffset, lineStartOffset);
1916 ASSERT(m_position.offset >= m_position.lineStartOffset);
1917 }
1918 unsigned lastLine() const { return m_lastLine; }
1919
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001920 protected:
barraclough@apple.com3dc12332009-08-12 05:22:33 +00001921 Identifier m_ident;
mark.lam@apple.comc7f7bdf2016-03-09 19:36:21 +00001922 Identifier m_ecmaName;
oliver@apple.comf7190bf2012-02-01 23:23:30 +00001923 Identifier m_inferredName;
ggaren@apple.com7d92d072014-02-03 20:39:38 +00001924 FunctionMode m_functionMode;
mark.lam@apple.com5b45f902013-07-09 16:15:12 +00001925 unsigned m_startColumn;
mark.lam@apple.comfa35e782013-11-19 21:55:16 +00001926 unsigned m_endColumn;
ggaren@apple.comd3e1f862015-03-20 23:37:51 +00001927 int m_functionKeywordStart;
1928 int m_functionNameStart;
1929 int m_parametersStart;
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001930 SourceCode m_source;
mark.lam@apple.com4b79ce72016-03-11 21:08:08 +00001931 SourceCode m_classSource;
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001932 int m_startStartOffset;
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00001933 unsigned m_parameterCount;
ggaren@apple.come7afe402015-08-10 20:24:35 +00001934 int m_lastLine;
utatane.tea@gmail.com505049b2015-08-13 23:55:35 +00001935 SourceParseMode m_parseMode;
rniwa@webkit.orge6f83492015-03-13 23:01:51 +00001936 unsigned m_isInStrictContext : 1;
utatane.tea@gmail.comfdd9bf42015-12-02 03:16:28 +00001937 unsigned m_superBinding : 1;
rniwa@webkit.orge6f83492015-03-13 23:01:51 +00001938 unsigned m_constructorKind : 2;
commit-queue@webkit.org04b24472015-08-25 19:10:29 +00001939 unsigned m_isArrowFunctionBodyExpression : 1;
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001940 };
1941
ggaren@apple.com2ec99922014-12-04 23:55:34 +00001942 class FunctionNode final : public ScopeNode {
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001943 public:
utatane.tea@gmail.coma03b21b2016-07-31 07:04:57 +00001944 FunctionNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VariableEnvironment&, FunctionStack&&, VariableEnvironment&, UniquedStringImplPtrSet&&, FunctionParameters*, const SourceCode&, CodeFeatures, InnerArrowFunctionCodeFeatures, int numConstants, RefPtr<ModuleScopeData>&&);
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001945
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00001946 FunctionParameters* parameters() const { return m_parameters; }
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001947
darin@apple.com11ff47c2016-03-04 16:47:55 +00001948 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001949
joepeck@webkit.orgbb70ac62016-09-30 19:22:37 +00001950 bool isFunctionNode() const override { return true; }
1951
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00001952 void finishParsing(const Identifier&, FunctionMode);
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001953
1954 const Identifier& ident() { return m_ident; }
1955
mark.lam@apple.com43137872016-03-17 14:58:57 +00001956 FunctionMode functionMode() const { return m_functionMode; }
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001957
1958 unsigned startColumn() const { return m_startColumn; }
1959 unsigned endColumn() const { return m_endColumn; }
1960
1961 static const bool scopeIsFunction = true;
1962
1963 private:
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001964 Identifier m_ident;
1965 FunctionMode m_functionMode;
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00001966 FunctionParameters* m_parameters;
ggaren@apple.com6f851d72014-12-04 23:47:49 +00001967 unsigned m_startColumn;
1968 unsigned m_endColumn;
weinig@apple.coma4436412008-01-28 20:50:45 +00001969 };
1970
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +00001971 class BaseFuncExprNode : public ExpressionNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00001972 public:
ggaren@apple.come7afe402015-08-10 20:24:35 +00001973 FunctionMetadataNode* metadata() { return m_metadata; }
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001974
commit-queue@webkit.orgc4df9c02016-09-29 19:01:42 +00001975 bool isBaseFuncExprNode() const override { return true; }
1976
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +00001977 protected:
mark.lam@apple.com43137872016-03-17 14:58:57 +00001978 BaseFuncExprNode(const JSTokenLocation&, const Identifier&, FunctionMetadataNode*, const SourceCode&, FunctionMode);
1979
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +00001980 FunctionMetadataNode* m_metadata;
1981 };
1982
1983
1984 class FuncExprNode : public BaseFuncExprNode {
1985 public:
1986 FuncExprNode(const JSTokenLocation&, const Identifier&, FunctionMetadataNode*, const SourceCode&);
1987
mark.lam@apple.com43137872016-03-17 14:58:57 +00001988 protected:
1989 FuncExprNode(const JSTokenLocation&, const Identifier&, FunctionMetadataNode*, const SourceCode&, FunctionMode);
1990
weinig@apple.coma4436412008-01-28 20:50:45 +00001991 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00001992 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +00001993
darin@apple.com11ff47c2016-03-04 16:47:55 +00001994 bool isFuncExprNode() const override { return true; }
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +00001995 };
darin@apple.comd7f68222009-05-06 17:10:22 +00001996
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +00001997 class ArrowFuncExprNode : public BaseFuncExprNode {
1998 public:
1999 ArrowFuncExprNode(const JSTokenLocation&, const Identifier&, FunctionMetadataNode*, const SourceCode&);
2000
2001 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002002 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +00002003
darin@apple.com11ff47c2016-03-04 16:47:55 +00002004 bool isArrowFuncExprNode() const override { return true; }
weinig@apple.coma4436412008-01-28 20:50:45 +00002005 };
2006
mark.lam@apple.com43137872016-03-17 14:58:57 +00002007 class MethodDefinitionNode : public FuncExprNode {
2008 public:
2009 MethodDefinitionNode(const JSTokenLocation&, const Identifier&, FunctionMetadataNode*, const SourceCode&);
2010
2011 private:
2012 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
2013 };
2014
utatane.tea@gmail.comfdd9bf42015-12-02 03:16:28 +00002015 class YieldExprNode final : public ExpressionNode, public ThrowableExpressionData {
utatane.tea@gmail.comf2fde6a2015-11-02 05:46:17 +00002016 public:
2017 YieldExprNode(const JSTokenLocation&, ExpressionNode* argument, bool delegate);
2018
2019 ExpressionNode* argument() const { return m_argument; }
2020 bool delegate() const { return m_delegate; }
2021
2022 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002023 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
utatane.tea@gmail.comf2fde6a2015-11-02 05:46:17 +00002024
2025 ExpressionNode* m_argument;
2026 bool m_delegate;
2027 };
2028
caitp@igalia.com0096c962016-09-23 22:24:27 +00002029 class AwaitExprNode final : public ExpressionNode, public ThrowableExpressionData {
2030 public:
2031 AwaitExprNode(const JSTokenLocation&, ExpressionNode* argument);
2032
2033 ExpressionNode* argument() const { return m_argument; }
2034
2035 private:
2036 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
2037
2038 ExpressionNode* m_argument;
2039 };
2040
utatane.tea@gmail.com0a4a7f82015-10-15 14:35:12 +00002041 class ClassExprNode final : public ExpressionNode, public VariableEnvironmentNode {
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002042 public:
utatane.tea@gmail.com0a4a7f82015-10-15 14:35:12 +00002043 using ParserArenaDeletable::operator new;
2044
mark.lam@apple.com4b79ce72016-03-11 21:08:08 +00002045 ClassExprNode(const JSTokenLocation&, const Identifier&, const SourceCode& classSource,
2046 VariableEnvironment& classEnvironment, ExpressionNode* constructorExpresssion,
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002047 ExpressionNode* parentClass, PropertyListNode* instanceMethods, PropertyListNode* staticMethods);
2048
2049 const Identifier& name() { return m_name; }
mark.lam@apple.com4b79ce72016-03-11 21:08:08 +00002050 const Identifier& ecmaName() { return m_ecmaName ? *m_ecmaName : m_name; }
2051 void setEcmaName(const Identifier& name) { m_ecmaName = m_name.isNull() ? &name : &m_name; }
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002052
mark.lam@apple.com47c2f142016-03-16 18:16:32 +00002053 bool hasStaticProperty(const Identifier& propName) { return m_staticMethods ? m_staticMethods->hasStaticallyNamedProperty(propName) : false; }
2054
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002055 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002056 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002057
mark.lam@apple.com4b79ce72016-03-11 21:08:08 +00002058 bool isClassExprNode() const override { return true; }
2059
2060 SourceCode m_classSource;
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002061 const Identifier& m_name;
mark.lam@apple.com4b79ce72016-03-11 21:08:08 +00002062 const Identifier* m_ecmaName;
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002063 ExpressionNode* m_constructorExpression;
rniwa@webkit.org059ef9b2015-03-09 23:47:06 +00002064 ExpressionNode* m_classHeritage;
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002065 PropertyListNode* m_instanceMethods;
2066 PropertyListNode* m_staticMethods;
2067 };
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002068
saambarati1@gmail.com91063c92015-07-21 19:18:47 +00002069 class DestructuringPatternNode : public ParserArenaFreeable {
oliver@apple.comd055db62013-10-02 19:11:04 +00002070 public:
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00002071 virtual ~DestructuringPatternNode() { }
oliver@apple.comd055db62013-10-02 19:11:04 +00002072 virtual void collectBoundIdentifiers(Vector<Identifier>&) const = 0;
oliver@apple.com47784d62013-10-25 21:31:36 +00002073 virtual void bindValue(BytecodeGenerator&, RegisterID* source) const = 0;
oliver@apple.comd055db62013-10-02 19:11:04 +00002074 virtual void toString(StringBuilder&) const = 0;
2075
2076 virtual bool isBindingNode() const { return false; }
sbarati@apple.comc0722da2015-11-20 02:37:47 +00002077 virtual bool isRestParameter() const { return false; }
oliver@apple.comd055db62013-10-02 19:11:04 +00002078 virtual RegisterID* emitDirectBinding(BytecodeGenerator&, RegisterID*, ExpressionNode*) { return 0; }
2079
oliver@apple.comd055db62013-10-02 19:11:04 +00002080 protected:
saambarati1@gmail.comcc3bcb62015-07-02 23:53:10 +00002081 DestructuringPatternNode();
oliver@apple.comd055db62013-10-02 19:11:04 +00002082 };
2083
saambarati1@gmail.com91063c92015-07-21 19:18:47 +00002084 class ArrayPatternNode : public DestructuringPatternNode, public ThrowableExpressionData, public ParserArenaDeletable {
oliver@apple.comd055db62013-10-02 19:11:04 +00002085 public:
saambarati1@gmail.com91063c92015-07-21 19:18:47 +00002086 using ParserArenaDeletable::operator new;
2087
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00002088 ArrayPatternNode();
utatane.tea@gmail.com412d7612015-06-26 03:13:25 +00002089 enum class BindingType {
2090 Elision,
2091 Element,
2092 RestElement
2093 };
2094
saambarati1@gmail.comcc3bcb62015-07-02 23:53:10 +00002095 void appendIndex(BindingType bindingType, const JSTokenLocation&, DestructuringPatternNode* node, ExpressionNode* defaultValue)
oliver@apple.comd055db62013-10-02 19:11:04 +00002096 {
utatane.tea@gmail.com412d7612015-06-26 03:13:25 +00002097 m_targetPatterns.append({ bindingType, node, defaultValue });
oliver@apple.comd055db62013-10-02 19:11:04 +00002098 }
2099
2100 private:
saambarati1@gmail.com174581a2015-06-18 12:35:32 +00002101 struct Entry {
utatane.tea@gmail.com412d7612015-06-26 03:13:25 +00002102 BindingType bindingType;
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00002103 DestructuringPatternNode* pattern;
saambarati1@gmail.com174581a2015-06-18 12:35:32 +00002104 ExpressionNode* defaultValue;
2105 };
darin@apple.com11ff47c2016-03-04 16:47:55 +00002106 void collectBoundIdentifiers(Vector<Identifier>&) const override;
2107 void bindValue(BytecodeGenerator&, RegisterID*) const override;
2108 RegisterID* emitDirectBinding(BytecodeGenerator&, RegisterID* dst, ExpressionNode*) override;
2109 void toString(StringBuilder&) const override;
oliver@apple.comd055db62013-10-02 19:11:04 +00002110
saambarati1@gmail.com174581a2015-06-18 12:35:32 +00002111 Vector<Entry> m_targetPatterns;
oliver@apple.comd055db62013-10-02 19:11:04 +00002112 };
2113
commit-queue@webkit.org2162b032017-03-10 02:00:33 +00002114 class ObjectPatternNode : public DestructuringPatternNode, public ThrowableExpressionData, public ParserArenaDeletable {
oliver@apple.comd055db62013-10-02 19:11:04 +00002115 public:
saambarati1@gmail.com91063c92015-07-21 19:18:47 +00002116 using ParserArenaDeletable::operator new;
2117
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00002118 ObjectPatternNode();
commit-queue@webkit.org2162b032017-03-10 02:00:33 +00002119 enum class BindingType {
2120 Element,
2121 RestElement
2122 };
2123 void appendEntry(const JSTokenLocation&, const Identifier& identifier, bool wasString, DestructuringPatternNode* pattern, ExpressionNode* defaultValue, BindingType bindingType)
oliver@apple.comd055db62013-10-02 19:11:04 +00002124 {
commit-queue@webkit.org2162b032017-03-10 02:00:33 +00002125 m_targetPatterns.append(Entry{ identifier, nullptr, wasString, pattern, defaultValue, bindingType });
commit-queue@webkit.org38980282015-11-25 01:43:14 +00002126 }
2127
commit-queue@webkit.org2162b032017-03-10 02:00:33 +00002128 void appendEntry(const JSTokenLocation&, ExpressionNode* propertyExpression, DestructuringPatternNode* pattern, ExpressionNode* defaultValue, BindingType bindingType)
commit-queue@webkit.org38980282015-11-25 01:43:14 +00002129 {
commit-queue@webkit.org2162b032017-03-10 02:00:33 +00002130 m_targetPatterns.append(Entry{ Identifier(), propertyExpression, false, pattern, defaultValue, bindingType });
2131 }
2132
2133 void setContainsRestElement(bool containsRestElement)
2134 {
2135 m_containsRestElement = containsRestElement;
oliver@apple.comd055db62013-10-02 19:11:04 +00002136 }
saambarati1@gmail.com91063c92015-07-21 19:18:47 +00002137
oliver@apple.comd055db62013-10-02 19:11:04 +00002138 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002139 void collectBoundIdentifiers(Vector<Identifier>&) const override;
2140 void bindValue(BytecodeGenerator&, RegisterID*) const override;
2141 void toString(StringBuilder&) const override;
oliver@apple.comd055db62013-10-02 19:11:04 +00002142 struct Entry {
saambarati1@gmail.com35f2d692015-07-21 20:22:37 +00002143 const Identifier& propertyName;
commit-queue@webkit.org38980282015-11-25 01:43:14 +00002144 ExpressionNode* propertyExpression;
oliver@apple.comd055db62013-10-02 19:11:04 +00002145 bool wasString;
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00002146 DestructuringPatternNode* pattern;
saambarati1@gmail.com174581a2015-06-18 12:35:32 +00002147 ExpressionNode* defaultValue;
commit-queue@webkit.org2162b032017-03-10 02:00:33 +00002148 BindingType bindingType;
oliver@apple.comd055db62013-10-02 19:11:04 +00002149 };
commit-queue@webkit.org2162b032017-03-10 02:00:33 +00002150 bool m_containsRestElement { false };
oliver@apple.comd055db62013-10-02 19:11:04 +00002151 Vector<Entry> m_targetPatterns;
2152 };
2153
saambarati1@gmail.comcc3bcb62015-07-02 23:53:10 +00002154 class BindingNode : public DestructuringPatternNode {
oliver@apple.comd055db62013-10-02 19:11:04 +00002155 public:
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00002156 BindingNode(const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end, AssignmentContext);
oliver@apple.comd055db62013-10-02 19:11:04 +00002157 const Identifier& boundProperty() const { return m_boundProperty; }
akling@apple.combdf5d1d2014-01-21 01:10:29 +00002158
2159 const JSTextPosition& divotStart() const { return m_divotStart; }
2160 const JSTextPosition& divotEnd() const { return m_divotEnd; }
oliver@apple.comd055db62013-10-02 19:11:04 +00002161
2162 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002163 void collectBoundIdentifiers(Vector<Identifier>&) const override;
2164 void bindValue(BytecodeGenerator&, RegisterID*) const override;
2165 void toString(StringBuilder&) const override;
oliver@apple.comd055db62013-10-02 19:11:04 +00002166
darin@apple.com11ff47c2016-03-04 16:47:55 +00002167 bool isBindingNode() const override { return true; }
akling@apple.combdf5d1d2014-01-21 01:10:29 +00002168
2169 JSTextPosition m_divotStart;
2170 JSTextPosition m_divotEnd;
saambarati1@gmail.com91063c92015-07-21 19:18:47 +00002171 const Identifier& m_boundProperty;
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00002172 AssignmentContext m_bindingContext;
oliver@apple.comd055db62013-10-02 19:11:04 +00002173 };
2174
sbarati@apple.comc0722da2015-11-20 02:37:47 +00002175 class RestParameterNode : public DestructuringPatternNode {
2176 public:
sbarati@apple.com6a686122016-08-03 07:50:40 +00002177 RestParameterNode(DestructuringPatternNode*, unsigned numParametersToSkip);
sbarati@apple.comc0722da2015-11-20 02:37:47 +00002178
2179 bool isRestParameter() const override { return true; }
2180
2181 void emit(BytecodeGenerator&);
2182
sbarati@apple.comc0722da2015-11-20 02:37:47 +00002183 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002184 void collectBoundIdentifiers(Vector<Identifier>&) const override;
2185 void bindValue(BytecodeGenerator&, RegisterID*) const override;
2186 void toString(StringBuilder&) const override;
sbarati@apple.comc0722da2015-11-20 02:37:47 +00002187
sbarati@apple.com6a686122016-08-03 07:50:40 +00002188 DestructuringPatternNode* m_pattern;
sbarati@apple.comc0722da2015-11-20 02:37:47 +00002189 unsigned m_numParametersToSkip;
sbarati@apple.comc0722da2015-11-20 02:37:47 +00002190 };
2191
commit-queue@webkit.org88a74762015-11-19 22:54:46 +00002192 class AssignmentElementNode : public DestructuringPatternNode {
2193 public:
2194 AssignmentElementNode(ExpressionNode* assignmentTarget, const JSTextPosition& start, const JSTextPosition& end);
2195 const ExpressionNode* assignmentTarget() { return m_assignmentTarget; }
2196
2197 const JSTextPosition& divotStart() const { return m_divotStart; }
2198 const JSTextPosition& divotEnd() const { return m_divotEnd; }
2199
2200 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002201 void collectBoundIdentifiers(Vector<Identifier>&) const override;
2202 void bindValue(BytecodeGenerator&, RegisterID*) const override;
2203 void toString(StringBuilder&) const override;
commit-queue@webkit.org88a74762015-11-19 22:54:46 +00002204
2205 JSTextPosition m_divotStart;
2206 JSTextPosition m_divotEnd;
2207 ExpressionNode* m_assignmentTarget;
2208 };
2209
saambarati1@gmail.com91063c92015-07-21 19:18:47 +00002210 class DestructuringAssignmentNode : public ExpressionNode {
oliver@apple.comd055db62013-10-02 19:11:04 +00002211 public:
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00002212 DestructuringAssignmentNode(const JSTokenLocation&, DestructuringPatternNode*, ExpressionNode*);
2213 DestructuringPatternNode* bindings() { return m_bindings; }
oliver@apple.comd055db62013-10-02 19:11:04 +00002214
oliver@apple.comd055db62013-10-02 19:11:04 +00002215 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002216 bool isAssignmentLocation() const override { return true; }
2217 bool isDestructuringNode() const override { return true; }
2218 RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
oliver@apple.comd055db62013-10-02 19:11:04 +00002219
saambarati1@gmail.comc497d152015-07-17 18:48:30 +00002220 DestructuringPatternNode* m_bindings;
oliver@apple.comd055db62013-10-02 19:11:04 +00002221 ExpressionNode* m_initializer;
2222 };
2223
utatane.tea@gmail.com3e031ac2017-03-16 05:12:53 +00002224 class FunctionParameters : public ParserArenaDeletable {
2225 public:
2226 FunctionParameters();
2227 ALWAYS_INLINE unsigned size() const { return m_patterns.size(); }
2228 ALWAYS_INLINE std::pair<DestructuringPatternNode*, ExpressionNode*> at(unsigned index) { return m_patterns[index]; }
2229 ALWAYS_INLINE void append(DestructuringPatternNode* pattern, ExpressionNode* defaultValue)
2230 {
2231 ASSERT(pattern);
2232
2233 // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-functiondeclarationinstantiation
2234 // This implements IsSimpleParameterList in the Ecma 2015 spec.
2235 // If IsSimpleParameterList is false, we will create a strict-mode like arguments object.
2236 // IsSimpleParameterList is false if the argument list contains any default parameter values,
2237 // a rest parameter, or any destructuring patterns.
2238 // If we do have default parameters, destructuring parameters, or a rest parameter, our parameters will be allocated in a different scope.
2239
2240 bool hasDefaultParameterValue = defaultValue;
2241 bool isSimpleParameter = !hasDefaultParameterValue && pattern->isBindingNode();
2242 m_isSimpleParameterList &= isSimpleParameter;
2243
2244 m_patterns.append(std::make_pair(pattern, defaultValue));
2245 }
2246 ALWAYS_INLINE bool isSimpleParameterList() const { return m_isSimpleParameterList; }
2247
2248 private:
2249
2250 Vector<std::pair<DestructuringPatternNode*, ExpressionNode*>, 3> m_patterns;
2251 bool m_isSimpleParameterList { true };
2252 };
2253
barraclough@apple.com3dc12332009-08-12 05:22:33 +00002254 class FuncDeclNode : public StatementNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00002255 public:
ggaren@apple.come7afe402015-08-10 20:24:35 +00002256 FuncDeclNode(const JSTokenLocation&, const Identifier&, FunctionMetadataNode*, const SourceCode&);
darin@apple.comfa069502008-11-10 01:04:30 +00002257
darin@apple.com11ff47c2016-03-04 16:47:55 +00002258 bool isFuncDeclNode() const override { return true; }
ggaren@apple.come7afe402015-08-10 20:24:35 +00002259 FunctionMetadataNode* metadata() { return m_metadata; }
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00002260
weinig@apple.coma4436412008-01-28 20:50:45 +00002261 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002262 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
darin@apple.comd7f68222009-05-06 17:10:22 +00002263
ggaren@apple.come7afe402015-08-10 20:24:35 +00002264 FunctionMetadataNode* m_metadata;
weinig@apple.coma4436412008-01-28 20:50:45 +00002265 };
2266
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002267 class ClassDeclNode final : public StatementNode {
2268 public:
2269 ClassDeclNode(const JSTokenLocation&, ExpressionNode* classExpression);
2270
2271 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002272 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002273
2274 ExpressionNode* m_classDeclaration;
2275 };
rniwa@webkit.org65c9b0d2015-01-29 22:59:19 +00002276
darin@apple.com85a65c32009-08-22 06:40:53 +00002277 class CaseClauseNode : public ParserArenaFreeable {
weinig@apple.coma4436412008-01-28 20:50:45 +00002278 public:
msaboff@apple.com2e5003e2011-10-31 22:13:01 +00002279 CaseClauseNode(ExpressionNode*, SourceElements* = 0);
darin@apple.comfa069502008-11-10 01:04:30 +00002280
darin@apple.com59c37152009-05-10 22:32:34 +00002281 ExpressionNode* expr() const { return m_expr; }
darin@apple.com85a65c32009-08-22 06:40:53 +00002282
2283 void emitBytecode(BytecodeGenerator&, RegisterID* destination);
saambarati1@gmail.comb4f28a52014-12-05 05:58:07 +00002284 void setStartOffset(int offset) { m_startOffset = offset; }
weinig@apple.coma4436412008-01-28 20:50:45 +00002285
2286 private:
darin@apple.com59c37152009-05-10 22:32:34 +00002287 ExpressionNode* m_expr;
darin@apple.com85a65c32009-08-22 06:40:53 +00002288 SourceElements* m_statements;
saambarati1@gmail.comb4f28a52014-12-05 05:58:07 +00002289 int m_startOffset;
weinig@apple.coma4436412008-01-28 20:50:45 +00002290 };
2291
darin@apple.com85a65c32009-08-22 06:40:53 +00002292 class ClauseListNode : public ParserArenaFreeable {
weinig@apple.coma4436412008-01-28 20:50:45 +00002293 public:
msaboff@apple.com2e5003e2011-10-31 22:13:01 +00002294 ClauseListNode(CaseClauseNode*);
2295 ClauseListNode(ClauseListNode*, CaseClauseNode*);
darin@apple.comfa069502008-11-10 01:04:30 +00002296
darin@apple.com59c37152009-05-10 22:32:34 +00002297 CaseClauseNode* getClause() const { return m_clause; }
2298 ClauseListNode* getNext() const { return m_next; }
weinig@apple.coma4436412008-01-28 20:50:45 +00002299
2300 private:
darin@apple.com59c37152009-05-10 22:32:34 +00002301 CaseClauseNode* m_clause;
2302 ClauseListNode* m_next;
weinig@apple.coma4436412008-01-28 20:50:45 +00002303 };
2304
darin@apple.com85a65c32009-08-22 06:40:53 +00002305 class CaseBlockNode : public ParserArenaFreeable {
weinig@apple.coma4436412008-01-28 20:50:45 +00002306 public:
msaboff@apple.com2e5003e2011-10-31 22:13:01 +00002307 CaseBlockNode(ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2);
darin@apple.comfa069502008-11-10 01:04:30 +00002308
ggaren@apple.comd786e6b2013-04-04 23:16:20 +00002309 void emitBytecodeForBlock(BytecodeGenerator&, RegisterID* input, RegisterID* destination);
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00002310
weinig@apple.coma4436412008-01-28 20:50:45 +00002311 private:
ggaren@apple.com18bbb012013-01-30 05:43:47 +00002312 SwitchInfo::SwitchType tryTableSwitch(Vector<ExpressionNode*, 8>& literalVector, int32_t& min_num, int32_t& max_num);
oliver@apple.com9b7647b2013-07-25 04:03:00 +00002313 static const size_t s_tableSwitchMinimum = 3;
darin@apple.com59c37152009-05-10 22:32:34 +00002314 ClauseListNode* m_list1;
2315 CaseClauseNode* m_defaultClause;
2316 ClauseListNode* m_list2;
weinig@apple.coma4436412008-01-28 20:50:45 +00002317 };
2318
saambarati1@gmail.com144f17c2015-07-15 21:41:08 +00002319 class SwitchNode : public StatementNode, public VariableEnvironmentNode {
weinig@apple.coma4436412008-01-28 20:50:45 +00002320 public:
sbarati@apple.com62be0b02015-09-19 15:36:46 +00002321 using ParserArenaDeletable::operator new;
2322
sbarati@apple.com8e614bd2016-03-10 02:04:20 +00002323 SwitchNode(const JSTokenLocation&, ExpressionNode*, CaseBlockNode*, VariableEnvironment&, FunctionStack&&);
darin@apple.comfa069502008-11-10 01:04:30 +00002324
darin@apple.comd7f68222009-05-06 17:10:22 +00002325 private:
darin@apple.com11ff47c2016-03-04 16:47:55 +00002326 void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00002327
darin@apple.com59c37152009-05-10 22:32:34 +00002328 ExpressionNode* m_expr;
2329 CaseBlockNode* m_block;
weinig@apple.coma4436412008-01-28 20:50:45 +00002330 };
darin@apple.com5e49bae2007-12-21 21:54:51 +00002331
weinig@apple.coma4436412008-01-28 20:50:45 +00002332 struct ElementList {
2333 ElementNode* head;
2334 ElementNode* tail;
2335 };
mrowe@apple.com5e1c2782007-10-29 08:31:46 +00002336
weinig@apple.coma4436412008-01-28 20:50:45 +00002337 struct PropertyList {
2338 PropertyListNode* head;
2339 PropertyListNode* tail;
2340 };
mrowe@apple.com5e1c2782007-10-29 08:31:46 +00002341
weinig@apple.coma4436412008-01-28 20:50:45 +00002342 struct ArgumentList {
2343 ArgumentListNode* head;
2344 ArgumentListNode* tail;
2345 };
mrowe@apple.com5e1c2782007-10-29 08:31:46 +00002346
weinig@apple.coma4436412008-01-28 20:50:45 +00002347 struct ClauseList {
2348 ClauseListNode* head;
2349 ClauseListNode* tail;
2350 };
mrowe@apple.com5e1c2782007-10-29 08:31:46 +00002351
cwzwarich@webkit.org3f782f62008-09-08 01:28:33 +00002352} // namespace JSC