OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 248 matching lines...) Loading... |
259 int statement_pos() const { return statement_pos_; } | 259 int statement_pos() const { return statement_pos_; } |
260 | 260 |
261 private: | 261 private: |
262 int statement_pos_; | 262 int statement_pos_; |
263 }; | 263 }; |
264 | 264 |
265 | 265 |
266 class SmallMapList { | 266 class SmallMapList { |
267 public: | 267 public: |
268 SmallMapList() {} | 268 SmallMapList() {} |
269 explicit SmallMapList(int capacity) : list_(capacity) {} | 269 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} |
270 | 270 |
271 void Reserve(int capacity) { list_.Reserve(capacity); } | 271 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } |
272 void Clear() { list_.Clear(); } | 272 void Clear() { list_.Clear(); } |
273 void Sort() { list_.Sort(); } | 273 void Sort() { list_.Sort(); } |
274 | 274 |
275 bool is_empty() const { return list_.is_empty(); } | 275 bool is_empty() const { return list_.is_empty(); } |
276 int length() const { return list_.length(); } | 276 int length() const { return list_.length(); } |
277 | 277 |
278 void Add(Handle<Map> handle) { | 278 void Add(Handle<Map> handle, Zone* zone) { |
279 list_.Add(handle.location()); | 279 list_.Add(handle.location(), zone); |
280 } | 280 } |
281 | 281 |
282 Handle<Map> at(int i) const { | 282 Handle<Map> at(int i) const { |
283 return Handle<Map>(list_.at(i)); | 283 return Handle<Map>(list_.at(i)); |
284 } | 284 } |
285 | 285 |
286 Handle<Map> first() const { return at(0); } | 286 Handle<Map> first() const { return at(0); } |
287 Handle<Map> last() const { return at(length() - 1); } | 287 Handle<Map> last() const { return at(length() - 1); } |
288 | 288 |
289 private: | 289 private: |
(...skipping 135 matching lines...) Loading... |
425 | 425 |
426 Scope* scope() const { return scope_; } | 426 Scope* scope() const { return scope_; } |
427 void set_scope(Scope* scope) { scope_ = scope; } | 427 void set_scope(Scope* scope) { scope_ = scope; } |
428 | 428 |
429 protected: | 429 protected: |
430 template<class> friend class AstNodeFactory; | 430 template<class> friend class AstNodeFactory; |
431 | 431 |
432 Block(Isolate* isolate, | 432 Block(Isolate* isolate, |
433 ZoneStringList* labels, | 433 ZoneStringList* labels, |
434 int capacity, | 434 int capacity, |
435 bool is_initializer_block) | 435 bool is_initializer_block, |
| 436 Zone* zone) |
436 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), | 437 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), |
437 statements_(capacity), | 438 statements_(capacity, zone), |
438 is_initializer_block_(is_initializer_block), | 439 is_initializer_block_(is_initializer_block), |
439 scope_(NULL) { | 440 scope_(NULL) { |
440 } | 441 } |
441 | 442 |
442 private: | 443 private: |
443 ZoneList<Statement*> statements_; | 444 ZoneList<Statement*> statements_; |
444 bool is_initializer_block_; | 445 bool is_initializer_block_; |
445 Scope* scope_; | 446 Scope* scope_; |
446 }; | 447 }; |
447 | 448 |
(...skipping 142 matching lines...) Loading... |
590 : Declaration(proxy, LET, scope) { | 591 : Declaration(proxy, LET, scope) { |
591 } | 592 } |
592 }; | 593 }; |
593 | 594 |
594 | 595 |
595 class Module: public AstNode { | 596 class Module: public AstNode { |
596 public: | 597 public: |
597 Interface* interface() const { return interface_; } | 598 Interface* interface() const { return interface_; } |
598 | 599 |
599 protected: | 600 protected: |
600 Module() : interface_(Interface::NewModule()) {} | 601 explicit Module(Zone* zone) : interface_(Interface::NewModule(zone)) {} |
601 explicit Module(Interface* interface) : interface_(interface) {} | 602 explicit Module(Interface* interface) : interface_(interface) {} |
602 | 603 |
603 private: | 604 private: |
604 Interface* interface_; | 605 Interface* interface_; |
605 }; | 606 }; |
606 | 607 |
607 | 608 |
608 class ModuleLiteral: public Module { | 609 class ModuleLiteral: public Module { |
609 public: | 610 public: |
610 DECLARE_NODE_TYPE(ModuleLiteral) | 611 DECLARE_NODE_TYPE(ModuleLiteral) |
(...skipping 34 matching lines...) Loading... |
645 class ModulePath: public Module { | 646 class ModulePath: public Module { |
646 public: | 647 public: |
647 DECLARE_NODE_TYPE(ModulePath) | 648 DECLARE_NODE_TYPE(ModulePath) |
648 | 649 |
649 Module* module() const { return module_; } | 650 Module* module() const { return module_; } |
650 Handle<String> name() const { return name_; } | 651 Handle<String> name() const { return name_; } |
651 | 652 |
652 protected: | 653 protected: |
653 template<class> friend class AstNodeFactory; | 654 template<class> friend class AstNodeFactory; |
654 | 655 |
655 ModulePath(Module* module, Handle<String> name) | 656 ModulePath(Module* module, Handle<String> name, Zone* zone) |
656 : module_(module), | 657 : Module(zone), |
| 658 module_(module), |
657 name_(name) { | 659 name_(name) { |
658 } | 660 } |
659 | 661 |
660 private: | 662 private: |
661 Module* module_; | 663 Module* module_; |
662 Handle<String> name_; | 664 Handle<String> name_; |
663 }; | 665 }; |
664 | 666 |
665 | 667 |
666 class ModuleUrl: public Module { | 668 class ModuleUrl: public Module { |
667 public: | 669 public: |
668 DECLARE_NODE_TYPE(ModuleUrl) | 670 DECLARE_NODE_TYPE(ModuleUrl) |
669 | 671 |
670 Handle<String> url() const { return url_; } | 672 Handle<String> url() const { return url_; } |
671 | 673 |
672 protected: | 674 protected: |
673 template<class> friend class AstNodeFactory; | 675 template<class> friend class AstNodeFactory; |
674 | 676 |
675 explicit ModuleUrl(Handle<String> url) : url_(url) { | 677 ModuleUrl(Handle<String> url, Zone* zone) |
| 678 : Module(zone), url_(url) { |
676 } | 679 } |
677 | 680 |
678 private: | 681 private: |
679 Handle<String> url_; | 682 Handle<String> url_; |
680 }; | 683 }; |
681 | 684 |
682 | 685 |
683 class IterationStatement: public BreakableStatement { | 686 class IterationStatement: public BreakableStatement { |
684 public: | 687 public: |
685 // Type testing & conversion. | 688 // Type testing & conversion. |
(...skipping 407 matching lines...) Loading... |
1093 int if_id_; | 1096 int if_id_; |
1094 int then_id_; | 1097 int then_id_; |
1095 int else_id_; | 1098 int else_id_; |
1096 }; | 1099 }; |
1097 | 1100 |
1098 | 1101 |
1099 // NOTE: TargetCollectors are represented as nodes to fit in the target | 1102 // NOTE: TargetCollectors are represented as nodes to fit in the target |
1100 // stack in the compiler; this should probably be reworked. | 1103 // stack in the compiler; this should probably be reworked. |
1101 class TargetCollector: public AstNode { | 1104 class TargetCollector: public AstNode { |
1102 public: | 1105 public: |
1103 TargetCollector() : targets_(0) { } | 1106 explicit TargetCollector(Zone* zone) : targets_(0, zone) { } |
1104 | 1107 |
1105 // Adds a jump target to the collector. The collector stores a pointer not | 1108 // Adds a jump target to the collector. The collector stores a pointer not |
1106 // a copy of the target to make binding work, so make sure not to pass in | 1109 // a copy of the target to make binding work, so make sure not to pass in |
1107 // references to something on the stack. | 1110 // references to something on the stack. |
1108 void AddTarget(Label* target); | 1111 void AddTarget(Label* target, Zone* zone); |
1109 | 1112 |
1110 // Virtual behaviour. TargetCollectors are never part of the AST. | 1113 // Virtual behaviour. TargetCollectors are never part of the AST. |
1111 virtual void Accept(AstVisitor* v) { UNREACHABLE(); } | 1114 virtual void Accept(AstVisitor* v) { UNREACHABLE(); } |
1112 virtual TargetCollector* AsTargetCollector() { return this; } | 1115 virtual TargetCollector* AsTargetCollector() { return this; } |
1113 | 1116 |
1114 ZoneList<Label*>* targets() { return &targets_; } | 1117 ZoneList<Label*>* targets() { return &targets_; } |
1115 | 1118 |
1116 private: | 1119 private: |
1117 ZoneList<Label*> targets_; | 1120 ZoneList<Label*> targets_; |
1118 }; | 1121 }; |
(...skipping 237 matching lines...) Loading... |
1356 } | 1359 } |
1357 ZoneList<Property*>* properties() const { return properties_; } | 1360 ZoneList<Property*>* properties() const { return properties_; } |
1358 | 1361 |
1359 bool fast_elements() const { return fast_elements_; } | 1362 bool fast_elements() const { return fast_elements_; } |
1360 | 1363 |
1361 bool has_function() { return has_function_; } | 1364 bool has_function() { return has_function_; } |
1362 | 1365 |
1363 // Mark all computed expressions that are bound to a key that | 1366 // Mark all computed expressions that are bound to a key that |
1364 // is shadowed by a later occurrence of the same key. For the | 1367 // is shadowed by a later occurrence of the same key. For the |
1365 // marked expressions, no store code is emitted. | 1368 // marked expressions, no store code is emitted. |
1366 void CalculateEmitStore(); | 1369 void CalculateEmitStore(Zone* zone); |
1367 | 1370 |
1368 enum Flags { | 1371 enum Flags { |
1369 kNoFlags = 0, | 1372 kNoFlags = 0, |
1370 kFastElements = 1, | 1373 kFastElements = 1, |
1371 kHasFunction = 1 << 1 | 1374 kHasFunction = 1 << 1 |
1372 }; | 1375 }; |
1373 | 1376 |
1374 struct Accessors: public ZoneObject { | 1377 struct Accessors: public ZoneObject { |
1375 Accessors() : getter(NULL), setter(NULL) { } | 1378 Accessors() : getter(NULL), setter(NULL) { } |
1376 Expression* getter; | 1379 Expression* getter; |
(...skipping 144 matching lines...) Loading... |
1521 | 1524 |
1522 Expression* obj() const { return obj_; } | 1525 Expression* obj() const { return obj_; } |
1523 Expression* key() const { return key_; } | 1526 Expression* key() const { return key_; } |
1524 virtual int position() const { return pos_; } | 1527 virtual int position() const { return pos_; } |
1525 | 1528 |
1526 bool IsStringLength() const { return is_string_length_; } | 1529 bool IsStringLength() const { return is_string_length_; } |
1527 bool IsStringAccess() const { return is_string_access_; } | 1530 bool IsStringAccess() const { return is_string_access_; } |
1528 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1531 bool IsFunctionPrototype() const { return is_function_prototype_; } |
1529 | 1532 |
1530 // Type feedback information. | 1533 // Type feedback information. |
1531 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1534 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); |
1532 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1535 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1533 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1536 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
1534 bool IsArrayLength() { return is_array_length_; } | 1537 bool IsArrayLength() { return is_array_length_; } |
1535 bool IsUninitialized() { return is_uninitialized_; } | 1538 bool IsUninitialized() { return is_uninitialized_; } |
1536 | 1539 |
1537 protected: | 1540 protected: |
1538 template<class> friend class AstNodeFactory; | 1541 template<class> friend class AstNodeFactory; |
1539 | 1542 |
1540 Property(Isolate* isolate, | 1543 Property(Isolate* isolate, |
1541 Expression* obj, | 1544 Expression* obj, |
(...skipping 252 matching lines...) Loading... |
1794 Token::Value op() const { return op_; } | 1797 Token::Value op() const { return op_; } |
1795 Token::Value binary_op() { | 1798 Token::Value binary_op() { |
1796 return (op() == Token::INC) ? Token::ADD : Token::SUB; | 1799 return (op() == Token::INC) ? Token::ADD : Token::SUB; |
1797 } | 1800 } |
1798 | 1801 |
1799 Expression* expression() const { return expression_; } | 1802 Expression* expression() const { return expression_; } |
1800 virtual int position() const { return pos_; } | 1803 virtual int position() const { return pos_; } |
1801 | 1804 |
1802 virtual void MarkAsStatement() { is_prefix_ = true; } | 1805 virtual void MarkAsStatement() { is_prefix_ = true; } |
1803 | 1806 |
1804 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1807 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe); |
1805 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1808 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1806 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1809 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
1807 | 1810 |
1808 // Bailout support. | 1811 // Bailout support. |
1809 int AssignmentId() const { return assignment_id_; } | 1812 int AssignmentId() const { return assignment_id_; } |
1810 int CountId() const { return count_id_; } | 1813 int CountId() const { return count_id_; } |
1811 | 1814 |
1812 protected: | 1815 protected: |
1813 template<class> friend class AstNodeFactory; | 1816 template<class> friend class AstNodeFactory; |
1814 | 1817 |
(...skipping 132 matching lines...) Loading... |
1947 // An initialization block is a series of statments of the form | 1950 // An initialization block is a series of statments of the form |
1948 // x.y.z.a = ...; x.y.z.b = ...; etc. The parser marks the beginning and | 1951 // x.y.z.a = ...; x.y.z.b = ...; etc. The parser marks the beginning and |
1949 // ending of these blocks to allow for optimizations of initialization | 1952 // ending of these blocks to allow for optimizations of initialization |
1950 // blocks. | 1953 // blocks. |
1951 bool starts_initialization_block() { return block_start_; } | 1954 bool starts_initialization_block() { return block_start_; } |
1952 bool ends_initialization_block() { return block_end_; } | 1955 bool ends_initialization_block() { return block_end_; } |
1953 void mark_block_start() { block_start_ = true; } | 1956 void mark_block_start() { block_start_ = true; } |
1954 void mark_block_end() { block_end_ = true; } | 1957 void mark_block_end() { block_end_ = true; } |
1955 | 1958 |
1956 // Type feedback information. | 1959 // Type feedback information. |
1957 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1960 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); |
1958 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1961 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1959 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1962 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
1960 | 1963 |
1961 // Bailout support. | 1964 // Bailout support. |
1962 int CompoundLoadId() const { return compound_load_id_; } | 1965 int CompoundLoadId() const { return compound_load_id_; } |
1963 int AssignmentId() const { return assignment_id_; } | 1966 int AssignmentId() const { return assignment_id_; } |
1964 | 1967 |
1965 protected: | 1968 protected: |
1966 template<class> friend class AstNodeFactory; | 1969 template<class> friend class AstNodeFactory; |
1967 | 1970 |
(...skipping 238 matching lines...) Loading... |
2206 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2209 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2207 RegExpNode* on_success) = 0; | 2210 RegExpNode* on_success) = 0; |
2208 virtual bool IsTextElement() { return false; } | 2211 virtual bool IsTextElement() { return false; } |
2209 virtual bool IsAnchoredAtStart() { return false; } | 2212 virtual bool IsAnchoredAtStart() { return false; } |
2210 virtual bool IsAnchoredAtEnd() { return false; } | 2213 virtual bool IsAnchoredAtEnd() { return false; } |
2211 virtual int min_match() = 0; | 2214 virtual int min_match() = 0; |
2212 virtual int max_match() = 0; | 2215 virtual int max_match() = 0; |
2213 // Returns the interval of registers used for captures within this | 2216 // Returns the interval of registers used for captures within this |
2214 // expression. | 2217 // expression. |
2215 virtual Interval CaptureRegisters() { return Interval::Empty(); } | 2218 virtual Interval CaptureRegisters() { return Interval::Empty(); } |
2216 virtual void AppendToText(RegExpText* text); | 2219 virtual void AppendToText(RegExpText* text, Zone* zone); |
2217 SmartArrayPointer<const char> ToString(); | 2220 SmartArrayPointer<const char> ToString(Zone* zone); |
2218 #define MAKE_ASTYPE(Name) \ | 2221 #define MAKE_ASTYPE(Name) \ |
2219 virtual RegExp##Name* As##Name(); \ | 2222 virtual RegExp##Name* As##Name(); \ |
2220 virtual bool Is##Name(); | 2223 virtual bool Is##Name(); |
2221 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) | 2224 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) |
2222 #undef MAKE_ASTYPE | 2225 #undef MAKE_ASTYPE |
2223 }; | 2226 }; |
2224 | 2227 |
2225 | 2228 |
2226 class RegExpDisjunction: public RegExpTree { | 2229 class RegExpDisjunction: public RegExpTree { |
2227 public: | 2230 public: |
(...skipping 64 matching lines...) Loading... |
2292 | 2295 |
2293 | 2296 |
2294 class CharacterSet BASE_EMBEDDED { | 2297 class CharacterSet BASE_EMBEDDED { |
2295 public: | 2298 public: |
2296 explicit CharacterSet(uc16 standard_set_type) | 2299 explicit CharacterSet(uc16 standard_set_type) |
2297 : ranges_(NULL), | 2300 : ranges_(NULL), |
2298 standard_set_type_(standard_set_type) {} | 2301 standard_set_type_(standard_set_type) {} |
2299 explicit CharacterSet(ZoneList<CharacterRange>* ranges) | 2302 explicit CharacterSet(ZoneList<CharacterRange>* ranges) |
2300 : ranges_(ranges), | 2303 : ranges_(ranges), |
2301 standard_set_type_(0) {} | 2304 standard_set_type_(0) {} |
2302 ZoneList<CharacterRange>* ranges(); | 2305 ZoneList<CharacterRange>* ranges(Zone* zone); |
2303 uc16 standard_set_type() { return standard_set_type_; } | 2306 uc16 standard_set_type() { return standard_set_type_; } |
2304 void set_standard_set_type(uc16 special_set_type) { | 2307 void set_standard_set_type(uc16 special_set_type) { |
2305 standard_set_type_ = special_set_type; | 2308 standard_set_type_ = special_set_type; |
2306 } | 2309 } |
2307 bool is_standard() { return standard_set_type_ != 0; } | 2310 bool is_standard() { return standard_set_type_ != 0; } |
2308 void Canonicalize(); | 2311 void Canonicalize(); |
2309 private: | 2312 private: |
2310 ZoneList<CharacterRange>* ranges_; | 2313 ZoneList<CharacterRange>* ranges_; |
2311 // If non-zero, the value represents a standard set (e.g., all whitespace | 2314 // If non-zero, the value represents a standard set (e.g., all whitespace |
2312 // characters) without having to expand the ranges. | 2315 // characters) without having to expand the ranges. |
(...skipping 10 matching lines...) Loading... |
2323 : set_(type), | 2326 : set_(type), |
2324 is_negated_(false) { } | 2327 is_negated_(false) { } |
2325 virtual void* Accept(RegExpVisitor* visitor, void* data); | 2328 virtual void* Accept(RegExpVisitor* visitor, void* data); |
2326 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2329 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2327 RegExpNode* on_success); | 2330 RegExpNode* on_success); |
2328 virtual RegExpCharacterClass* AsCharacterClass(); | 2331 virtual RegExpCharacterClass* AsCharacterClass(); |
2329 virtual bool IsCharacterClass(); | 2332 virtual bool IsCharacterClass(); |
2330 virtual bool IsTextElement() { return true; } | 2333 virtual bool IsTextElement() { return true; } |
2331 virtual int min_match() { return 1; } | 2334 virtual int min_match() { return 1; } |
2332 virtual int max_match() { return 1; } | 2335 virtual int max_match() { return 1; } |
2333 virtual void AppendToText(RegExpText* text); | 2336 virtual void AppendToText(RegExpText* text, Zone* zone); |
2334 CharacterSet character_set() { return set_; } | 2337 CharacterSet character_set() { return set_; } |
2335 // TODO(lrn): Remove need for complex version if is_standard that | 2338 // TODO(lrn): Remove need for complex version if is_standard that |
2336 // recognizes a mangled standard set and just do { return set_.is_special(); } | 2339 // recognizes a mangled standard set and just do { return set_.is_special(); } |
2337 bool is_standard(); | 2340 bool is_standard(Zone* zone); |
2338 // Returns a value representing the standard character set if is_standard() | 2341 // Returns a value representing the standard character set if is_standard() |
2339 // returns true. | 2342 // returns true. |
2340 // Currently used values are: | 2343 // Currently used values are: |
2341 // s : unicode whitespace | 2344 // s : unicode whitespace |
2342 // S : unicode non-whitespace | 2345 // S : unicode non-whitespace |
2343 // w : ASCII word character (digit, letter, underscore) | 2346 // w : ASCII word character (digit, letter, underscore) |
2344 // W : non-ASCII word character | 2347 // W : non-ASCII word character |
2345 // d : ASCII digit | 2348 // d : ASCII digit |
2346 // D : non-ASCII digit | 2349 // D : non-ASCII digit |
2347 // . : non-unicode non-newline | 2350 // . : non-unicode non-newline |
2348 // * : All characters | 2351 // * : All characters |
2349 uc16 standard_type() { return set_.standard_set_type(); } | 2352 uc16 standard_type() { return set_.standard_set_type(); } |
2350 ZoneList<CharacterRange>* ranges() { return set_.ranges(); } | 2353 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); } |
2351 bool is_negated() { return is_negated_; } | 2354 bool is_negated() { return is_negated_; } |
2352 | 2355 |
2353 private: | 2356 private: |
2354 CharacterSet set_; | 2357 CharacterSet set_; |
2355 bool is_negated_; | 2358 bool is_negated_; |
2356 }; | 2359 }; |
2357 | 2360 |
2358 | 2361 |
2359 class RegExpAtom: public RegExpTree { | 2362 class RegExpAtom: public RegExpTree { |
2360 public: | 2363 public: |
2361 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } | 2364 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } |
2362 virtual void* Accept(RegExpVisitor* visitor, void* data); | 2365 virtual void* Accept(RegExpVisitor* visitor, void* data); |
2363 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2366 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2364 RegExpNode* on_success); | 2367 RegExpNode* on_success); |
2365 virtual RegExpAtom* AsAtom(); | 2368 virtual RegExpAtom* AsAtom(); |
2366 virtual bool IsAtom(); | 2369 virtual bool IsAtom(); |
2367 virtual bool IsTextElement() { return true; } | 2370 virtual bool IsTextElement() { return true; } |
2368 virtual int min_match() { return data_.length(); } | 2371 virtual int min_match() { return data_.length(); } |
2369 virtual int max_match() { return data_.length(); } | 2372 virtual int max_match() { return data_.length(); } |
2370 virtual void AppendToText(RegExpText* text); | 2373 virtual void AppendToText(RegExpText* text, Zone* zone); |
2371 Vector<const uc16> data() { return data_; } | 2374 Vector<const uc16> data() { return data_; } |
2372 int length() { return data_.length(); } | 2375 int length() { return data_.length(); } |
2373 private: | 2376 private: |
2374 Vector<const uc16> data_; | 2377 Vector<const uc16> data_; |
2375 }; | 2378 }; |
2376 | 2379 |
2377 | 2380 |
2378 class RegExpText: public RegExpTree { | 2381 class RegExpText: public RegExpTree { |
2379 public: | 2382 public: |
2380 RegExpText() : elements_(2), length_(0) {} | 2383 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {} |
2381 virtual void* Accept(RegExpVisitor* visitor, void* data); | 2384 virtual void* Accept(RegExpVisitor* visitor, void* data); |
2382 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2385 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2383 RegExpNode* on_success); | 2386 RegExpNode* on_success); |
2384 virtual RegExpText* AsText(); | 2387 virtual RegExpText* AsText(); |
2385 virtual bool IsText(); | 2388 virtual bool IsText(); |
2386 virtual bool IsTextElement() { return true; } | 2389 virtual bool IsTextElement() { return true; } |
2387 virtual int min_match() { return length_; } | 2390 virtual int min_match() { return length_; } |
2388 virtual int max_match() { return length_; } | 2391 virtual int max_match() { return length_; } |
2389 virtual void AppendToText(RegExpText* text); | 2392 virtual void AppendToText(RegExpText* text, Zone* zone); |
2390 void AddElement(TextElement elm) { | 2393 void AddElement(TextElement elm, Zone* zone) { |
2391 elements_.Add(elm); | 2394 elements_.Add(elm, zone); |
2392 length_ += elm.length(); | 2395 length_ += elm.length(); |
2393 } | 2396 } |
2394 ZoneList<TextElement>* elements() { return &elements_; } | 2397 ZoneList<TextElement>* elements() { return &elements_; } |
2395 private: | 2398 private: |
2396 ZoneList<TextElement> elements_; | 2399 ZoneList<TextElement> elements_; |
2397 int length_; | 2400 int length_; |
2398 }; | 2401 }; |
2399 | 2402 |
2400 | 2403 |
2401 class RegExpQuantifier: public RegExpTree { | 2404 class RegExpQuantifier: public RegExpTree { |
(...skipping 287 matching lines...) Loading... |
2689 ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface); | 2692 ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface); |
2690 VISIT_AND_RETURN(ModuleLiteral, module) | 2693 VISIT_AND_RETURN(ModuleLiteral, module) |
2691 } | 2694 } |
2692 | 2695 |
2693 ModuleVariable* NewModuleVariable(VariableProxy* proxy) { | 2696 ModuleVariable* NewModuleVariable(VariableProxy* proxy) { |
2694 ModuleVariable* module = new(zone_) ModuleVariable(proxy); | 2697 ModuleVariable* module = new(zone_) ModuleVariable(proxy); |
2695 VISIT_AND_RETURN(ModuleVariable, module) | 2698 VISIT_AND_RETURN(ModuleVariable, module) |
2696 } | 2699 } |
2697 | 2700 |
2698 ModulePath* NewModulePath(Module* origin, Handle<String> name) { | 2701 ModulePath* NewModulePath(Module* origin, Handle<String> name) { |
2699 ModulePath* module = new(zone_) ModulePath(origin, name); | 2702 ModulePath* module = new(zone_) ModulePath(origin, name, zone_); |
2700 VISIT_AND_RETURN(ModulePath, module) | 2703 VISIT_AND_RETURN(ModulePath, module) |
2701 } | 2704 } |
2702 | 2705 |
2703 ModuleUrl* NewModuleUrl(Handle<String> url) { | 2706 ModuleUrl* NewModuleUrl(Handle<String> url) { |
2704 ModuleUrl* module = new(zone_) ModuleUrl(url); | 2707 ModuleUrl* module = new(zone_) ModuleUrl(url, zone_); |
2705 VISIT_AND_RETURN(ModuleUrl, module) | 2708 VISIT_AND_RETURN(ModuleUrl, module) |
2706 } | 2709 } |
2707 | 2710 |
2708 Block* NewBlock(ZoneStringList* labels, | 2711 Block* NewBlock(ZoneStringList* labels, |
2709 int capacity, | 2712 int capacity, |
2710 bool is_initializer_block) { | 2713 bool is_initializer_block, |
| 2714 Zone* zone) { |
2711 Block* block = new(zone_) Block( | 2715 Block* block = new(zone_) Block( |
2712 isolate_, labels, capacity, is_initializer_block); | 2716 isolate_, labels, capacity, is_initializer_block, zone); |
2713 VISIT_AND_RETURN(Block, block) | 2717 VISIT_AND_RETURN(Block, block) |
2714 } | 2718 } |
2715 | 2719 |
2716 #define STATEMENT_WITH_LABELS(NodeType) \ | 2720 #define STATEMENT_WITH_LABELS(NodeType) \ |
2717 NodeType* New##NodeType(ZoneStringList* labels) { \ | 2721 NodeType* New##NodeType(ZoneStringList* labels) { \ |
2718 NodeType* stmt = new(zone_) NodeType(isolate_, labels); \ | 2722 NodeType* stmt = new(zone_) NodeType(isolate_, labels); \ |
2719 VISIT_AND_RETURN(NodeType, stmt); \ | 2723 VISIT_AND_RETURN(NodeType, stmt); \ |
2720 } | 2724 } |
2721 STATEMENT_WITH_LABELS(DoWhileStatement) | 2725 STATEMENT_WITH_LABELS(DoWhileStatement) |
2722 STATEMENT_WITH_LABELS(WhileStatement) | 2726 STATEMENT_WITH_LABELS(WhileStatement) |
(...skipping 257 matching lines...) Loading... |
2980 private: | 2984 private: |
2981 Isolate* isolate_; | 2985 Isolate* isolate_; |
2982 Zone* zone_; | 2986 Zone* zone_; |
2983 Visitor visitor_; | 2987 Visitor visitor_; |
2984 }; | 2988 }; |
2985 | 2989 |
2986 | 2990 |
2987 } } // namespace v8::internal | 2991 } } // namespace v8::internal |
2988 | 2992 |
2989 #endif // V8_AST_H_ | 2993 #endif // V8_AST_H_ |
OLD | NEW |