| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 private: | 231 private: |
| 232 ZoneList<Statement*> statements_; | 232 ZoneList<Statement*> statements_; |
| 233 bool is_initializer_block_; | 233 bool is_initializer_block_; |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 | 236 |
| 237 class Declaration: public Node { | 237 class Declaration: public Node { |
| 238 public: | 238 public: |
| 239 Declaration(VariableProxy* proxy, Variable::Mode mode, FunctionLiteral* fun) | 239 Declaration(VariableProxy* proxy, Variable::Mode mode, FunctionLiteral* fun) |
| 240 : proxy_(proxy), | 240 : proxy_(proxy), |
| 241 mode_(mode), | 241 mode_(mode), |
| 242 fun_(fun) { | 242 fun_(fun) { |
| 243 ASSERT(mode == Variable::VAR || mode == Variable::CONST); | 243 ASSERT(mode == Variable::VAR || mode == Variable::CONST); |
| 244 // At the moment there are no "const functions"'s in JavaScript... | 244 // At the moment there are no "const functions"'s in JavaScript... |
| 245 ASSERT(fun == NULL || mode == Variable::VAR); | 245 ASSERT(fun == NULL || mode == Variable::VAR); |
| 246 } | 246 } |
| 247 | 247 |
| 248 virtual void Accept(Visitor* v); | 248 virtual void Accept(Visitor* v); |
| 249 | 249 |
| 250 VariableProxy* proxy() const { return proxy_; } | 250 VariableProxy* proxy() const { return proxy_; } |
| 251 Variable::Mode mode() const { return mode_; } | 251 Variable::Mode mode() const { return mode_; } |
| 252 FunctionLiteral* fun() const { return fun_; } // may be NULL | 252 FunctionLiteral* fun() const { return fun_; } // may be NULL |
| (...skipping 10 matching lines...) Expand all Loading... |
| 263 // Type testing & conversion. | 263 // Type testing & conversion. |
| 264 virtual IterationStatement* AsIterationStatement() { return this; } | 264 virtual IterationStatement* AsIterationStatement() { return this; } |
| 265 | 265 |
| 266 Statement* body() const { return body_; } | 266 Statement* body() const { return body_; } |
| 267 | 267 |
| 268 // Code generation | 268 // Code generation |
| 269 Label* continue_target() { return &continue_target_; } | 269 Label* continue_target() { return &continue_target_; } |
| 270 | 270 |
| 271 protected: | 271 protected: |
| 272 explicit IterationStatement(ZoneStringList* labels) | 272 explicit IterationStatement(ZoneStringList* labels) |
| 273 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), body_(NULL) { } | 273 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), body_(NULL) { } |
| 274 | 274 |
| 275 void Initialize(Statement* body) { | 275 void Initialize(Statement* body) { |
| 276 body_ = body; | 276 body_ = body; |
| 277 } | 277 } |
| 278 | 278 |
| 279 private: | 279 private: |
| 280 Statement* body_; | 280 Statement* body_; |
| 281 Label continue_target_; | 281 Label continue_target_; |
| 282 }; | 282 }; |
| 283 | 283 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 Type type_; | 317 Type type_; |
| 318 Statement* init_; | 318 Statement* init_; |
| 319 Expression* cond_; | 319 Expression* cond_; |
| 320 Statement* next_; | 320 Statement* next_; |
| 321 }; | 321 }; |
| 322 | 322 |
| 323 | 323 |
| 324 class ForInStatement: public IterationStatement { | 324 class ForInStatement: public IterationStatement { |
| 325 public: | 325 public: |
| 326 explicit ForInStatement(ZoneStringList* labels) | 326 explicit ForInStatement(ZoneStringList* labels) |
| 327 : IterationStatement(labels), each_(NULL), enumerable_(NULL) { } | 327 : IterationStatement(labels), each_(NULL), enumerable_(NULL) { } |
| 328 | 328 |
| 329 void Initialize(Expression* each, Expression* enumerable, Statement* body) { | 329 void Initialize(Expression* each, Expression* enumerable, Statement* body) { |
| 330 IterationStatement::Initialize(body); | 330 IterationStatement::Initialize(body); |
| 331 each_ = each; | 331 each_ = each; |
| 332 enumerable_ = enumerable; | 332 enumerable_ = enumerable; |
| 333 } | 333 } |
| 334 | 334 |
| 335 virtual void Accept(Visitor* v); | 335 virtual void Accept(Visitor* v); |
| 336 | 336 |
| 337 Expression* each() const { return each_; } | 337 Expression* each() const { return each_; } |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 // with lookup starting at the current context. index() | 805 // with lookup starting at the current context. index() |
| 806 // is invalid. | 806 // is invalid. |
| 807 LOOKUP, | 807 LOOKUP, |
| 808 | 808 |
| 809 // A property in the global object. var()->name() is | 809 // A property in the global object. var()->name() is |
| 810 // the property name. | 810 // the property name. |
| 811 GLOBAL | 811 GLOBAL |
| 812 }; | 812 }; |
| 813 | 813 |
| 814 Slot(Variable* var, Type type, int index) | 814 Slot(Variable* var, Type type, int index) |
| 815 : var_(var), type_(type), index_(index) { | 815 : var_(var), type_(type), index_(index) { |
| 816 ASSERT(var != NULL); | 816 ASSERT(var != NULL); |
| 817 } | 817 } |
| 818 | 818 |
| 819 virtual void Accept(Visitor* v); | 819 virtual void Accept(Visitor* v); |
| 820 | 820 |
| 821 // Type testing & conversion | 821 // Type testing & conversion |
| 822 virtual Slot* AsSlot() { return this; } | 822 virtual Slot* AsSlot() { return this; } |
| 823 | 823 |
| 824 // Accessors | 824 // Accessors |
| 825 Variable* var() const { return var_; } | 825 Variable* var() const { return var_; } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 private: | 925 private: |
| 926 Handle<String> name_; | 926 Handle<String> name_; |
| 927 Runtime::Function* function_; | 927 Runtime::Function* function_; |
| 928 ZoneList<Expression*>* arguments_; | 928 ZoneList<Expression*>* arguments_; |
| 929 }; | 929 }; |
| 930 | 930 |
| 931 | 931 |
| 932 class UnaryOperation: public Expression { | 932 class UnaryOperation: public Expression { |
| 933 public: | 933 public: |
| 934 UnaryOperation(Token::Value op, Expression* expression) | 934 UnaryOperation(Token::Value op, Expression* expression) |
| 935 : op_(op), expression_(expression) { | 935 : op_(op), expression_(expression) { |
| 936 ASSERT(Token::IsUnaryOp(op)); | 936 ASSERT(Token::IsUnaryOp(op)); |
| 937 } | 937 } |
| 938 | 938 |
| 939 virtual void Accept(Visitor* v); | 939 virtual void Accept(Visitor* v); |
| 940 | 940 |
| 941 // Type testing & conversion | 941 // Type testing & conversion |
| 942 virtual UnaryOperation* AsUnaryOperation() { return this; } | 942 virtual UnaryOperation* AsUnaryOperation() { return this; } |
| 943 | 943 |
| 944 Token::Value op() const { return op_; } | 944 Token::Value op() const { return op_; } |
| 945 Expression* expression() const { return expression_; } | 945 Expression* expression() const { return expression_; } |
| 946 | 946 |
| 947 private: | 947 private: |
| 948 Token::Value op_; | 948 Token::Value op_; |
| 949 Expression* expression_; | 949 Expression* expression_; |
| 950 }; | 950 }; |
| 951 | 951 |
| 952 | 952 |
| 953 class BinaryOperation: public Expression { | 953 class BinaryOperation: public Expression { |
| 954 public: | 954 public: |
| 955 BinaryOperation(Token::Value op, Expression* left, Expression* right) | 955 BinaryOperation(Token::Value op, Expression* left, Expression* right) |
| 956 : op_(op), left_(left), right_(right) { | 956 : op_(op), left_(left), right_(right) { |
| 957 ASSERT(Token::IsBinaryOp(op)); | 957 ASSERT(Token::IsBinaryOp(op)); |
| 958 } | 958 } |
| 959 | 959 |
| 960 virtual void Accept(Visitor* v); | 960 virtual void Accept(Visitor* v); |
| 961 | 961 |
| 962 // Type testing & conversion | 962 // Type testing & conversion |
| 963 virtual BinaryOperation* AsBinaryOperation() { return this; } | 963 virtual BinaryOperation* AsBinaryOperation() { return this; } |
| 964 | 964 |
| 965 // True iff the result can be safely overwritten (to avoid allocation). | 965 // True iff the result can be safely overwritten (to avoid allocation). |
| 966 // False for operations that can return one of their operands. | 966 // False for operations that can return one of their operands. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 995 private: | 995 private: |
| 996 Token::Value op_; | 996 Token::Value op_; |
| 997 Expression* left_; | 997 Expression* left_; |
| 998 Expression* right_; | 998 Expression* right_; |
| 999 }; | 999 }; |
| 1000 | 1000 |
| 1001 | 1001 |
| 1002 class CountOperation: public Expression { | 1002 class CountOperation: public Expression { |
| 1003 public: | 1003 public: |
| 1004 CountOperation(bool is_prefix, Token::Value op, Expression* expression) | 1004 CountOperation(bool is_prefix, Token::Value op, Expression* expression) |
| 1005 : is_prefix_(is_prefix), op_(op), expression_(expression) { | 1005 : is_prefix_(is_prefix), op_(op), expression_(expression) { |
| 1006 ASSERT(Token::IsCountOp(op)); | 1006 ASSERT(Token::IsCountOp(op)); |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 virtual void Accept(Visitor* v); | 1009 virtual void Accept(Visitor* v); |
| 1010 | 1010 |
| 1011 bool is_prefix() const { return is_prefix_; } | 1011 bool is_prefix() const { return is_prefix_; } |
| 1012 bool is_postfix() const { return !is_prefix_; } | 1012 bool is_postfix() const { return !is_prefix_; } |
| 1013 Token::Value op() const { return op_; } | 1013 Token::Value op() const { return op_; } |
| 1014 Expression* expression() const { return expression_; } | 1014 Expression* expression() const { return expression_; } |
| 1015 | 1015 |
| 1016 virtual void MarkAsStatement() { is_prefix_ = true; } | 1016 virtual void MarkAsStatement() { is_prefix_ = true; } |
| 1017 | 1017 |
| 1018 private: | 1018 private: |
| 1019 bool is_prefix_; | 1019 bool is_prefix_; |
| 1020 Token::Value op_; | 1020 Token::Value op_; |
| 1021 Expression* expression_; | 1021 Expression* expression_; |
| 1022 }; | 1022 }; |
| 1023 | 1023 |
| 1024 | 1024 |
| 1025 class CompareOperation: public Expression { | 1025 class CompareOperation: public Expression { |
| 1026 public: | 1026 public: |
| 1027 CompareOperation(Token::Value op, Expression* left, Expression* right) | 1027 CompareOperation(Token::Value op, Expression* left, Expression* right) |
| 1028 : op_(op), left_(left), right_(right) { | 1028 : op_(op), left_(left), right_(right) { |
| 1029 ASSERT(Token::IsCompareOp(op)); | 1029 ASSERT(Token::IsCompareOp(op)); |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 virtual void Accept(Visitor* v); | 1032 virtual void Accept(Visitor* v); |
| 1033 | 1033 |
| 1034 Token::Value op() const { return op_; } | 1034 Token::Value op() const { return op_; } |
| 1035 Expression* left() const { return left_; } | 1035 Expression* left() const { return left_; } |
| 1036 Expression* right() const { return right_; } | 1036 Expression* right() const { return right_; } |
| 1037 | 1037 |
| 1038 private: | 1038 private: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1060 private: | 1060 private: |
| 1061 Expression* condition_; | 1061 Expression* condition_; |
| 1062 Expression* then_expression_; | 1062 Expression* then_expression_; |
| 1063 Expression* else_expression_; | 1063 Expression* else_expression_; |
| 1064 }; | 1064 }; |
| 1065 | 1065 |
| 1066 | 1066 |
| 1067 class Assignment: public Expression { | 1067 class Assignment: public Expression { |
| 1068 public: | 1068 public: |
| 1069 Assignment(Token::Value op, Expression* target, Expression* value, int pos) | 1069 Assignment(Token::Value op, Expression* target, Expression* value, int pos) |
| 1070 : op_(op), target_(target), value_(value), pos_(pos) { | 1070 : op_(op), target_(target), value_(value), pos_(pos) { |
| 1071 ASSERT(Token::IsAssignmentOp(op)); | 1071 ASSERT(Token::IsAssignmentOp(op)); |
| 1072 } | 1072 } |
| 1073 | 1073 |
| 1074 virtual void Accept(Visitor* v); | 1074 virtual void Accept(Visitor* v); |
| 1075 virtual Assignment* AsAssignment() { return this; } | 1075 virtual Assignment* AsAssignment() { return this; } |
| 1076 | 1076 |
| 1077 Token::Value binary_op() const; | 1077 Token::Value binary_op() const; |
| 1078 | 1078 |
| 1079 Token::Value op() const { return op_; } | 1079 Token::Value op() const { return op_; } |
| 1080 Expression* target() const { return target_; } | 1080 Expression* target() const { return target_; } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 virtual RegExp##Name* As##Name(); \ | 1210 virtual RegExp##Name* As##Name(); \ |
| 1211 virtual bool Is##Name(); | 1211 virtual bool Is##Name(); |
| 1212 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) | 1212 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) |
| 1213 #undef MAKE_ASTYPE | 1213 #undef MAKE_ASTYPE |
| 1214 }; | 1214 }; |
| 1215 | 1215 |
| 1216 | 1216 |
| 1217 class RegExpDisjunction: public RegExpTree { | 1217 class RegExpDisjunction: public RegExpTree { |
| 1218 public: | 1218 public: |
| 1219 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives) | 1219 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives) |
| 1220 : alternatives_(alternatives) { } | 1220 : alternatives_(alternatives) { } |
| 1221 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1221 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1222 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1222 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1223 RegExpNode* on_success, | 1223 RegExpNode* on_success, |
| 1224 RegExpNode* on_failure); | 1224 RegExpNode* on_failure); |
| 1225 virtual RegExpDisjunction* AsDisjunction(); | 1225 virtual RegExpDisjunction* AsDisjunction(); |
| 1226 virtual bool IsDisjunction(); | 1226 virtual bool IsDisjunction(); |
| 1227 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } | 1227 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } |
| 1228 private: | 1228 private: |
| 1229 ZoneList<RegExpTree*>* alternatives_; | 1229 ZoneList<RegExpTree*>* alternatives_; |
| 1230 }; | 1230 }; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1259 void AddElement(TextElement elm) { elements_.Add(elm); } | 1259 void AddElement(TextElement elm) { elements_.Add(elm); } |
| 1260 ZoneList<TextElement>* elements() { return &elements_; } | 1260 ZoneList<TextElement>* elements() { return &elements_; } |
| 1261 private: | 1261 private: |
| 1262 ZoneList<TextElement> elements_; | 1262 ZoneList<TextElement> elements_; |
| 1263 }; | 1263 }; |
| 1264 | 1264 |
| 1265 | 1265 |
| 1266 class RegExpAssertion: public RegExpTree { | 1266 class RegExpAssertion: public RegExpTree { |
| 1267 public: | 1267 public: |
| 1268 enum Type { | 1268 enum Type { |
| 1269 START_OF_LINE, START_OF_INPUT, END_OF_LINE, END_OF_INPUT, | 1269 START_OF_LINE, |
| 1270 BOUNDARY, NON_BOUNDARY | 1270 START_OF_INPUT, |
| 1271 END_OF_LINE, |
| 1272 END_OF_INPUT, |
| 1273 BOUNDARY, |
| 1274 NON_BOUNDARY |
| 1271 }; | 1275 }; |
| 1272 explicit RegExpAssertion(Type type) : type_(type) { } | 1276 explicit RegExpAssertion(Type type) : type_(type) { } |
| 1273 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1277 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1274 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1278 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1275 RegExpNode* on_success, | 1279 RegExpNode* on_success, |
| 1276 RegExpNode* on_failure); | 1280 RegExpNode* on_failure); |
| 1277 virtual RegExpAssertion* AsAssertion(); | 1281 virtual RegExpAssertion* AsAssertion(); |
| 1278 virtual bool IsAssertion(); | 1282 virtual bool IsAssertion(); |
| 1279 Type type() { return type_; } | 1283 Type type() { return type_; } |
| 1280 private: | 1284 private: |
| 1281 Type type_; | 1285 Type type_; |
| 1282 }; | 1286 }; |
| 1283 | 1287 |
| 1284 | 1288 |
| 1285 class RegExpCharacterClass: public RegExpTree { | 1289 class RegExpCharacterClass: public RegExpTree { |
| 1286 public: | 1290 public: |
| 1287 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) | 1291 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) |
| 1288 : ranges_(ranges), | 1292 : ranges_(ranges), |
| 1289 is_negated_(is_negated) { } | 1293 is_negated_(is_negated) { } |
| 1290 explicit RegExpCharacterClass(uc16 type) | 1294 explicit RegExpCharacterClass(uc16 type) |
| 1291 : ranges_(new ZoneList<CharacterRange>(2)), | 1295 : ranges_(new ZoneList<CharacterRange>(2)), |
| 1292 is_negated_(false) { | 1296 is_negated_(false) { |
| 1293 CharacterRange::AddClassEscape(type, ranges_); | 1297 CharacterRange::AddClassEscape(type, ranges_); |
| 1294 } | 1298 } |
| 1295 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1299 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1296 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1300 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1297 RegExpNode* on_success, | 1301 RegExpNode* on_success, |
| 1298 RegExpNode* on_failure); | 1302 RegExpNode* on_failure); |
| 1299 virtual RegExpCharacterClass* AsCharacterClass(); | 1303 virtual RegExpCharacterClass* AsCharacterClass(); |
| 1300 virtual bool IsCharacterClass(); | 1304 virtual bool IsCharacterClass(); |
| 1301 virtual bool IsTextElement() { return true; } | 1305 virtual bool IsTextElement() { return true; } |
| 1302 virtual void AppendToText(RegExpText* text); | 1306 virtual void AppendToText(RegExpText* text); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1321 virtual void AppendToText(RegExpText* text); | 1325 virtual void AppendToText(RegExpText* text); |
| 1322 Vector<const uc16> data() { return data_; } | 1326 Vector<const uc16> data() { return data_; } |
| 1323 private: | 1327 private: |
| 1324 Vector<const uc16> data_; | 1328 Vector<const uc16> data_; |
| 1325 }; | 1329 }; |
| 1326 | 1330 |
| 1327 | 1331 |
| 1328 class RegExpQuantifier: public RegExpTree { | 1332 class RegExpQuantifier: public RegExpTree { |
| 1329 public: | 1333 public: |
| 1330 RegExpQuantifier(int min, int max, bool is_greedy, RegExpTree* body) | 1334 RegExpQuantifier(int min, int max, bool is_greedy, RegExpTree* body) |
| 1331 : min_(min), | 1335 : min_(min), |
| 1332 max_(max), | 1336 max_(max), |
| 1333 is_greedy_(is_greedy), | 1337 is_greedy_(is_greedy), |
| 1334 body_(body) { } | 1338 body_(body) { } |
| 1335 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1339 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1336 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1340 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1337 RegExpNode* on_success, | 1341 RegExpNode* on_success, |
| 1338 RegExpNode* on_failure); | 1342 RegExpNode* on_failure); |
| 1339 static RegExpNode* ToNode(int min, | 1343 static RegExpNode* ToNode(int min, |
| 1340 int max, | 1344 int max, |
| 1341 bool is_greedy, | 1345 bool is_greedy, |
| 1342 RegExpTree* body, | 1346 RegExpTree* body, |
| 1343 RegExpCompiler* compiler, | 1347 RegExpCompiler* compiler, |
| 1344 RegExpNode* on_success, | 1348 RegExpNode* on_success, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1359 RegExpTree* body_; | 1363 RegExpTree* body_; |
| 1360 }; | 1364 }; |
| 1361 | 1365 |
| 1362 | 1366 |
| 1363 enum CaptureAvailability { | 1367 enum CaptureAvailability { |
| 1364 CAPTURE_AVAILABLE, CAPTURE_UNREACHABLE, CAPTURE_PERMANENTLY_UNREACHABLE }; | 1368 CAPTURE_AVAILABLE, CAPTURE_UNREACHABLE, CAPTURE_PERMANENTLY_UNREACHABLE }; |
| 1365 | 1369 |
| 1366 class RegExpCapture: public RegExpTree { | 1370 class RegExpCapture: public RegExpTree { |
| 1367 public: | 1371 public: |
| 1368 explicit RegExpCapture(RegExpTree* body, int index) | 1372 explicit RegExpCapture(RegExpTree* body, int index) |
| 1369 : body_(body), index_(index), available_(CAPTURE_AVAILABLE) { } | 1373 : body_(body), index_(index), available_(CAPTURE_AVAILABLE) { } |
| 1370 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1374 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1371 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1375 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1372 RegExpNode* on_success, | 1376 RegExpNode* on_success, |
| 1373 RegExpNode* on_failure); | 1377 RegExpNode* on_failure); |
| 1374 static RegExpNode* ToNode(RegExpTree* body, | 1378 static RegExpNode* ToNode(RegExpTree* body, |
| 1375 int index, | 1379 int index, |
| 1376 RegExpCompiler* compiler, | 1380 RegExpCompiler* compiler, |
| 1377 RegExpNode* on_success, | 1381 RegExpNode* on_success, |
| 1378 RegExpNode* on_failure); | 1382 RegExpNode* on_failure); |
| 1379 virtual RegExpCapture* AsCapture(); | 1383 virtual RegExpCapture* AsCapture(); |
| 1380 virtual bool IsCapture(); | 1384 virtual bool IsCapture(); |
| 1381 RegExpTree* body() { return body_; } | 1385 RegExpTree* body() { return body_; } |
| 1382 int index() { return index_; } | 1386 int index() { return index_; } |
| 1383 inline CaptureAvailability available() { return available_; } | 1387 inline CaptureAvailability available() { return available_; } |
| 1384 inline void set_available(CaptureAvailability availability) { | 1388 inline void set_available(CaptureAvailability availability) { |
| 1385 available_ = availability; | 1389 available_ = availability; |
| 1386 } | 1390 } |
| 1387 static int StartRegister(int index) { return index * 2; } | 1391 static int StartRegister(int index) { return index * 2; } |
| 1388 static int EndRegister(int index) { return index * 2 + 1; } | 1392 static int EndRegister(int index) { return index * 2 + 1; } |
| 1389 private: | 1393 private: |
| 1390 RegExpTree* body_; | 1394 RegExpTree* body_; |
| 1391 int index_; | 1395 int index_; |
| 1392 CaptureAvailability available_; | 1396 CaptureAvailability available_; |
| 1393 }; | 1397 }; |
| 1394 | 1398 |
| 1395 | 1399 |
| 1396 class RegExpLookahead: public RegExpTree { | 1400 class RegExpLookahead: public RegExpTree { |
| 1397 public: | 1401 public: |
| 1398 RegExpLookahead(RegExpTree* body, bool is_positive) | 1402 RegExpLookahead(RegExpTree* body, bool is_positive) |
| 1399 : body_(body), | 1403 : body_(body), |
| 1400 is_positive_(is_positive) { } | 1404 is_positive_(is_positive) { } |
| 1401 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1405 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1402 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1406 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1403 RegExpNode* on_success, | 1407 RegExpNode* on_success, |
| 1404 RegExpNode* on_failure); | 1408 RegExpNode* on_failure); |
| 1405 virtual RegExpLookahead* AsLookahead(); | 1409 virtual RegExpLookahead* AsLookahead(); |
| 1406 virtual bool IsLookahead(); | 1410 virtual bool IsLookahead(); |
| 1407 RegExpTree* body() { return body_; } | 1411 RegExpTree* body() { return body_; } |
| 1408 bool is_positive() { return is_positive_; } | 1412 bool is_positive() { return is_positive_; } |
| 1409 private: | 1413 private: |
| 1410 RegExpTree* body_; | 1414 RegExpTree* body_; |
| 1411 bool is_positive_; | 1415 bool is_positive_; |
| 1412 }; | 1416 }; |
| 1413 | 1417 |
| 1414 | 1418 |
| 1415 class RegExpBackReference: public RegExpTree { | 1419 class RegExpBackReference: public RegExpTree { |
| 1416 public: | 1420 public: |
| 1417 explicit RegExpBackReference(RegExpCapture* capture) | 1421 explicit RegExpBackReference(RegExpCapture* capture) |
| 1418 : capture_(capture) { } | 1422 : capture_(capture) { } |
| 1419 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1423 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1420 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1424 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1421 RegExpNode* on_success, | 1425 RegExpNode* on_success, |
| 1422 RegExpNode* on_failure); | 1426 RegExpNode* on_failure); |
| 1423 virtual RegExpBackReference* AsBackReference(); | 1427 virtual RegExpBackReference* AsBackReference(); |
| 1424 virtual bool IsBackReference(); | 1428 virtual bool IsBackReference(); |
| 1425 int index() { return capture_->index(); } | 1429 int index() { return capture_->index(); } |
| 1426 RegExpCapture* capture() { return capture_; } | 1430 RegExpCapture* capture() { return capture_; } |
| 1427 private: | 1431 private: |
| 1428 RegExpCapture* capture_; | 1432 RegExpCapture* capture_; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 #undef DEF_VISIT | 1496 #undef DEF_VISIT |
| 1493 | 1497 |
| 1494 private: | 1498 private: |
| 1495 bool stack_overflow_; | 1499 bool stack_overflow_; |
| 1496 }; | 1500 }; |
| 1497 | 1501 |
| 1498 | 1502 |
| 1499 } } // namespace v8::internal | 1503 } } // namespace v8::internal |
| 1500 | 1504 |
| 1501 #endif // V8_AST_H_ | 1505 #endif // V8_AST_H_ |
| OLD | NEW |