Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: src/ast.h

Issue 22796020: Reland "Use V8_FINAL and V8_OVERRIDE in various places, fixing bugs revealed by them.". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-gap-resolver-arm.h ('k') | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 AST_NODE_LIST(DEF_FORWARD_DECLARATION) 158 AST_NODE_LIST(DEF_FORWARD_DECLARATION)
159 #undef DEF_FORWARD_DECLARATION 159 #undef DEF_FORWARD_DECLARATION
160 160
161 161
162 // Typedef only introduced to avoid unreadable code. 162 // Typedef only introduced to avoid unreadable code.
163 // Please do appreciate the required space in "> >". 163 // Please do appreciate the required space in "> >".
164 typedef ZoneList<Handle<String> > ZoneStringList; 164 typedef ZoneList<Handle<String> > ZoneStringList;
165 typedef ZoneList<Handle<Object> > ZoneObjectList; 165 typedef ZoneList<Handle<Object> > ZoneObjectList;
166 166
167 167
168 #define DECLARE_NODE_TYPE(type) \ 168 #define DECLARE_NODE_TYPE(type) \
169 virtual void Accept(AstVisitor* v); \ 169 virtual void Accept(AstVisitor* v) V8_OVERRIDE; \
170 virtual AstNode::NodeType node_type() const { return AstNode::k##type; } \ 170 virtual AstNode::NodeType node_type() const V8_FINAL V8_OVERRIDE { \
171 return AstNode::k##type; \
172 } \
171 template<class> friend class AstNodeFactory; 173 template<class> friend class AstNodeFactory;
172 174
173 175
174 enum AstPropertiesFlag { 176 enum AstPropertiesFlag {
175 kDontInline, 177 kDontInline,
176 kDontOptimize, 178 kDontOptimize,
177 kDontSelfOptimize, 179 kDontSelfOptimize,
178 kDontSoftInline, 180 kDontSoftInline,
179 kDontCache 181 kDontCache
180 }; 182 };
181 183
182 184
183 class AstProperties BASE_EMBEDDED { 185 class AstProperties V8_FINAL BASE_EMBEDDED {
184 public: 186 public:
185 class Flags : public EnumSet<AstPropertiesFlag, int> {}; 187 class Flags : public EnumSet<AstPropertiesFlag, int> {};
186 188
187 AstProperties() : node_count_(0) { } 189 AstProperties() : node_count_(0) { }
188 190
189 Flags* flags() { return &flags_; } 191 Flags* flags() { return &flags_; }
190 int node_count() { return node_count_; } 192 int node_count() { return node_count_; }
191 void add_node_count(int count) { node_count_ += count; } 193 void add_node_count(int count) { node_count_ += count; }
192 194
193 private: 195 private:
194 Flags flags_; 196 Flags flags_;
195 int node_count_; 197 int node_count_;
196 }; 198 };
197 199
198 200
199 class AstNode: public ZoneObject { 201 class AstNode: public ZoneObject {
200 public: 202 public:
201 #define DECLARE_TYPE_ENUM(type) k##type, 203 #define DECLARE_TYPE_ENUM(type) k##type,
202 enum NodeType { 204 enum NodeType {
203 AST_NODE_LIST(DECLARE_TYPE_ENUM) 205 AST_NODE_LIST(DECLARE_TYPE_ENUM)
204 kInvalid = -1 206 kInvalid = -1
205 }; 207 };
206 #undef DECLARE_TYPE_ENUM 208 #undef DECLARE_TYPE_ENUM
207 209
208 void* operator new(size_t size, Zone* zone) { 210 void* operator new(size_t size, Zone* zone) {
209 return zone->New(static_cast<int>(size)); 211 return zone->New(static_cast<int>(size));
210 } 212 }
211 213
212 AstNode() { } 214 AstNode() {}
213 215
214 virtual ~AstNode() { } 216 virtual ~AstNode() {}
215 217
216 virtual void Accept(AstVisitor* v) = 0; 218 virtual void Accept(AstVisitor* v) = 0;
217 virtual NodeType node_type() const = 0; 219 virtual NodeType node_type() const = 0;
218 220
219 // Type testing & conversion functions overridden by concrete subclasses. 221 // Type testing & conversion functions overridden by concrete subclasses.
220 #define DECLARE_NODE_FUNCTIONS(type) \ 222 #define DECLARE_NODE_FUNCTIONS(type) \
221 bool Is##type() { return node_type() == AstNode::k##type; } \ 223 bool Is##type() { return node_type() == AstNode::k##type; } \
222 type* As##type() { return Is##type() ? reinterpret_cast<type*>(this) : NULL; } 224 type* As##type() { return Is##type() ? reinterpret_cast<type*>(this) : NULL; }
223 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 225 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
224 #undef DECLARE_NODE_FUNCTIONS 226 #undef DECLARE_NODE_FUNCTIONS
(...skipping 22 matching lines...) Expand all
247 249
248 private: 250 private:
249 // Hidden to prevent accidental usage. It would have to load the 251 // Hidden to prevent accidental usage. It would have to load the
250 // current zone from the TLS. 252 // current zone from the TLS.
251 void* operator new(size_t size); 253 void* operator new(size_t size);
252 254
253 friend class CaseClause; // Generates AST IDs. 255 friend class CaseClause; // Generates AST IDs.
254 }; 256 };
255 257
256 258
257 class Statement: public AstNode { 259 class Statement : public AstNode {
258 public: 260 public:
259 Statement() : statement_pos_(RelocInfo::kNoPosition) {} 261 Statement() : statement_pos_(RelocInfo::kNoPosition) {}
260 262
261 bool IsEmpty() { return AsEmptyStatement() != NULL; } 263 bool IsEmpty() { return AsEmptyStatement() != NULL; }
262 virtual bool IsJump() const { return false; } 264 virtual bool IsJump() const { return false; }
263 265
264 void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; } 266 void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; }
265 int statement_pos() const { return statement_pos_; } 267 int statement_pos() const { return statement_pos_; }
266 268
267 private: 269 private:
268 int statement_pos_; 270 int statement_pos_;
269 }; 271 };
270 272
271 273
272 class SmallMapList { 274 class SmallMapList V8_FINAL {
273 public: 275 public:
274 SmallMapList() {} 276 SmallMapList() {}
275 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} 277 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {}
276 278
277 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } 279 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); }
278 void Clear() { list_.Clear(); } 280 void Clear() { list_.Clear(); }
279 void Sort() { list_.Sort(); } 281 void Sort() { list_.Sort(); }
280 282
281 bool is_empty() const { return list_.is_empty(); } 283 bool is_empty() const { return list_.is_empty(); }
282 int length() const { return list_.length(); } 284 int length() const { return list_.length(); }
(...skipping 20 matching lines...) Expand all
303 Handle<Map> last() const { return at(length() - 1); } 305 Handle<Map> last() const { return at(length() - 1); }
304 306
305 private: 307 private:
306 // The list stores pointers to Map*, that is Map**, so it's GC safe. 308 // The list stores pointers to Map*, that is Map**, so it's GC safe.
307 SmallPointerList<Map*> list_; 309 SmallPointerList<Map*> list_;
308 310
309 DISALLOW_COPY_AND_ASSIGN(SmallMapList); 311 DISALLOW_COPY_AND_ASSIGN(SmallMapList);
310 }; 312 };
311 313
312 314
313 class Expression: public AstNode { 315 class Expression : public AstNode {
314 public: 316 public:
315 enum Context { 317 enum Context {
316 // Not assigned a context yet, or else will not be visited during 318 // Not assigned a context yet, or else will not be visited during
317 // code generation. 319 // code generation.
318 kUninitialized, 320 kUninitialized,
319 // Evaluated for its side effects. 321 // Evaluated for its side effects.
320 kEffect, 322 kEffect,
321 // Evaluated for its value (and side effects). 323 // Evaluated for its value (and side effects).
322 kValue, 324 kValue,
323 // Evaluated for control flow (and side effects). 325 // Evaluated for control flow (and side effects).
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 398
397 private: 399 private:
398 Bounds bounds_; 400 Bounds bounds_;
399 byte to_boolean_types_; 401 byte to_boolean_types_;
400 402
401 const BailoutId id_; 403 const BailoutId id_;
402 const TypeFeedbackId test_id_; 404 const TypeFeedbackId test_id_;
403 }; 405 };
404 406
405 407
406 class BreakableStatement: public Statement { 408 class BreakableStatement : public Statement {
407 public: 409 public:
408 enum BreakableType { 410 enum BreakableType {
409 TARGET_FOR_ANONYMOUS, 411 TARGET_FOR_ANONYMOUS,
410 TARGET_FOR_NAMED_ONLY 412 TARGET_FOR_NAMED_ONLY
411 }; 413 };
412 414
413 // The labels associated with this statement. May be NULL; 415 // The labels associated with this statement. May be NULL;
414 // if it is != NULL, guaranteed to contain at least one entry. 416 // if it is != NULL, guaranteed to contain at least one entry.
415 ZoneStringList* labels() const { return labels_; } 417 ZoneStringList* labels() const { return labels_; }
416 418
417 // Type testing & conversion. 419 // Type testing & conversion.
418 virtual BreakableStatement* AsBreakableStatement() { return this; } 420 virtual BreakableStatement* AsBreakableStatement() V8_FINAL V8_OVERRIDE {
421 return this;
422 }
419 423
420 // Code generation 424 // Code generation
421 Label* break_target() { return &break_target_; } 425 Label* break_target() { return &break_target_; }
422 426
423 // Testers. 427 // Testers.
424 bool is_target_for_anonymous() const { 428 bool is_target_for_anonymous() const {
425 return breakable_type_ == TARGET_FOR_ANONYMOUS; 429 return breakable_type_ == TARGET_FOR_ANONYMOUS;
426 } 430 }
427 431
428 BailoutId EntryId() const { return entry_id_; } 432 BailoutId EntryId() const { return entry_id_; }
(...skipping 12 matching lines...) Expand all
441 445
442 private: 446 private:
443 ZoneStringList* labels_; 447 ZoneStringList* labels_;
444 BreakableType breakable_type_; 448 BreakableType breakable_type_;
445 Label break_target_; 449 Label break_target_;
446 const BailoutId entry_id_; 450 const BailoutId entry_id_;
447 const BailoutId exit_id_; 451 const BailoutId exit_id_;
448 }; 452 };
449 453
450 454
451 class Block: public BreakableStatement { 455 class Block V8_FINAL : public BreakableStatement {
452 public: 456 public:
453 DECLARE_NODE_TYPE(Block) 457 DECLARE_NODE_TYPE(Block)
454 458
455 void AddStatement(Statement* statement, Zone* zone) { 459 void AddStatement(Statement* statement, Zone* zone) {
456 statements_.Add(statement, zone); 460 statements_.Add(statement, zone);
457 } 461 }
458 462
459 ZoneList<Statement*>* statements() { return &statements_; } 463 ZoneList<Statement*>* statements() { return &statements_; }
460 bool is_initializer_block() const { return is_initializer_block_; } 464 bool is_initializer_block() const { return is_initializer_block_; }
461 465
462 virtual bool IsJump() const { 466 virtual bool IsJump() const V8_OVERRIDE {
463 return !statements_.is_empty() && statements_.last()->IsJump() 467 return !statements_.is_empty() && statements_.last()->IsJump()
464 && labels() == NULL; // Good enough as an approximation... 468 && labels() == NULL; // Good enough as an approximation...
465 } 469 }
466 470
467 Scope* scope() const { return scope_; } 471 Scope* scope() const { return scope_; }
468 void set_scope(Scope* scope) { scope_ = scope; } 472 void set_scope(Scope* scope) { scope_ = scope; }
469 473
470 protected: 474 protected:
471 Block(Isolate* isolate, 475 Block(Isolate* isolate,
472 ZoneStringList* labels, 476 ZoneStringList* labels,
473 int capacity, 477 int capacity,
474 bool is_initializer_block, 478 bool is_initializer_block,
475 Zone* zone) 479 Zone* zone)
476 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), 480 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY),
477 statements_(capacity, zone), 481 statements_(capacity, zone),
478 is_initializer_block_(is_initializer_block), 482 is_initializer_block_(is_initializer_block),
479 scope_(NULL) { 483 scope_(NULL) {
480 } 484 }
481 485
482 private: 486 private:
483 ZoneList<Statement*> statements_; 487 ZoneList<Statement*> statements_;
484 bool is_initializer_block_; 488 bool is_initializer_block_;
485 Scope* scope_; 489 Scope* scope_;
486 }; 490 };
487 491
488 492
489 class Declaration: public AstNode { 493 class Declaration : public AstNode {
490 public: 494 public:
491 VariableProxy* proxy() const { return proxy_; } 495 VariableProxy* proxy() const { return proxy_; }
492 VariableMode mode() const { return mode_; } 496 VariableMode mode() const { return mode_; }
493 Scope* scope() const { return scope_; } 497 Scope* scope() const { return scope_; }
494 virtual InitializationFlag initialization() const = 0; 498 virtual InitializationFlag initialization() const = 0;
495 virtual bool IsInlineable() const; 499 virtual bool IsInlineable() const;
496 500
497 protected: 501 protected:
498 Declaration(VariableProxy* proxy, 502 Declaration(VariableProxy* proxy,
499 VariableMode mode, 503 VariableMode mode,
500 Scope* scope) 504 Scope* scope)
501 : proxy_(proxy), 505 : proxy_(proxy),
502 mode_(mode), 506 mode_(mode),
503 scope_(scope) { 507 scope_(scope) {
504 ASSERT(IsDeclaredVariableMode(mode)); 508 ASSERT(IsDeclaredVariableMode(mode));
505 } 509 }
506 510
507 private: 511 private:
508 VariableProxy* proxy_; 512 VariableProxy* proxy_;
509 VariableMode mode_; 513 VariableMode mode_;
510 514
511 // Nested scope from which the declaration originated. 515 // Nested scope from which the declaration originated.
512 Scope* scope_; 516 Scope* scope_;
513 }; 517 };
514 518
515 519
516 class VariableDeclaration: public Declaration { 520 class VariableDeclaration V8_FINAL : public Declaration {
517 public: 521 public:
518 DECLARE_NODE_TYPE(VariableDeclaration) 522 DECLARE_NODE_TYPE(VariableDeclaration)
519 523
520 virtual InitializationFlag initialization() const { 524 virtual InitializationFlag initialization() const V8_OVERRIDE {
521 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; 525 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization;
522 } 526 }
523 527
524 protected: 528 protected:
525 VariableDeclaration(VariableProxy* proxy, 529 VariableDeclaration(VariableProxy* proxy,
526 VariableMode mode, 530 VariableMode mode,
527 Scope* scope) 531 Scope* scope)
528 : Declaration(proxy, mode, scope) { 532 : Declaration(proxy, mode, scope) {
529 } 533 }
530 }; 534 };
531 535
532 536
533 class FunctionDeclaration: public Declaration { 537 class FunctionDeclaration V8_FINAL : public Declaration {
534 public: 538 public:
535 DECLARE_NODE_TYPE(FunctionDeclaration) 539 DECLARE_NODE_TYPE(FunctionDeclaration)
536 540
537 FunctionLiteral* fun() const { return fun_; } 541 FunctionLiteral* fun() const { return fun_; }
538 virtual InitializationFlag initialization() const { 542 virtual InitializationFlag initialization() const V8_OVERRIDE {
539 return kCreatedInitialized; 543 return kCreatedInitialized;
540 } 544 }
541 virtual bool IsInlineable() const; 545 virtual bool IsInlineable() const V8_OVERRIDE;
542 546
543 protected: 547 protected:
544 FunctionDeclaration(VariableProxy* proxy, 548 FunctionDeclaration(VariableProxy* proxy,
545 VariableMode mode, 549 VariableMode mode,
546 FunctionLiteral* fun, 550 FunctionLiteral* fun,
547 Scope* scope) 551 Scope* scope)
548 : Declaration(proxy, mode, scope), 552 : Declaration(proxy, mode, scope),
549 fun_(fun) { 553 fun_(fun) {
550 // At the moment there are no "const functions" in JavaScript... 554 // At the moment there are no "const functions" in JavaScript...
551 ASSERT(mode == VAR || mode == LET); 555 ASSERT(mode == VAR || mode == LET);
552 ASSERT(fun != NULL); 556 ASSERT(fun != NULL);
553 } 557 }
554 558
555 private: 559 private:
556 FunctionLiteral* fun_; 560 FunctionLiteral* fun_;
557 }; 561 };
558 562
559 563
560 class ModuleDeclaration: public Declaration { 564 class ModuleDeclaration V8_FINAL : public Declaration {
561 public: 565 public:
562 DECLARE_NODE_TYPE(ModuleDeclaration) 566 DECLARE_NODE_TYPE(ModuleDeclaration)
563 567
564 Module* module() const { return module_; } 568 Module* module() const { return module_; }
565 virtual InitializationFlag initialization() const { 569 virtual InitializationFlag initialization() const V8_OVERRIDE {
566 return kCreatedInitialized; 570 return kCreatedInitialized;
567 } 571 }
568 572
569 protected: 573 protected:
570 ModuleDeclaration(VariableProxy* proxy, 574 ModuleDeclaration(VariableProxy* proxy,
571 Module* module, 575 Module* module,
572 Scope* scope) 576 Scope* scope)
573 : Declaration(proxy, MODULE, scope), 577 : Declaration(proxy, MODULE, scope),
574 module_(module) { 578 module_(module) {
575 } 579 }
576 580
577 private: 581 private:
578 Module* module_; 582 Module* module_;
579 }; 583 };
580 584
581 585
582 class ImportDeclaration: public Declaration { 586 class ImportDeclaration V8_FINAL : public Declaration {
583 public: 587 public:
584 DECLARE_NODE_TYPE(ImportDeclaration) 588 DECLARE_NODE_TYPE(ImportDeclaration)
585 589
586 Module* module() const { return module_; } 590 Module* module() const { return module_; }
587 virtual InitializationFlag initialization() const { 591 virtual InitializationFlag initialization() const V8_OVERRIDE {
588 return kCreatedInitialized; 592 return kCreatedInitialized;
589 } 593 }
590 594
591 protected: 595 protected:
592 ImportDeclaration(VariableProxy* proxy, 596 ImportDeclaration(VariableProxy* proxy,
593 Module* module, 597 Module* module,
594 Scope* scope) 598 Scope* scope)
595 : Declaration(proxy, LET, scope), 599 : Declaration(proxy, LET, scope),
596 module_(module) { 600 module_(module) {
597 } 601 }
598 602
599 private: 603 private:
600 Module* module_; 604 Module* module_;
601 }; 605 };
602 606
603 607
604 class ExportDeclaration: public Declaration { 608 class ExportDeclaration V8_FINAL : public Declaration {
605 public: 609 public:
606 DECLARE_NODE_TYPE(ExportDeclaration) 610 DECLARE_NODE_TYPE(ExportDeclaration)
607 611
608 virtual InitializationFlag initialization() const { 612 virtual InitializationFlag initialization() const V8_OVERRIDE {
609 return kCreatedInitialized; 613 return kCreatedInitialized;
610 } 614 }
611 615
612 protected: 616 protected:
613 ExportDeclaration(VariableProxy* proxy, Scope* scope) 617 ExportDeclaration(VariableProxy* proxy, Scope* scope)
614 : Declaration(proxy, LET, scope) {} 618 : Declaration(proxy, LET, scope) {}
615 }; 619 };
616 620
617 621
618 class Module: public AstNode { 622 class Module : public AstNode {
619 public: 623 public:
620 Interface* interface() const { return interface_; } 624 Interface* interface() const { return interface_; }
621 Block* body() const { return body_; } 625 Block* body() const { return body_; }
622 626
623 protected: 627 protected:
624 explicit Module(Zone* zone) 628 explicit Module(Zone* zone)
625 : interface_(Interface::NewModule(zone)), 629 : interface_(Interface::NewModule(zone)),
626 body_(NULL) {} 630 body_(NULL) {}
627 explicit Module(Interface* interface, Block* body = NULL) 631 explicit Module(Interface* interface, Block* body = NULL)
628 : interface_(interface), 632 : interface_(interface),
629 body_(body) {} 633 body_(body) {}
630 634
631 private: 635 private:
632 Interface* interface_; 636 Interface* interface_;
633 Block* body_; 637 Block* body_;
634 }; 638 };
635 639
636 640
637 class ModuleLiteral: public Module { 641 class ModuleLiteral V8_FINAL : public Module {
638 public: 642 public:
639 DECLARE_NODE_TYPE(ModuleLiteral) 643 DECLARE_NODE_TYPE(ModuleLiteral)
640 644
641 protected: 645 protected:
642 ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {} 646 ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {}
643 }; 647 };
644 648
645 649
646 class ModuleVariable: public Module { 650 class ModuleVariable V8_FINAL : public Module {
647 public: 651 public:
648 DECLARE_NODE_TYPE(ModuleVariable) 652 DECLARE_NODE_TYPE(ModuleVariable)
649 653
650 VariableProxy* proxy() const { return proxy_; } 654 VariableProxy* proxy() const { return proxy_; }
651 655
652 protected: 656 protected:
653 inline explicit ModuleVariable(VariableProxy* proxy); 657 inline explicit ModuleVariable(VariableProxy* proxy);
654 658
655 private: 659 private:
656 VariableProxy* proxy_; 660 VariableProxy* proxy_;
657 }; 661 };
658 662
659 663
660 class ModulePath: public Module { 664 class ModulePath V8_FINAL : public Module {
661 public: 665 public:
662 DECLARE_NODE_TYPE(ModulePath) 666 DECLARE_NODE_TYPE(ModulePath)
663 667
664 Module* module() const { return module_; } 668 Module* module() const { return module_; }
665 Handle<String> name() const { return name_; } 669 Handle<String> name() const { return name_; }
666 670
667 protected: 671 protected:
668 ModulePath(Module* module, Handle<String> name, Zone* zone) 672 ModulePath(Module* module, Handle<String> name, Zone* zone)
669 : Module(zone), 673 : Module(zone),
670 module_(module), 674 module_(module),
671 name_(name) { 675 name_(name) {
672 } 676 }
673 677
674 private: 678 private:
675 Module* module_; 679 Module* module_;
676 Handle<String> name_; 680 Handle<String> name_;
677 }; 681 };
678 682
679 683
680 class ModuleUrl: public Module { 684 class ModuleUrl V8_FINAL : public Module {
681 public: 685 public:
682 DECLARE_NODE_TYPE(ModuleUrl) 686 DECLARE_NODE_TYPE(ModuleUrl)
683 687
684 Handle<String> url() const { return url_; } 688 Handle<String> url() const { return url_; }
685 689
686 protected: 690 protected:
687 ModuleUrl(Handle<String> url, Zone* zone) 691 ModuleUrl(Handle<String> url, Zone* zone)
688 : Module(zone), url_(url) { 692 : Module(zone), url_(url) {
689 } 693 }
690 694
691 private: 695 private:
692 Handle<String> url_; 696 Handle<String> url_;
693 }; 697 };
694 698
695 699
696 class ModuleStatement: public Statement { 700 class ModuleStatement V8_FINAL : public Statement {
697 public: 701 public:
698 DECLARE_NODE_TYPE(ModuleStatement) 702 DECLARE_NODE_TYPE(ModuleStatement)
699 703
700 VariableProxy* proxy() const { return proxy_; } 704 VariableProxy* proxy() const { return proxy_; }
701 Block* body() const { return body_; } 705 Block* body() const { return body_; }
702 706
703 protected: 707 protected:
704 ModuleStatement(VariableProxy* proxy, Block* body) 708 ModuleStatement(VariableProxy* proxy, Block* body)
705 : proxy_(proxy), 709 : proxy_(proxy),
706 body_(body) { 710 body_(body) {
707 } 711 }
708 712
709 private: 713 private:
710 VariableProxy* proxy_; 714 VariableProxy* proxy_;
711 Block* body_; 715 Block* body_;
712 }; 716 };
713 717
714 718
715 class IterationStatement: public BreakableStatement { 719 class IterationStatement : public BreakableStatement {
716 public: 720 public:
717 // Type testing & conversion. 721 // Type testing & conversion.
718 virtual IterationStatement* AsIterationStatement() { return this; } 722 virtual IterationStatement* AsIterationStatement() V8_FINAL V8_OVERRIDE {
723 return this;
724 }
719 725
720 Statement* body() const { return body_; } 726 Statement* body() const { return body_; }
721 727
722 BailoutId OsrEntryId() const { return osr_entry_id_; } 728 BailoutId OsrEntryId() const { return osr_entry_id_; }
723 virtual BailoutId ContinueId() const = 0; 729 virtual BailoutId ContinueId() const = 0;
724 virtual BailoutId StackCheckId() const = 0; 730 virtual BailoutId StackCheckId() const = 0;
725 731
726 // Code generation 732 // Code generation
727 Label* continue_target() { return &continue_target_; } 733 Label* continue_target() { return &continue_target_; }
728 734
729 protected: 735 protected:
730 IterationStatement(Isolate* isolate, ZoneStringList* labels) 736 IterationStatement(Isolate* isolate, ZoneStringList* labels)
731 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), 737 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
732 body_(NULL), 738 body_(NULL),
733 osr_entry_id_(GetNextId(isolate)) { 739 osr_entry_id_(GetNextId(isolate)) {
734 } 740 }
735 741
736 void Initialize(Statement* body) { 742 void Initialize(Statement* body) {
737 body_ = body; 743 body_ = body;
738 } 744 }
739 745
740 private: 746 private:
741 Statement* body_; 747 Statement* body_;
742 Label continue_target_; 748 Label continue_target_;
743 749
744 const BailoutId osr_entry_id_; 750 const BailoutId osr_entry_id_;
745 }; 751 };
746 752
747 753
748 class DoWhileStatement: public IterationStatement { 754 class DoWhileStatement V8_FINAL : public IterationStatement {
749 public: 755 public:
750 DECLARE_NODE_TYPE(DoWhileStatement) 756 DECLARE_NODE_TYPE(DoWhileStatement)
751 757
752 void Initialize(Expression* cond, Statement* body) { 758 void Initialize(Expression* cond, Statement* body) {
753 IterationStatement::Initialize(body); 759 IterationStatement::Initialize(body);
754 cond_ = cond; 760 cond_ = cond;
755 } 761 }
756 762
757 Expression* cond() const { return cond_; } 763 Expression* cond() const { return cond_; }
758 764
759 // Position where condition expression starts. We need it to make 765 // Position where condition expression starts. We need it to make
760 // the loop's condition a breakable location. 766 // the loop's condition a breakable location.
761 int condition_position() { return condition_position_; } 767 int condition_position() { return condition_position_; }
762 void set_condition_position(int pos) { condition_position_ = pos; } 768 void set_condition_position(int pos) { condition_position_ = pos; }
763 769
764 virtual BailoutId ContinueId() const { return continue_id_; } 770 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; }
765 virtual BailoutId StackCheckId() const { return back_edge_id_; } 771 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; }
766 BailoutId BackEdgeId() const { return back_edge_id_; } 772 BailoutId BackEdgeId() const { return back_edge_id_; }
767 773
768 protected: 774 protected:
769 DoWhileStatement(Isolate* isolate, ZoneStringList* labels) 775 DoWhileStatement(Isolate* isolate, ZoneStringList* labels)
770 : IterationStatement(isolate, labels), 776 : IterationStatement(isolate, labels),
771 cond_(NULL), 777 cond_(NULL),
772 condition_position_(-1), 778 condition_position_(-1),
773 continue_id_(GetNextId(isolate)), 779 continue_id_(GetNextId(isolate)),
774 back_edge_id_(GetNextId(isolate)) { 780 back_edge_id_(GetNextId(isolate)) {
775 } 781 }
776 782
777 private: 783 private:
778 Expression* cond_; 784 Expression* cond_;
779 785
780 int condition_position_; 786 int condition_position_;
781 787
782 const BailoutId continue_id_; 788 const BailoutId continue_id_;
783 const BailoutId back_edge_id_; 789 const BailoutId back_edge_id_;
784 }; 790 };
785 791
786 792
787 class WhileStatement: public IterationStatement { 793 class WhileStatement V8_FINAL : public IterationStatement {
788 public: 794 public:
789 DECLARE_NODE_TYPE(WhileStatement) 795 DECLARE_NODE_TYPE(WhileStatement)
790 796
791 void Initialize(Expression* cond, Statement* body) { 797 void Initialize(Expression* cond, Statement* body) {
792 IterationStatement::Initialize(body); 798 IterationStatement::Initialize(body);
793 cond_ = cond; 799 cond_ = cond;
794 } 800 }
795 801
796 Expression* cond() const { return cond_; } 802 Expression* cond() const { return cond_; }
797 bool may_have_function_literal() const { 803 bool may_have_function_literal() const {
798 return may_have_function_literal_; 804 return may_have_function_literal_;
799 } 805 }
800 void set_may_have_function_literal(bool value) { 806 void set_may_have_function_literal(bool value) {
801 may_have_function_literal_ = value; 807 may_have_function_literal_ = value;
802 } 808 }
803 809
804 virtual BailoutId ContinueId() const { return EntryId(); } 810 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
805 virtual BailoutId StackCheckId() const { return body_id_; } 811 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
806 BailoutId BodyId() const { return body_id_; } 812 BailoutId BodyId() const { return body_id_; }
807 813
808 protected: 814 protected:
809 WhileStatement(Isolate* isolate, ZoneStringList* labels) 815 WhileStatement(Isolate* isolate, ZoneStringList* labels)
810 : IterationStatement(isolate, labels), 816 : IterationStatement(isolate, labels),
811 cond_(NULL), 817 cond_(NULL),
812 may_have_function_literal_(true), 818 may_have_function_literal_(true),
813 body_id_(GetNextId(isolate)) { 819 body_id_(GetNextId(isolate)) {
814 } 820 }
815 821
816 private: 822 private:
817 Expression* cond_; 823 Expression* cond_;
818 824
819 // True if there is a function literal subexpression in the condition. 825 // True if there is a function literal subexpression in the condition.
820 bool may_have_function_literal_; 826 bool may_have_function_literal_;
821 827
822 const BailoutId body_id_; 828 const BailoutId body_id_;
823 }; 829 };
824 830
825 831
826 class ForStatement: public IterationStatement { 832 class ForStatement V8_FINAL : public IterationStatement {
827 public: 833 public:
828 DECLARE_NODE_TYPE(ForStatement) 834 DECLARE_NODE_TYPE(ForStatement)
829 835
830 void Initialize(Statement* init, 836 void Initialize(Statement* init,
831 Expression* cond, 837 Expression* cond,
832 Statement* next, 838 Statement* next,
833 Statement* body) { 839 Statement* body) {
834 IterationStatement::Initialize(body); 840 IterationStatement::Initialize(body);
835 init_ = init; 841 init_ = init;
836 cond_ = cond; 842 cond_ = cond;
837 next_ = next; 843 next_ = next;
838 } 844 }
839 845
840 Statement* init() const { return init_; } 846 Statement* init() const { return init_; }
841 Expression* cond() const { return cond_; } 847 Expression* cond() const { return cond_; }
842 Statement* next() const { return next_; } 848 Statement* next() const { return next_; }
843 849
844 bool may_have_function_literal() const { 850 bool may_have_function_literal() const {
845 return may_have_function_literal_; 851 return may_have_function_literal_;
846 } 852 }
847 void set_may_have_function_literal(bool value) { 853 void set_may_have_function_literal(bool value) {
848 may_have_function_literal_ = value; 854 may_have_function_literal_ = value;
849 } 855 }
850 856
851 virtual BailoutId ContinueId() const { return continue_id_; } 857 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; }
852 virtual BailoutId StackCheckId() const { return body_id_; } 858 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
853 BailoutId BodyId() const { return body_id_; } 859 BailoutId BodyId() const { return body_id_; }
854 860
855 bool is_fast_smi_loop() { return loop_variable_ != NULL; } 861 bool is_fast_smi_loop() { return loop_variable_ != NULL; }
856 Variable* loop_variable() { return loop_variable_; } 862 Variable* loop_variable() { return loop_variable_; }
857 void set_loop_variable(Variable* var) { loop_variable_ = var; } 863 void set_loop_variable(Variable* var) { loop_variable_ = var; }
858 864
859 protected: 865 protected:
860 ForStatement(Isolate* isolate, ZoneStringList* labels) 866 ForStatement(Isolate* isolate, ZoneStringList* labels)
861 : IterationStatement(isolate, labels), 867 : IterationStatement(isolate, labels),
862 init_(NULL), 868 init_(NULL),
(...skipping 12 matching lines...) Expand all
875 881
876 // True if there is a function literal subexpression in the condition. 882 // True if there is a function literal subexpression in the condition.
877 bool may_have_function_literal_; 883 bool may_have_function_literal_;
878 Variable* loop_variable_; 884 Variable* loop_variable_;
879 885
880 const BailoutId continue_id_; 886 const BailoutId continue_id_;
881 const BailoutId body_id_; 887 const BailoutId body_id_;
882 }; 888 };
883 889
884 890
885 class ForEachStatement: public IterationStatement { 891 class ForEachStatement : public IterationStatement {
886 public: 892 public:
887 enum VisitMode { 893 enum VisitMode {
888 ENUMERATE, // for (each in subject) body; 894 ENUMERATE, // for (each in subject) body;
889 ITERATE // for (each of subject) body; 895 ITERATE // for (each of subject) body;
890 }; 896 };
891 897
892 void Initialize(Expression* each, Expression* subject, Statement* body) { 898 void Initialize(Expression* each, Expression* subject, Statement* body) {
893 IterationStatement::Initialize(body); 899 IterationStatement::Initialize(body);
894 each_ = each; 900 each_ = each;
895 subject_ = subject; 901 subject_ = subject;
896 } 902 }
897 903
898 Expression* each() const { return each_; } 904 Expression* each() const { return each_; }
899 Expression* subject() const { return subject_; } 905 Expression* subject() const { return subject_; }
900 906
901 protected: 907 protected:
902 ForEachStatement(Isolate* isolate, ZoneStringList* labels) 908 ForEachStatement(Isolate* isolate, ZoneStringList* labels)
903 : IterationStatement(isolate, labels), 909 : IterationStatement(isolate, labels),
904 each_(NULL), 910 each_(NULL),
905 subject_(NULL) { 911 subject_(NULL) {
906 } 912 }
907 913
908 private: 914 private:
909 Expression* each_; 915 Expression* each_;
910 Expression* subject_; 916 Expression* subject_;
911 }; 917 };
912 918
913 919
914 class ForInStatement: public ForEachStatement { 920 class ForInStatement V8_FINAL : public ForEachStatement {
915 public: 921 public:
916 DECLARE_NODE_TYPE(ForInStatement) 922 DECLARE_NODE_TYPE(ForInStatement)
917 923
918 Expression* enumerable() const { 924 Expression* enumerable() const {
919 return subject(); 925 return subject();
920 } 926 }
921 927
922 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } 928 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); }
923 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 929 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
924 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; 930 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN };
925 ForInType for_in_type() const { return for_in_type_; } 931 ForInType for_in_type() const { return for_in_type_; }
926 932
927 BailoutId BodyId() const { return body_id_; } 933 BailoutId BodyId() const { return body_id_; }
928 BailoutId PrepareId() const { return prepare_id_; } 934 BailoutId PrepareId() const { return prepare_id_; }
929 virtual BailoutId ContinueId() const { return EntryId(); } 935 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
930 virtual BailoutId StackCheckId() const { return body_id_; } 936 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
931 937
932 protected: 938 protected:
933 ForInStatement(Isolate* isolate, ZoneStringList* labels) 939 ForInStatement(Isolate* isolate, ZoneStringList* labels)
934 : ForEachStatement(isolate, labels), 940 : ForEachStatement(isolate, labels),
935 for_in_type_(SLOW_FOR_IN), 941 for_in_type_(SLOW_FOR_IN),
936 body_id_(GetNextId(isolate)), 942 body_id_(GetNextId(isolate)),
937 prepare_id_(GetNextId(isolate)) { 943 prepare_id_(GetNextId(isolate)) {
938 } 944 }
939 945
940 ForInType for_in_type_; 946 ForInType for_in_type_;
941 const BailoutId body_id_; 947 const BailoutId body_id_;
942 const BailoutId prepare_id_; 948 const BailoutId prepare_id_;
943 }; 949 };
944 950
945 951
946 class ForOfStatement: public ForEachStatement { 952 class ForOfStatement V8_FINAL : public ForEachStatement {
947 public: 953 public:
948 DECLARE_NODE_TYPE(ForOfStatement) 954 DECLARE_NODE_TYPE(ForOfStatement)
949 955
950 void Initialize(Expression* each, 956 void Initialize(Expression* each,
951 Expression* subject, 957 Expression* subject,
952 Statement* body, 958 Statement* body,
953 Expression* assign_iterator, 959 Expression* assign_iterator,
954 Expression* next_result, 960 Expression* next_result,
955 Expression* result_done, 961 Expression* result_done,
956 Expression* assign_each) { 962 Expression* assign_each) {
(...skipping 21 matching lines...) Expand all
978 // result.done 984 // result.done
979 Expression* result_done() const { 985 Expression* result_done() const {
980 return result_done_; 986 return result_done_;
981 } 987 }
982 988
983 // each = result.value 989 // each = result.value
984 Expression* assign_each() const { 990 Expression* assign_each() const {
985 return assign_each_; 991 return assign_each_;
986 } 992 }
987 993
988 virtual BailoutId ContinueId() const { return EntryId(); } 994 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
989 virtual BailoutId StackCheckId() const { return BackEdgeId(); } 995 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); }
990 996
991 BailoutId BackEdgeId() const { return back_edge_id_; } 997 BailoutId BackEdgeId() const { return back_edge_id_; }
992 998
993 protected: 999 protected:
994 ForOfStatement(Isolate* isolate, ZoneStringList* labels) 1000 ForOfStatement(Isolate* isolate, ZoneStringList* labels)
995 : ForEachStatement(isolate, labels), 1001 : ForEachStatement(isolate, labels),
996 assign_iterator_(NULL), 1002 assign_iterator_(NULL),
997 next_result_(NULL), 1003 next_result_(NULL),
998 result_done_(NULL), 1004 result_done_(NULL),
999 assign_each_(NULL), 1005 assign_each_(NULL),
1000 back_edge_id_(GetNextId(isolate)) { 1006 back_edge_id_(GetNextId(isolate)) {
1001 } 1007 }
1002 1008
1003 Expression* assign_iterator_; 1009 Expression* assign_iterator_;
1004 Expression* next_result_; 1010 Expression* next_result_;
1005 Expression* result_done_; 1011 Expression* result_done_;
1006 Expression* assign_each_; 1012 Expression* assign_each_;
1007 const BailoutId back_edge_id_; 1013 const BailoutId back_edge_id_;
1008 }; 1014 };
1009 1015
1010 1016
1011 class ExpressionStatement: public Statement { 1017 class ExpressionStatement V8_FINAL : public Statement {
1012 public: 1018 public:
1013 DECLARE_NODE_TYPE(ExpressionStatement) 1019 DECLARE_NODE_TYPE(ExpressionStatement)
1014 1020
1015 void set_expression(Expression* e) { expression_ = e; } 1021 void set_expression(Expression* e) { expression_ = e; }
1016 Expression* expression() const { return expression_; } 1022 Expression* expression() const { return expression_; }
1017 virtual bool IsJump() const { return expression_->IsThrow(); } 1023 virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); }
1018 1024
1019 protected: 1025 protected:
1020 explicit ExpressionStatement(Expression* expression) 1026 explicit ExpressionStatement(Expression* expression)
1021 : expression_(expression) { } 1027 : expression_(expression) { }
1022 1028
1023 private: 1029 private:
1024 Expression* expression_; 1030 Expression* expression_;
1025 }; 1031 };
1026 1032
1027 1033
1028 class JumpStatement: public Statement { 1034 class JumpStatement : public Statement {
1029 public: 1035 public:
1030 virtual bool IsJump() const { return true; } 1036 virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; }
1031 1037
1032 protected: 1038 protected:
1033 JumpStatement() {} 1039 JumpStatement() {}
1034 }; 1040 };
1035 1041
1036 1042
1037 class ContinueStatement: public JumpStatement { 1043 class ContinueStatement V8_FINAL : public JumpStatement {
1038 public: 1044 public:
1039 DECLARE_NODE_TYPE(ContinueStatement) 1045 DECLARE_NODE_TYPE(ContinueStatement)
1040 1046
1041 IterationStatement* target() const { return target_; } 1047 IterationStatement* target() const { return target_; }
1042 1048
1043 protected: 1049 protected:
1044 explicit ContinueStatement(IterationStatement* target) 1050 explicit ContinueStatement(IterationStatement* target)
1045 : target_(target) { } 1051 : target_(target) { }
1046 1052
1047 private: 1053 private:
1048 IterationStatement* target_; 1054 IterationStatement* target_;
1049 }; 1055 };
1050 1056
1051 1057
1052 class BreakStatement: public JumpStatement { 1058 class BreakStatement V8_FINAL : public JumpStatement {
1053 public: 1059 public:
1054 DECLARE_NODE_TYPE(BreakStatement) 1060 DECLARE_NODE_TYPE(BreakStatement)
1055 1061
1056 BreakableStatement* target() const { return target_; } 1062 BreakableStatement* target() const { return target_; }
1057 1063
1058 protected: 1064 protected:
1059 explicit BreakStatement(BreakableStatement* target) 1065 explicit BreakStatement(BreakableStatement* target)
1060 : target_(target) { } 1066 : target_(target) { }
1061 1067
1062 private: 1068 private:
1063 BreakableStatement* target_; 1069 BreakableStatement* target_;
1064 }; 1070 };
1065 1071
1066 1072
1067 class ReturnStatement: public JumpStatement { 1073 class ReturnStatement V8_FINAL : public JumpStatement {
1068 public: 1074 public:
1069 DECLARE_NODE_TYPE(ReturnStatement) 1075 DECLARE_NODE_TYPE(ReturnStatement)
1070 1076
1071 Expression* expression() const { return expression_; } 1077 Expression* expression() const { return expression_; }
1072 1078
1073 protected: 1079 protected:
1074 explicit ReturnStatement(Expression* expression) 1080 explicit ReturnStatement(Expression* expression)
1075 : expression_(expression) { } 1081 : expression_(expression) { }
1076 1082
1077 private: 1083 private:
1078 Expression* expression_; 1084 Expression* expression_;
1079 }; 1085 };
1080 1086
1081 1087
1082 class WithStatement: public Statement { 1088 class WithStatement V8_FINAL : public Statement {
1083 public: 1089 public:
1084 DECLARE_NODE_TYPE(WithStatement) 1090 DECLARE_NODE_TYPE(WithStatement)
1085 1091
1086 Scope* scope() { return scope_; } 1092 Scope* scope() { return scope_; }
1087 Expression* expression() const { return expression_; } 1093 Expression* expression() const { return expression_; }
1088 Statement* statement() const { return statement_; } 1094 Statement* statement() const { return statement_; }
1089 1095
1090 protected: 1096 protected:
1091 WithStatement(Scope* scope, Expression* expression, Statement* statement) 1097 WithStatement(Scope* scope, Expression* expression, Statement* statement)
1092 : scope_(scope), 1098 : scope_(scope),
1093 expression_(expression), 1099 expression_(expression),
1094 statement_(statement) { } 1100 statement_(statement) { }
1095 1101
1096 private: 1102 private:
1097 Scope* scope_; 1103 Scope* scope_;
1098 Expression* expression_; 1104 Expression* expression_;
1099 Statement* statement_; 1105 Statement* statement_;
1100 }; 1106 };
1101 1107
1102 1108
1103 class CaseClause: public ZoneObject { 1109 class CaseClause V8_FINAL : public ZoneObject {
1104 public: 1110 public:
1105 CaseClause(Isolate* isolate, 1111 CaseClause(Isolate* isolate,
1106 Expression* label, 1112 Expression* label,
1107 ZoneList<Statement*>* statements, 1113 ZoneList<Statement*>* statements,
1108 int pos); 1114 int pos);
1109 1115
1110 bool is_default() const { return label_ == NULL; } 1116 bool is_default() const { return label_ == NULL; }
1111 Expression* label() const { 1117 Expression* label() const {
1112 CHECK(!is_default()); 1118 CHECK(!is_default());
1113 return label_; 1119 return label_;
(...skipping 16 matching lines...) Expand all
1130 Label body_target_; 1136 Label body_target_;
1131 ZoneList<Statement*>* statements_; 1137 ZoneList<Statement*>* statements_;
1132 int position_; 1138 int position_;
1133 Handle<Type> compare_type_; 1139 Handle<Type> compare_type_;
1134 1140
1135 const TypeFeedbackId compare_id_; 1141 const TypeFeedbackId compare_id_;
1136 const BailoutId entry_id_; 1142 const BailoutId entry_id_;
1137 }; 1143 };
1138 1144
1139 1145
1140 class SwitchStatement: public BreakableStatement { 1146 class SwitchStatement V8_FINAL : public BreakableStatement {
1141 public: 1147 public:
1142 DECLARE_NODE_TYPE(SwitchStatement) 1148 DECLARE_NODE_TYPE(SwitchStatement)
1143 1149
1144 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { 1150 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
1145 tag_ = tag; 1151 tag_ = tag;
1146 cases_ = cases; 1152 cases_ = cases;
1147 switch_type_ = UNKNOWN_SWITCH; 1153 switch_type_ = UNKNOWN_SWITCH;
1148 } 1154 }
1149 1155
1150 Expression* tag() const { return tag_; } 1156 Expression* tag() const { return tag_; }
(...skipping 14 matching lines...) Expand all
1165 ZoneList<CaseClause*>* cases_; 1171 ZoneList<CaseClause*>* cases_;
1166 SwitchType switch_type_; 1172 SwitchType switch_type_;
1167 }; 1173 };
1168 1174
1169 1175
1170 // If-statements always have non-null references to their then- and 1176 // If-statements always have non-null references to their then- and
1171 // else-parts. When parsing if-statements with no explicit else-part, 1177 // else-parts. When parsing if-statements with no explicit else-part,
1172 // the parser implicitly creates an empty statement. Use the 1178 // the parser implicitly creates an empty statement. Use the
1173 // HasThenStatement() and HasElseStatement() functions to check if a 1179 // HasThenStatement() and HasElseStatement() functions to check if a
1174 // given if-statement has a then- or an else-part containing code. 1180 // given if-statement has a then- or an else-part containing code.
1175 class IfStatement: public Statement { 1181 class IfStatement V8_FINAL : public Statement {
1176 public: 1182 public:
1177 DECLARE_NODE_TYPE(IfStatement) 1183 DECLARE_NODE_TYPE(IfStatement)
1178 1184
1179 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } 1185 bool HasThenStatement() const { return !then_statement()->IsEmpty(); }
1180 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } 1186 bool HasElseStatement() const { return !else_statement()->IsEmpty(); }
1181 1187
1182 Expression* condition() const { return condition_; } 1188 Expression* condition() const { return condition_; }
1183 Statement* then_statement() const { return then_statement_; } 1189 Statement* then_statement() const { return then_statement_; }
1184 Statement* else_statement() const { return else_statement_; } 1190 Statement* else_statement() const { return else_statement_; }
1185 1191
1186 virtual bool IsJump() const { 1192 virtual bool IsJump() const V8_OVERRIDE {
1187 return HasThenStatement() && then_statement()->IsJump() 1193 return HasThenStatement() && then_statement()->IsJump()
1188 && HasElseStatement() && else_statement()->IsJump(); 1194 && HasElseStatement() && else_statement()->IsJump();
1189 } 1195 }
1190 1196
1191 BailoutId IfId() const { return if_id_; } 1197 BailoutId IfId() const { return if_id_; }
1192 BailoutId ThenId() const { return then_id_; } 1198 BailoutId ThenId() const { return then_id_; }
1193 BailoutId ElseId() const { return else_id_; } 1199 BailoutId ElseId() const { return else_id_; }
1194 1200
1195 protected: 1201 protected:
1196 IfStatement(Isolate* isolate, 1202 IfStatement(Isolate* isolate,
(...skipping 13 matching lines...) Expand all
1210 Statement* then_statement_; 1216 Statement* then_statement_;
1211 Statement* else_statement_; 1217 Statement* else_statement_;
1212 const BailoutId if_id_; 1218 const BailoutId if_id_;
1213 const BailoutId then_id_; 1219 const BailoutId then_id_;
1214 const BailoutId else_id_; 1220 const BailoutId else_id_;
1215 }; 1221 };
1216 1222
1217 1223
1218 // NOTE: TargetCollectors are represented as nodes to fit in the target 1224 // NOTE: TargetCollectors are represented as nodes to fit in the target
1219 // stack in the compiler; this should probably be reworked. 1225 // stack in the compiler; this should probably be reworked.
1220 class TargetCollector: public AstNode { 1226 class TargetCollector V8_FINAL : public AstNode {
1221 public: 1227 public:
1222 explicit TargetCollector(Zone* zone) : targets_(0, zone) { } 1228 explicit TargetCollector(Zone* zone) : targets_(0, zone) { }
1223 1229
1224 // Adds a jump target to the collector. The collector stores a pointer not 1230 // Adds a jump target to the collector. The collector stores a pointer not
1225 // a copy of the target to make binding work, so make sure not to pass in 1231 // a copy of the target to make binding work, so make sure not to pass in
1226 // references to something on the stack. 1232 // references to something on the stack.
1227 void AddTarget(Label* target, Zone* zone); 1233 void AddTarget(Label* target, Zone* zone);
1228 1234
1229 // Virtual behaviour. TargetCollectors are never part of the AST. 1235 // Virtual behaviour. TargetCollectors are never part of the AST.
1230 virtual void Accept(AstVisitor* v) { UNREACHABLE(); } 1236 virtual void Accept(AstVisitor* v) V8_OVERRIDE { UNREACHABLE(); }
1231 virtual NodeType node_type() const { return kInvalid; } 1237 virtual NodeType node_type() const V8_OVERRIDE { return kInvalid; }
1232 virtual TargetCollector* AsTargetCollector() { return this; } 1238 virtual TargetCollector* AsTargetCollector() V8_OVERRIDE { return this; }
1233 1239
1234 ZoneList<Label*>* targets() { return &targets_; } 1240 ZoneList<Label*>* targets() { return &targets_; }
1235 1241
1236 private: 1242 private:
1237 ZoneList<Label*> targets_; 1243 ZoneList<Label*> targets_;
1238 }; 1244 };
1239 1245
1240 1246
1241 class TryStatement: public Statement { 1247 class TryStatement : public Statement {
1242 public: 1248 public:
1243 void set_escaping_targets(ZoneList<Label*>* targets) { 1249 void set_escaping_targets(ZoneList<Label*>* targets) {
1244 escaping_targets_ = targets; 1250 escaping_targets_ = targets;
1245 } 1251 }
1246 1252
1247 int index() const { return index_; } 1253 int index() const { return index_; }
1248 Block* try_block() const { return try_block_; } 1254 Block* try_block() const { return try_block_; }
1249 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } 1255 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; }
1250 1256
1251 protected: 1257 protected:
1252 TryStatement(int index, Block* try_block) 1258 TryStatement(int index, Block* try_block)
1253 : index_(index), 1259 : index_(index),
1254 try_block_(try_block), 1260 try_block_(try_block),
1255 escaping_targets_(NULL) { } 1261 escaping_targets_(NULL) { }
1256 1262
1257 private: 1263 private:
1258 // Unique (per-function) index of this handler. This is not an AST ID. 1264 // Unique (per-function) index of this handler. This is not an AST ID.
1259 int index_; 1265 int index_;
1260 1266
1261 Block* try_block_; 1267 Block* try_block_;
1262 ZoneList<Label*>* escaping_targets_; 1268 ZoneList<Label*>* escaping_targets_;
1263 }; 1269 };
1264 1270
1265 1271
1266 class TryCatchStatement: public TryStatement { 1272 class TryCatchStatement V8_FINAL : public TryStatement {
1267 public: 1273 public:
1268 DECLARE_NODE_TYPE(TryCatchStatement) 1274 DECLARE_NODE_TYPE(TryCatchStatement)
1269 1275
1270 Scope* scope() { return scope_; } 1276 Scope* scope() { return scope_; }
1271 Variable* variable() { return variable_; } 1277 Variable* variable() { return variable_; }
1272 Block* catch_block() const { return catch_block_; } 1278 Block* catch_block() const { return catch_block_; }
1273 1279
1274 protected: 1280 protected:
1275 TryCatchStatement(int index, 1281 TryCatchStatement(int index,
1276 Block* try_block, 1282 Block* try_block,
1277 Scope* scope, 1283 Scope* scope,
1278 Variable* variable, 1284 Variable* variable,
1279 Block* catch_block) 1285 Block* catch_block)
1280 : TryStatement(index, try_block), 1286 : TryStatement(index, try_block),
1281 scope_(scope), 1287 scope_(scope),
1282 variable_(variable), 1288 variable_(variable),
1283 catch_block_(catch_block) { 1289 catch_block_(catch_block) {
1284 } 1290 }
1285 1291
1286 private: 1292 private:
1287 Scope* scope_; 1293 Scope* scope_;
1288 Variable* variable_; 1294 Variable* variable_;
1289 Block* catch_block_; 1295 Block* catch_block_;
1290 }; 1296 };
1291 1297
1292 1298
1293 class TryFinallyStatement: public TryStatement { 1299 class TryFinallyStatement V8_FINAL : public TryStatement {
1294 public: 1300 public:
1295 DECLARE_NODE_TYPE(TryFinallyStatement) 1301 DECLARE_NODE_TYPE(TryFinallyStatement)
1296 1302
1297 Block* finally_block() const { return finally_block_; } 1303 Block* finally_block() const { return finally_block_; }
1298 1304
1299 protected: 1305 protected:
1300 TryFinallyStatement(int index, Block* try_block, Block* finally_block) 1306 TryFinallyStatement(int index, Block* try_block, Block* finally_block)
1301 : TryStatement(index, try_block), 1307 : TryStatement(index, try_block),
1302 finally_block_(finally_block) { } 1308 finally_block_(finally_block) { }
1303 1309
1304 private: 1310 private:
1305 Block* finally_block_; 1311 Block* finally_block_;
1306 }; 1312 };
1307 1313
1308 1314
1309 class DebuggerStatement: public Statement { 1315 class DebuggerStatement V8_FINAL : public Statement {
1310 public: 1316 public:
1311 DECLARE_NODE_TYPE(DebuggerStatement) 1317 DECLARE_NODE_TYPE(DebuggerStatement)
1312 1318
1313 protected: 1319 protected:
1314 DebuggerStatement() {} 1320 DebuggerStatement() {}
1315 }; 1321 };
1316 1322
1317 1323
1318 class EmptyStatement: public Statement { 1324 class EmptyStatement V8_FINAL : public Statement {
1319 public: 1325 public:
1320 DECLARE_NODE_TYPE(EmptyStatement) 1326 DECLARE_NODE_TYPE(EmptyStatement)
1321 1327
1322 protected: 1328 protected:
1323 EmptyStatement() {} 1329 EmptyStatement() {}
1324 }; 1330 };
1325 1331
1326 1332
1327 class Literal: public Expression { 1333 class Literal V8_FINAL : public Expression {
1328 public: 1334 public:
1329 DECLARE_NODE_TYPE(Literal) 1335 DECLARE_NODE_TYPE(Literal)
1330 1336
1331 virtual bool IsPropertyName() { 1337 virtual bool IsPropertyName() V8_OVERRIDE {
1332 if (value_->IsInternalizedString()) { 1338 if (value_->IsInternalizedString()) {
1333 uint32_t ignored; 1339 uint32_t ignored;
1334 return !String::cast(*value_)->AsArrayIndex(&ignored); 1340 return !String::cast(*value_)->AsArrayIndex(&ignored);
1335 } 1341 }
1336 return false; 1342 return false;
1337 } 1343 }
1338 1344
1339 Handle<String> AsPropertyName() { 1345 Handle<String> AsPropertyName() {
1340 ASSERT(IsPropertyName()); 1346 ASSERT(IsPropertyName());
1341 return Handle<String>::cast(value_); 1347 return Handle<String>::cast(value_);
1342 } 1348 }
1343 1349
1344 virtual bool ToBooleanIsTrue() { return value_->BooleanValue(); } 1350 virtual bool ToBooleanIsTrue() V8_OVERRIDE {
1345 virtual bool ToBooleanIsFalse() { return !value_->BooleanValue(); } 1351 return value_->BooleanValue();
1352 }
1353 virtual bool ToBooleanIsFalse() V8_OVERRIDE {
1354 return !value_->BooleanValue();
1355 }
1346 1356
1347 // Identity testers. 1357 // Identity testers.
1348 bool IsNull() const { 1358 bool IsNull() const {
1349 ASSERT(!value_.is_null()); 1359 ASSERT(!value_.is_null());
1350 return value_->IsNull(); 1360 return value_->IsNull();
1351 } 1361 }
1352 bool IsTrue() const { 1362 bool IsTrue() const {
1353 ASSERT(!value_.is_null()); 1363 ASSERT(!value_.is_null());
1354 return value_->IsTrue(); 1364 return value_->IsTrue();
1355 } 1365 }
(...skipping 22 matching lines...) Expand all
1378 value_(value) { } 1388 value_(value) { }
1379 1389
1380 private: 1390 private:
1381 Handle<String> ToString(); 1391 Handle<String> ToString();
1382 1392
1383 Handle<Object> value_; 1393 Handle<Object> value_;
1384 }; 1394 };
1385 1395
1386 1396
1387 // Base class for literals that needs space in the corresponding JSFunction. 1397 // Base class for literals that needs space in the corresponding JSFunction.
1388 class MaterializedLiteral: public Expression { 1398 class MaterializedLiteral : public Expression {
1389 public: 1399 public:
1390 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } 1400 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; }
1391 1401
1392 int literal_index() { return literal_index_; } 1402 int literal_index() { return literal_index_; }
1393 1403
1394 // A materialized literal is simple if the values consist of only 1404 // A materialized literal is simple if the values consist of only
1395 // constants and simple object and array literals. 1405 // constants and simple object and array literals.
1396 bool is_simple() const { return is_simple_; } 1406 bool is_simple() const { return is_simple_; }
1397 1407
1398 int depth() const { return depth_; } 1408 int depth() const { return depth_; }
(...skipping 11 matching lines...) Expand all
1410 private: 1420 private:
1411 int literal_index_; 1421 int literal_index_;
1412 bool is_simple_; 1422 bool is_simple_;
1413 int depth_; 1423 int depth_;
1414 }; 1424 };
1415 1425
1416 1426
1417 // Property is used for passing information 1427 // Property is used for passing information
1418 // about an object literal's properties from the parser 1428 // about an object literal's properties from the parser
1419 // to the code generator. 1429 // to the code generator.
1420 class ObjectLiteralProperty: public ZoneObject { 1430 class ObjectLiteralProperty V8_FINAL : public ZoneObject {
1421 public: 1431 public:
1422 enum Kind { 1432 enum Kind {
1423 CONSTANT, // Property with constant value (compile time). 1433 CONSTANT, // Property with constant value (compile time).
1424 COMPUTED, // Property with computed value (execution time). 1434 COMPUTED, // Property with computed value (execution time).
1425 MATERIALIZED_LITERAL, // Property value is a materialized literal. 1435 MATERIALIZED_LITERAL, // Property value is a materialized literal.
1426 GETTER, SETTER, // Property is an accessor function. 1436 GETTER, SETTER, // Property is an accessor function.
1427 PROTOTYPE // Property is __proto__. 1437 PROTOTYPE // Property is __proto__.
1428 }; 1438 };
1429 1439
1430 ObjectLiteralProperty(Literal* key, Expression* value, Isolate* isolate); 1440 ObjectLiteralProperty(Literal* key, Expression* value, Isolate* isolate);
(...skipping 22 matching lines...) Expand all
1453 Literal* key_; 1463 Literal* key_;
1454 Expression* value_; 1464 Expression* value_;
1455 Kind kind_; 1465 Kind kind_;
1456 bool emit_store_; 1466 bool emit_store_;
1457 Handle<Map> receiver_type_; 1467 Handle<Map> receiver_type_;
1458 }; 1468 };
1459 1469
1460 1470
1461 // An object literal has a boilerplate object that is used 1471 // An object literal has a boilerplate object that is used
1462 // for minimizing the work when constructing it at runtime. 1472 // for minimizing the work when constructing it at runtime.
1463 class ObjectLiteral: public MaterializedLiteral { 1473 class ObjectLiteral V8_FINAL : public MaterializedLiteral {
1464 public: 1474 public:
1465 typedef ObjectLiteralProperty Property; 1475 typedef ObjectLiteralProperty Property;
1466 1476
1467 DECLARE_NODE_TYPE(ObjectLiteral) 1477 DECLARE_NODE_TYPE(ObjectLiteral)
1468 1478
1469 Handle<FixedArray> constant_properties() const { 1479 Handle<FixedArray> constant_properties() const {
1470 return constant_properties_; 1480 return constant_properties_;
1471 } 1481 }
1472 ZoneList<Property*>* properties() const { return properties_; } 1482 ZoneList<Property*>* properties() const { return properties_; }
1473 bool fast_elements() const { return fast_elements_; } 1483 bool fast_elements() const { return fast_elements_; }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 private: 1521 private:
1512 Handle<FixedArray> constant_properties_; 1522 Handle<FixedArray> constant_properties_;
1513 ZoneList<Property*>* properties_; 1523 ZoneList<Property*>* properties_;
1514 bool fast_elements_; 1524 bool fast_elements_;
1515 bool may_store_doubles_; 1525 bool may_store_doubles_;
1516 bool has_function_; 1526 bool has_function_;
1517 }; 1527 };
1518 1528
1519 1529
1520 // Node for capturing a regexp literal. 1530 // Node for capturing a regexp literal.
1521 class RegExpLiteral: public MaterializedLiteral { 1531 class RegExpLiteral V8_FINAL : public MaterializedLiteral {
1522 public: 1532 public:
1523 DECLARE_NODE_TYPE(RegExpLiteral) 1533 DECLARE_NODE_TYPE(RegExpLiteral)
1524 1534
1525 Handle<String> pattern() const { return pattern_; } 1535 Handle<String> pattern() const { return pattern_; }
1526 Handle<String> flags() const { return flags_; } 1536 Handle<String> flags() const { return flags_; }
1527 1537
1528 protected: 1538 protected:
1529 RegExpLiteral(Isolate* isolate, 1539 RegExpLiteral(Isolate* isolate,
1530 Handle<String> pattern, 1540 Handle<String> pattern,
1531 Handle<String> flags, 1541 Handle<String> flags,
1532 int literal_index) 1542 int literal_index)
1533 : MaterializedLiteral(isolate, literal_index, false, 1), 1543 : MaterializedLiteral(isolate, literal_index, false, 1),
1534 pattern_(pattern), 1544 pattern_(pattern),
1535 flags_(flags) {} 1545 flags_(flags) {}
1536 1546
1537 private: 1547 private:
1538 Handle<String> pattern_; 1548 Handle<String> pattern_;
1539 Handle<String> flags_; 1549 Handle<String> flags_;
1540 }; 1550 };
1541 1551
1542 // An array literal has a literals object that is used 1552 // An array literal has a literals object that is used
1543 // for minimizing the work when constructing it at runtime. 1553 // for minimizing the work when constructing it at runtime.
1544 class ArrayLiteral: public MaterializedLiteral { 1554 class ArrayLiteral V8_FINAL : public MaterializedLiteral {
1545 public: 1555 public:
1546 DECLARE_NODE_TYPE(ArrayLiteral) 1556 DECLARE_NODE_TYPE(ArrayLiteral)
1547 1557
1548 Handle<FixedArray> constant_elements() const { return constant_elements_; } 1558 Handle<FixedArray> constant_elements() const { return constant_elements_; }
1549 ZoneList<Expression*>* values() const { return values_; } 1559 ZoneList<Expression*>* values() const { return values_; }
1550 1560
1551 // Return an AST id for an element that is used in simulate instructions. 1561 // Return an AST id for an element that is used in simulate instructions.
1552 BailoutId GetIdForElement(int i) { 1562 BailoutId GetIdForElement(int i) {
1553 return BailoutId(first_element_id_.ToInt() + i); 1563 return BailoutId(first_element_id_.ToInt() + i);
1554 } 1564 }
(...skipping 10 matching lines...) Expand all
1565 values_(values), 1575 values_(values),
1566 first_element_id_(ReserveIdRange(isolate, values->length())) {} 1576 first_element_id_(ReserveIdRange(isolate, values->length())) {}
1567 1577
1568 private: 1578 private:
1569 Handle<FixedArray> constant_elements_; 1579 Handle<FixedArray> constant_elements_;
1570 ZoneList<Expression*>* values_; 1580 ZoneList<Expression*>* values_;
1571 const BailoutId first_element_id_; 1581 const BailoutId first_element_id_;
1572 }; 1582 };
1573 1583
1574 1584
1575 class VariableProxy: public Expression { 1585 class VariableProxy V8_FINAL : public Expression {
1576 public: 1586 public:
1577 DECLARE_NODE_TYPE(VariableProxy) 1587 DECLARE_NODE_TYPE(VariableProxy)
1578 1588
1579 virtual bool IsValidLeftHandSide() { 1589 virtual bool IsValidLeftHandSide() V8_OVERRIDE {
1580 return var_ == NULL ? true : var_->IsValidLeftHandSide(); 1590 return var_ == NULL ? true : var_->IsValidLeftHandSide();
1581 } 1591 }
1582 1592
1583 bool IsVariable(Handle<String> n) { 1593 bool IsVariable(Handle<String> n) {
1584 return !is_this() && name().is_identical_to(n); 1594 return !is_this() && name().is_identical_to(n);
1585 } 1595 }
1586 1596
1587 bool IsArguments() { return var_ != NULL && var_->is_arguments(); } 1597 bool IsArguments() { return var_ != NULL && var_->is_arguments(); }
1588 1598
1589 bool IsLValue() { 1599 bool IsLValue() {
(...skipping 27 matching lines...) Expand all
1617 bool is_this_; 1627 bool is_this_;
1618 bool is_trivial_; 1628 bool is_trivial_;
1619 // True if this variable proxy is being used in an assignment 1629 // True if this variable proxy is being used in an assignment
1620 // or with a increment/decrement operator. 1630 // or with a increment/decrement operator.
1621 bool is_lvalue_; 1631 bool is_lvalue_;
1622 int position_; 1632 int position_;
1623 Interface* interface_; 1633 Interface* interface_;
1624 }; 1634 };
1625 1635
1626 1636
1627 class Property: public Expression { 1637 class Property V8_FINAL : public Expression {
1628 public: 1638 public:
1629 DECLARE_NODE_TYPE(Property) 1639 DECLARE_NODE_TYPE(Property)
1630 1640
1631 virtual bool IsValidLeftHandSide() { return true; } 1641 virtual bool IsValidLeftHandSide() V8_OVERRIDE { return true; }
1632 1642
1633 Expression* obj() const { return obj_; } 1643 Expression* obj() const { return obj_; }
1634 Expression* key() const { return key_; } 1644 Expression* key() const { return key_; }
1635 virtual int position() const { return pos_; } 1645 virtual int position() const V8_OVERRIDE { return pos_; }
1636 1646
1637 BailoutId LoadId() const { return load_id_; } 1647 BailoutId LoadId() const { return load_id_; }
1638 1648
1639 bool IsStringLength() const { return is_string_length_; } 1649 bool IsStringLength() const { return is_string_length_; }
1640 bool IsStringAccess() const { return is_string_access_; } 1650 bool IsStringAccess() const { return is_string_access_; }
1641 bool IsFunctionPrototype() const { return is_function_prototype_; } 1651 bool IsFunctionPrototype() const { return is_function_prototype_; }
1642 1652
1643 // Type feedback information. 1653 // Type feedback information.
1644 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); 1654 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
1645 virtual bool IsMonomorphic() { return is_monomorphic_; } 1655 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
1646 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } 1656 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
1647 virtual KeyedAccessStoreMode GetStoreMode() { 1657 return &receiver_types_;
1658 }
1659 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
1648 return STANDARD_STORE; 1660 return STANDARD_STORE;
1649 } 1661 }
1650 bool IsUninitialized() { return is_uninitialized_; } 1662 bool IsUninitialized() { return is_uninitialized_; }
1651 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } 1663 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); }
1652 1664
1653 protected: 1665 protected:
1654 Property(Isolate* isolate, 1666 Property(Isolate* isolate,
1655 Expression* obj, 1667 Expression* obj,
1656 Expression* key, 1668 Expression* key,
1657 int pos) 1669 int pos)
(...skipping 16 matching lines...) Expand all
1674 1686
1675 SmallMapList receiver_types_; 1687 SmallMapList receiver_types_;
1676 bool is_monomorphic_ : 1; 1688 bool is_monomorphic_ : 1;
1677 bool is_uninitialized_ : 1; 1689 bool is_uninitialized_ : 1;
1678 bool is_string_length_ : 1; 1690 bool is_string_length_ : 1;
1679 bool is_string_access_ : 1; 1691 bool is_string_access_ : 1;
1680 bool is_function_prototype_ : 1; 1692 bool is_function_prototype_ : 1;
1681 }; 1693 };
1682 1694
1683 1695
1684 class Call: public Expression { 1696 class Call V8_FINAL : public Expression {
1685 public: 1697 public:
1686 DECLARE_NODE_TYPE(Call) 1698 DECLARE_NODE_TYPE(Call)
1687 1699
1688 Expression* expression() const { return expression_; } 1700 Expression* expression() const { return expression_; }
1689 ZoneList<Expression*>* arguments() const { return arguments_; } 1701 ZoneList<Expression*>* arguments() const { return arguments_; }
1690 virtual int position() const { return pos_; } 1702 virtual int position() const V8_FINAL { return pos_; }
1691 1703
1692 // Type feedback information. 1704 // Type feedback information.
1693 TypeFeedbackId CallFeedbackId() const { return reuse(id()); } 1705 TypeFeedbackId CallFeedbackId() const { return reuse(id()); }
1694 void RecordTypeFeedback(TypeFeedbackOracle* oracle, CallKind call_kind); 1706 void RecordTypeFeedback(TypeFeedbackOracle* oracle, CallKind call_kind);
1695 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } 1707 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
1696 virtual bool IsMonomorphic() { return is_monomorphic_; } 1708 return &receiver_types_;
1709 }
1710 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
1697 CheckType check_type() const { return check_type_; } 1711 CheckType check_type() const { return check_type_; }
1698 1712
1699 void set_string_check(Handle<JSObject> holder) { 1713 void set_string_check(Handle<JSObject> holder) {
1700 holder_ = holder; 1714 holder_ = holder;
1701 check_type_ = STRING_CHECK; 1715 check_type_ = STRING_CHECK;
1702 } 1716 }
1703 1717
1704 void set_number_check(Handle<JSObject> holder) { 1718 void set_number_check(Handle<JSObject> holder) {
1705 holder_ = holder; 1719 holder_ = holder;
1706 check_type_ = NUMBER_CHECK; 1720 check_type_ = NUMBER_CHECK;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 CheckType check_type_; 1771 CheckType check_type_;
1758 SmallMapList receiver_types_; 1772 SmallMapList receiver_types_;
1759 Handle<JSFunction> target_; 1773 Handle<JSFunction> target_;
1760 Handle<JSObject> holder_; 1774 Handle<JSObject> holder_;
1761 Handle<Cell> cell_; 1775 Handle<Cell> cell_;
1762 1776
1763 const BailoutId return_id_; 1777 const BailoutId return_id_;
1764 }; 1778 };
1765 1779
1766 1780
1767 class CallNew: public Expression { 1781 class CallNew V8_FINAL : public Expression {
1768 public: 1782 public:
1769 DECLARE_NODE_TYPE(CallNew) 1783 DECLARE_NODE_TYPE(CallNew)
1770 1784
1771 Expression* expression() const { return expression_; } 1785 Expression* expression() const { return expression_; }
1772 ZoneList<Expression*>* arguments() const { return arguments_; } 1786 ZoneList<Expression*>* arguments() const { return arguments_; }
1773 virtual int position() const { return pos_; } 1787 virtual int position() const V8_OVERRIDE { return pos_; }
1774 1788
1775 // Type feedback information. 1789 // Type feedback information.
1776 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } 1790 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); }
1777 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1791 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1778 virtual bool IsMonomorphic() { return is_monomorphic_; } 1792 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
1779 Handle<JSFunction> target() const { return target_; } 1793 Handle<JSFunction> target() const { return target_; }
1780 ElementsKind elements_kind() const { return elements_kind_; } 1794 ElementsKind elements_kind() const { return elements_kind_; }
1781 Handle<Cell> allocation_info_cell() const { 1795 Handle<Cell> allocation_info_cell() const {
1782 return allocation_info_cell_; 1796 return allocation_info_cell_;
1783 } 1797 }
1784 1798
1785 BailoutId ReturnId() const { return return_id_; } 1799 BailoutId ReturnId() const { return return_id_; }
1786 1800
1787 protected: 1801 protected:
1788 CallNew(Isolate* isolate, 1802 CallNew(Isolate* isolate,
(...skipping 19 matching lines...) Expand all
1808 Handle<Cell> allocation_info_cell_; 1822 Handle<Cell> allocation_info_cell_;
1809 1823
1810 const BailoutId return_id_; 1824 const BailoutId return_id_;
1811 }; 1825 };
1812 1826
1813 1827
1814 // The CallRuntime class does not represent any official JavaScript 1828 // The CallRuntime class does not represent any official JavaScript
1815 // language construct. Instead it is used to call a C or JS function 1829 // language construct. Instead it is used to call a C or JS function
1816 // with a set of arguments. This is used from the builtins that are 1830 // with a set of arguments. This is used from the builtins that are
1817 // implemented in JavaScript (see "v8natives.js"). 1831 // implemented in JavaScript (see "v8natives.js").
1818 class CallRuntime: public Expression { 1832 class CallRuntime V8_FINAL : public Expression {
1819 public: 1833 public:
1820 DECLARE_NODE_TYPE(CallRuntime) 1834 DECLARE_NODE_TYPE(CallRuntime)
1821 1835
1822 Handle<String> name() const { return name_; } 1836 Handle<String> name() const { return name_; }
1823 const Runtime::Function* function() const { return function_; } 1837 const Runtime::Function* function() const { return function_; }
1824 ZoneList<Expression*>* arguments() const { return arguments_; } 1838 ZoneList<Expression*>* arguments() const { return arguments_; }
1825 bool is_jsruntime() const { return function_ == NULL; } 1839 bool is_jsruntime() const { return function_ == NULL; }
1826 1840
1827 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } 1841 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); }
1828 1842
1829 protected: 1843 protected:
1830 CallRuntime(Isolate* isolate, 1844 CallRuntime(Isolate* isolate,
1831 Handle<String> name, 1845 Handle<String> name,
1832 const Runtime::Function* function, 1846 const Runtime::Function* function,
1833 ZoneList<Expression*>* arguments) 1847 ZoneList<Expression*>* arguments)
1834 : Expression(isolate), 1848 : Expression(isolate),
1835 name_(name), 1849 name_(name),
1836 function_(function), 1850 function_(function),
1837 arguments_(arguments) { } 1851 arguments_(arguments) { }
1838 1852
1839 private: 1853 private:
1840 Handle<String> name_; 1854 Handle<String> name_;
1841 const Runtime::Function* function_; 1855 const Runtime::Function* function_;
1842 ZoneList<Expression*>* arguments_; 1856 ZoneList<Expression*>* arguments_;
1843 }; 1857 };
1844 1858
1845 1859
1846 class UnaryOperation: public Expression { 1860 class UnaryOperation V8_FINAL : public Expression {
1847 public: 1861 public:
1848 DECLARE_NODE_TYPE(UnaryOperation) 1862 DECLARE_NODE_TYPE(UnaryOperation)
1849 1863
1850 Token::Value op() const { return op_; } 1864 Token::Value op() const { return op_; }
1851 Expression* expression() const { return expression_; } 1865 Expression* expression() const { return expression_; }
1852 virtual int position() const { return pos_; } 1866 virtual int position() const V8_OVERRIDE { return pos_; }
1853 1867
1854 BailoutId MaterializeTrueId() { return materialize_true_id_; } 1868 BailoutId MaterializeTrueId() { return materialize_true_id_; }
1855 BailoutId MaterializeFalseId() { return materialize_false_id_; } 1869 BailoutId MaterializeFalseId() { return materialize_false_id_; }
1856 1870
1857 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); 1871 virtual void RecordToBooleanTypeFeedback(
1872 TypeFeedbackOracle* oracle) V8_OVERRIDE;
1858 1873
1859 protected: 1874 protected:
1860 UnaryOperation(Isolate* isolate, 1875 UnaryOperation(Isolate* isolate,
1861 Token::Value op, 1876 Token::Value op,
1862 Expression* expression, 1877 Expression* expression,
1863 int pos) 1878 int pos)
1864 : Expression(isolate), 1879 : Expression(isolate),
1865 op_(op), 1880 op_(op),
1866 expression_(expression), 1881 expression_(expression),
1867 pos_(pos), 1882 pos_(pos),
1868 materialize_true_id_(GetNextId(isolate)), 1883 materialize_true_id_(GetNextId(isolate)),
1869 materialize_false_id_(GetNextId(isolate)) { 1884 materialize_false_id_(GetNextId(isolate)) {
1870 ASSERT(Token::IsUnaryOp(op)); 1885 ASSERT(Token::IsUnaryOp(op));
1871 } 1886 }
1872 1887
1873 private: 1888 private:
1874 Token::Value op_; 1889 Token::Value op_;
1875 Expression* expression_; 1890 Expression* expression_;
1876 int pos_; 1891 int pos_;
1877 1892
1878 // For unary not (Token::NOT), the AST ids where true and false will 1893 // For unary not (Token::NOT), the AST ids where true and false will
1879 // actually be materialized, respectively. 1894 // actually be materialized, respectively.
1880 const BailoutId materialize_true_id_; 1895 const BailoutId materialize_true_id_;
1881 const BailoutId materialize_false_id_; 1896 const BailoutId materialize_false_id_;
1882 }; 1897 };
1883 1898
1884 1899
1885 class BinaryOperation: public Expression { 1900 class BinaryOperation V8_FINAL : public Expression {
1886 public: 1901 public:
1887 DECLARE_NODE_TYPE(BinaryOperation) 1902 DECLARE_NODE_TYPE(BinaryOperation)
1888 1903
1889 virtual bool ResultOverwriteAllowed(); 1904 virtual bool ResultOverwriteAllowed();
1890 1905
1891 Token::Value op() const { return op_; } 1906 Token::Value op() const { return op_; }
1892 Expression* left() const { return left_; } 1907 Expression* left() const { return left_; }
1893 Expression* right() const { return right_; } 1908 Expression* right() const { return right_; }
1894 virtual int position() const { return pos_; } 1909 virtual int position() const V8_OVERRIDE { return pos_; }
1895 1910
1896 BailoutId RightId() const { return right_id_; } 1911 BailoutId RightId() const { return right_id_; }
1897 1912
1898 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } 1913 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); }
1899 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } 1914 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
1900 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } 1915 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; }
1901 1916
1902 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); 1917 virtual void RecordToBooleanTypeFeedback(
1918 TypeFeedbackOracle* oracle) V8_OVERRIDE;
1903 1919
1904 protected: 1920 protected:
1905 BinaryOperation(Isolate* isolate, 1921 BinaryOperation(Isolate* isolate,
1906 Token::Value op, 1922 Token::Value op,
1907 Expression* left, 1923 Expression* left,
1908 Expression* right, 1924 Expression* right,
1909 int pos) 1925 int pos)
1910 : Expression(isolate), 1926 : Expression(isolate),
1911 op_(op), 1927 op_(op),
1912 left_(left), 1928 left_(left),
(...skipping 12 matching lines...) Expand all
1925 // TODO(rossberg): the fixed arg should probably be represented as a Constant 1941 // TODO(rossberg): the fixed arg should probably be represented as a Constant
1926 // type for the RHS. 1942 // type for the RHS.
1927 Maybe<int> fixed_right_arg_; 1943 Maybe<int> fixed_right_arg_;
1928 1944
1929 // The short-circuit logical operations need an AST ID for their 1945 // The short-circuit logical operations need an AST ID for their
1930 // right-hand subexpression. 1946 // right-hand subexpression.
1931 const BailoutId right_id_; 1947 const BailoutId right_id_;
1932 }; 1948 };
1933 1949
1934 1950
1935 class CountOperation: public Expression { 1951 class CountOperation V8_FINAL : public Expression {
1936 public: 1952 public:
1937 DECLARE_NODE_TYPE(CountOperation) 1953 DECLARE_NODE_TYPE(CountOperation)
1938 1954
1939 bool is_prefix() const { return is_prefix_; } 1955 bool is_prefix() const { return is_prefix_; }
1940 bool is_postfix() const { return !is_prefix_; } 1956 bool is_postfix() const { return !is_prefix_; }
1941 1957
1942 Token::Value op() const { return op_; } 1958 Token::Value op() const { return op_; }
1943 Token::Value binary_op() { 1959 Token::Value binary_op() {
1944 return (op() == Token::INC) ? Token::ADD : Token::SUB; 1960 return (op() == Token::INC) ? Token::ADD : Token::SUB;
1945 } 1961 }
1946 1962
1947 Expression* expression() const { return expression_; } 1963 Expression* expression() const { return expression_; }
1948 virtual int position() const { return pos_; } 1964 virtual int position() const V8_OVERRIDE { return pos_; }
1949
1950 virtual void MarkAsStatement() { is_prefix_ = true; }
1951 1965
1952 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe); 1966 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe);
1953 virtual bool IsMonomorphic() { return is_monomorphic_; } 1967 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
1954 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } 1968 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
1955 virtual KeyedAccessStoreMode GetStoreMode() { 1969 return &receiver_types_;
1970 }
1971 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
1956 return store_mode_; 1972 return store_mode_;
1957 } 1973 }
1958 TypeInfo type() const { return type_; } 1974 TypeInfo type() const { return type_; }
1959 1975
1960 BailoutId AssignmentId() const { return assignment_id_; } 1976 BailoutId AssignmentId() const { return assignment_id_; }
1961 1977
1962 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } 1978 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; }
1963 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } 1979 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); }
1964 1980
1965 protected: 1981 protected:
(...skipping 21 matching lines...) Expand all
1987 TypeInfo type_; 2003 TypeInfo type_;
1988 2004
1989 Expression* expression_; 2005 Expression* expression_;
1990 int pos_; 2006 int pos_;
1991 const BailoutId assignment_id_; 2007 const BailoutId assignment_id_;
1992 const TypeFeedbackId count_id_; 2008 const TypeFeedbackId count_id_;
1993 SmallMapList receiver_types_; 2009 SmallMapList receiver_types_;
1994 }; 2010 };
1995 2011
1996 2012
1997 class CompareOperation: public Expression { 2013 class CompareOperation V8_FINAL : public Expression {
1998 public: 2014 public:
1999 DECLARE_NODE_TYPE(CompareOperation) 2015 DECLARE_NODE_TYPE(CompareOperation)
2000 2016
2001 Token::Value op() const { return op_; } 2017 Token::Value op() const { return op_; }
2002 Expression* left() const { return left_; } 2018 Expression* left() const { return left_; }
2003 Expression* right() const { return right_; } 2019 Expression* right() const { return right_; }
2004 virtual int position() const { return pos_; } 2020 virtual int position() const V8_OVERRIDE { return pos_; }
2005 2021
2006 // Type feedback information. 2022 // Type feedback information.
2007 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } 2023 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); }
2008 Handle<Type> combined_type() const { return combined_type_; } 2024 Handle<Type> combined_type() const { return combined_type_; }
2009 void set_combined_type(Handle<Type> type) { combined_type_ = type; } 2025 void set_combined_type(Handle<Type> type) { combined_type_ = type; }
2010 2026
2011 // Match special cases. 2027 // Match special cases.
2012 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); 2028 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check);
2013 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate); 2029 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate);
2014 bool IsLiteralCompareNull(Expression** expr); 2030 bool IsLiteralCompareNull(Expression** expr);
(...skipping 15 matching lines...) Expand all
2030 private: 2046 private:
2031 Token::Value op_; 2047 Token::Value op_;
2032 Expression* left_; 2048 Expression* left_;
2033 Expression* right_; 2049 Expression* right_;
2034 int pos_; 2050 int pos_;
2035 2051
2036 Handle<Type> combined_type_; 2052 Handle<Type> combined_type_;
2037 }; 2053 };
2038 2054
2039 2055
2040 class Conditional: public Expression { 2056 class Conditional V8_FINAL : public Expression {
2041 public: 2057 public:
2042 DECLARE_NODE_TYPE(Conditional) 2058 DECLARE_NODE_TYPE(Conditional)
2043 2059
2044 Expression* condition() const { return condition_; } 2060 Expression* condition() const { return condition_; }
2045 Expression* then_expression() const { return then_expression_; } 2061 Expression* then_expression() const { return then_expression_; }
2046 Expression* else_expression() const { return else_expression_; } 2062 Expression* else_expression() const { return else_expression_; }
2047 2063
2048 int then_expression_position() const { return then_expression_position_; } 2064 int then_expression_position() const { return then_expression_position_; }
2049 int else_expression_position() const { return else_expression_position_; } 2065 int else_expression_position() const { return else_expression_position_; }
2050 2066
(...skipping 20 matching lines...) Expand all
2071 Expression* condition_; 2087 Expression* condition_;
2072 Expression* then_expression_; 2088 Expression* then_expression_;
2073 Expression* else_expression_; 2089 Expression* else_expression_;
2074 int then_expression_position_; 2090 int then_expression_position_;
2075 int else_expression_position_; 2091 int else_expression_position_;
2076 const BailoutId then_id_; 2092 const BailoutId then_id_;
2077 const BailoutId else_id_; 2093 const BailoutId else_id_;
2078 }; 2094 };
2079 2095
2080 2096
2081 class Assignment: public Expression { 2097 class Assignment V8_FINAL : public Expression {
2082 public: 2098 public:
2083 DECLARE_NODE_TYPE(Assignment) 2099 DECLARE_NODE_TYPE(Assignment)
2084 2100
2085 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } 2101 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; }
2086 2102
2087 Token::Value binary_op() const; 2103 Token::Value binary_op() const;
2088 2104
2089 Token::Value op() const { return op_; } 2105 Token::Value op() const { return op_; }
2090 Expression* target() const { return target_; } 2106 Expression* target() const { return target_; }
2091 Expression* value() const { return value_; } 2107 Expression* value() const { return value_; }
2092 virtual int position() const { return pos_; } 2108 virtual int position() const V8_OVERRIDE { return pos_; }
2093 BinaryOperation* binary_operation() const { return binary_operation_; } 2109 BinaryOperation* binary_operation() const { return binary_operation_; }
2094 2110
2095 // This check relies on the definition order of token in token.h. 2111 // This check relies on the definition order of token in token.h.
2096 bool is_compound() const { return op() > Token::ASSIGN; } 2112 bool is_compound() const { return op() > Token::ASSIGN; }
2097 2113
2098 BailoutId AssignmentId() const { return assignment_id_; } 2114 BailoutId AssignmentId() const { return assignment_id_; }
2099 2115
2100 // Type feedback information. 2116 // Type feedback information.
2101 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } 2117 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); }
2102 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); 2118 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
2103 virtual bool IsMonomorphic() { return is_monomorphic_; } 2119 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
2104 bool IsUninitialized() { return is_uninitialized_; } 2120 bool IsUninitialized() { return is_uninitialized_; }
2105 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } 2121 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
2106 virtual KeyedAccessStoreMode GetStoreMode() { 2122 return &receiver_types_;
2123 }
2124 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
2107 return store_mode_; 2125 return store_mode_;
2108 } 2126 }
2109 2127
2110 protected: 2128 protected:
2111 Assignment(Isolate* isolate, 2129 Assignment(Isolate* isolate,
2112 Token::Value op, 2130 Token::Value op,
2113 Expression* target, 2131 Expression* target,
2114 Expression* value, 2132 Expression* value,
2115 int pos); 2133 int pos);
2116 2134
(...skipping 15 matching lines...) Expand all
2132 const BailoutId assignment_id_; 2150 const BailoutId assignment_id_;
2133 2151
2134 bool is_monomorphic_ : 1; 2152 bool is_monomorphic_ : 1;
2135 bool is_uninitialized_ : 1; 2153 bool is_uninitialized_ : 1;
2136 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, 2154 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
2137 // must have extra bit. 2155 // must have extra bit.
2138 SmallMapList receiver_types_; 2156 SmallMapList receiver_types_;
2139 }; 2157 };
2140 2158
2141 2159
2142 class Yield: public Expression { 2160 class Yield V8_FINAL : public Expression {
2143 public: 2161 public:
2144 DECLARE_NODE_TYPE(Yield) 2162 DECLARE_NODE_TYPE(Yield)
2145 2163
2146 enum Kind { 2164 enum Kind {
2147 INITIAL, // The initial yield that returns the unboxed generator object. 2165 INITIAL, // The initial yield that returns the unboxed generator object.
2148 SUSPEND, // A normal yield: { value: EXPRESSION, done: false } 2166 SUSPEND, // A normal yield: { value: EXPRESSION, done: false }
2149 DELEGATING, // A yield*. 2167 DELEGATING, // A yield*.
2150 FINAL // A return: { value: EXPRESSION, done: true } 2168 FINAL // A return: { value: EXPRESSION, done: true }
2151 }; 2169 };
2152 2170
2153 Expression* generator_object() const { return generator_object_; } 2171 Expression* generator_object() const { return generator_object_; }
2154 Expression* expression() const { return expression_; } 2172 Expression* expression() const { return expression_; }
2155 Kind yield_kind() const { return yield_kind_; } 2173 Kind yield_kind() const { return yield_kind_; }
2156 virtual int position() const { return pos_; } 2174 virtual int position() const V8_OVERRIDE { return pos_; }
2157 2175
2158 // Delegating yield surrounds the "yield" in a "try/catch". This index 2176 // Delegating yield surrounds the "yield" in a "try/catch". This index
2159 // locates the catch handler in the handler table, and is equivalent to 2177 // locates the catch handler in the handler table, and is equivalent to
2160 // TryCatchStatement::index(). 2178 // TryCatchStatement::index().
2161 int index() const { 2179 int index() const {
2162 ASSERT(yield_kind() == DELEGATING); 2180 ASSERT(yield_kind() == DELEGATING);
2163 return index_; 2181 return index_;
2164 } 2182 }
2165 void set_index(int index) { 2183 void set_index(int index) {
2166 ASSERT(yield_kind() == DELEGATING); 2184 ASSERT(yield_kind() == DELEGATING);
(...skipping 15 matching lines...) Expand all
2182 2200
2183 private: 2201 private:
2184 Expression* generator_object_; 2202 Expression* generator_object_;
2185 Expression* expression_; 2203 Expression* expression_;
2186 Kind yield_kind_; 2204 Kind yield_kind_;
2187 int index_; 2205 int index_;
2188 int pos_; 2206 int pos_;
2189 }; 2207 };
2190 2208
2191 2209
2192 class Throw: public Expression { 2210 class Throw V8_FINAL : public Expression {
2193 public: 2211 public:
2194 DECLARE_NODE_TYPE(Throw) 2212 DECLARE_NODE_TYPE(Throw)
2195 2213
2196 Expression* exception() const { return exception_; } 2214 Expression* exception() const { return exception_; }
2197 virtual int position() const { return pos_; } 2215 virtual int position() const V8_OVERRIDE { return pos_; }
2198 2216
2199 protected: 2217 protected:
2200 Throw(Isolate* isolate, Expression* exception, int pos) 2218 Throw(Isolate* isolate, Expression* exception, int pos)
2201 : Expression(isolate), exception_(exception), pos_(pos) {} 2219 : Expression(isolate), exception_(exception), pos_(pos) {}
2202 2220
2203 private: 2221 private:
2204 Expression* exception_; 2222 Expression* exception_;
2205 int pos_; 2223 int pos_;
2206 }; 2224 };
2207 2225
2208 2226
2209 class FunctionLiteral: public Expression { 2227 class FunctionLiteral V8_FINAL : public Expression {
2210 public: 2228 public:
2211 enum FunctionType { 2229 enum FunctionType {
2212 ANONYMOUS_EXPRESSION, 2230 ANONYMOUS_EXPRESSION,
2213 NAMED_EXPRESSION, 2231 NAMED_EXPRESSION,
2214 DECLARATION 2232 DECLARATION
2215 }; 2233 };
2216 2234
2217 enum ParameterFlag { 2235 enum ParameterFlag {
2218 kNoDuplicateParameters = 0, 2236 kNoDuplicateParameters = 0,
2219 kHasDuplicateParameters = 1 2237 kHasDuplicateParameters = 1
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 class IsExpression: public BitField<bool, 0, 1> {}; 2367 class IsExpression: public BitField<bool, 0, 1> {};
2350 class IsAnonymous: public BitField<bool, 1, 1> {}; 2368 class IsAnonymous: public BitField<bool, 1, 1> {};
2351 class Pretenure: public BitField<bool, 2, 1> {}; 2369 class Pretenure: public BitField<bool, 2, 1> {};
2352 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; 2370 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {};
2353 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; 2371 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {};
2354 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; 2372 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {};
2355 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; 2373 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {};
2356 }; 2374 };
2357 2375
2358 2376
2359 class SharedFunctionInfoLiteral: public Expression { 2377 class SharedFunctionInfoLiteral V8_FINAL : public Expression {
2360 public: 2378 public:
2361 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) 2379 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral)
2362 2380
2363 Handle<SharedFunctionInfo> shared_function_info() const { 2381 Handle<SharedFunctionInfo> shared_function_info() const {
2364 return shared_function_info_; 2382 return shared_function_info_;
2365 } 2383 }
2366 2384
2367 protected: 2385 protected:
2368 SharedFunctionInfoLiteral( 2386 SharedFunctionInfoLiteral(
2369 Isolate* isolate, 2387 Isolate* isolate,
2370 Handle<SharedFunctionInfo> shared_function_info) 2388 Handle<SharedFunctionInfo> shared_function_info)
2371 : Expression(isolate), 2389 : Expression(isolate),
2372 shared_function_info_(shared_function_info) { } 2390 shared_function_info_(shared_function_info) { }
2373 2391
2374 private: 2392 private:
2375 Handle<SharedFunctionInfo> shared_function_info_; 2393 Handle<SharedFunctionInfo> shared_function_info_;
2376 }; 2394 };
2377 2395
2378 2396
2379 class ThisFunction: public Expression { 2397 class ThisFunction V8_FINAL : public Expression {
2380 public: 2398 public:
2381 DECLARE_NODE_TYPE(ThisFunction) 2399 DECLARE_NODE_TYPE(ThisFunction)
2382 2400
2383 protected: 2401 protected:
2384 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} 2402 explicit ThisFunction(Isolate* isolate): Expression(isolate) {}
2385 }; 2403 };
2386 2404
2387 #undef DECLARE_NODE_TYPE 2405 #undef DECLARE_NODE_TYPE
2388 2406
2389 2407
2390 // ---------------------------------------------------------------------------- 2408 // ----------------------------------------------------------------------------
2391 // Regular expressions 2409 // Regular expressions
2392 2410
2393 2411
2394 class RegExpVisitor BASE_EMBEDDED { 2412 class RegExpVisitor BASE_EMBEDDED {
2395 public: 2413 public:
2396 virtual ~RegExpVisitor() { } 2414 virtual ~RegExpVisitor() { }
2397 #define MAKE_CASE(Name) \ 2415 #define MAKE_CASE(Name) \
2398 virtual void* Visit##Name(RegExp##Name*, void* data) = 0; 2416 virtual void* Visit##Name(RegExp##Name*, void* data) = 0;
2399 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) 2417 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE)
2400 #undef MAKE_CASE 2418 #undef MAKE_CASE
2401 }; 2419 };
2402 2420
2403 2421
2404 class RegExpTree: public ZoneObject { 2422 class RegExpTree : public ZoneObject {
2405 public: 2423 public:
2406 static const int kInfinity = kMaxInt; 2424 static const int kInfinity = kMaxInt;
2407 virtual ~RegExpTree() { } 2425 virtual ~RegExpTree() {}
2408 virtual void* Accept(RegExpVisitor* visitor, void* data) = 0; 2426 virtual void* Accept(RegExpVisitor* visitor, void* data) = 0;
2409 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2427 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2410 RegExpNode* on_success) = 0; 2428 RegExpNode* on_success) = 0;
2411 virtual bool IsTextElement() { return false; } 2429 virtual bool IsTextElement() { return false; }
2412 virtual bool IsAnchoredAtStart() { return false; } 2430 virtual bool IsAnchoredAtStart() { return false; }
2413 virtual bool IsAnchoredAtEnd() { return false; } 2431 virtual bool IsAnchoredAtEnd() { return false; }
2414 virtual int min_match() = 0; 2432 virtual int min_match() = 0;
2415 virtual int max_match() = 0; 2433 virtual int max_match() = 0;
2416 // Returns the interval of registers used for captures within this 2434 // Returns the interval of registers used for captures within this
2417 // expression. 2435 // expression.
2418 virtual Interval CaptureRegisters() { return Interval::Empty(); } 2436 virtual Interval CaptureRegisters() { return Interval::Empty(); }
2419 virtual void AppendToText(RegExpText* text, Zone* zone); 2437 virtual void AppendToText(RegExpText* text, Zone* zone);
2420 SmartArrayPointer<const char> ToString(Zone* zone); 2438 SmartArrayPointer<const char> ToString(Zone* zone);
2421 #define MAKE_ASTYPE(Name) \ 2439 #define MAKE_ASTYPE(Name) \
2422 virtual RegExp##Name* As##Name(); \ 2440 virtual RegExp##Name* As##Name(); \
2423 virtual bool Is##Name(); 2441 virtual bool Is##Name();
2424 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) 2442 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE)
2425 #undef MAKE_ASTYPE 2443 #undef MAKE_ASTYPE
2426 }; 2444 };
2427 2445
2428 2446
2429 class RegExpDisjunction: public RegExpTree { 2447 class RegExpDisjunction V8_FINAL : public RegExpTree {
2430 public: 2448 public:
2431 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives); 2449 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives);
2432 virtual void* Accept(RegExpVisitor* visitor, void* data); 2450 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2433 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2451 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2434 RegExpNode* on_success); 2452 RegExpNode* on_success) V8_OVERRIDE;
2435 virtual RegExpDisjunction* AsDisjunction(); 2453 virtual RegExpDisjunction* AsDisjunction() V8_OVERRIDE;
2436 virtual Interval CaptureRegisters(); 2454 virtual Interval CaptureRegisters() V8_OVERRIDE;
2437 virtual bool IsDisjunction(); 2455 virtual bool IsDisjunction() V8_OVERRIDE;
2438 virtual bool IsAnchoredAtStart(); 2456 virtual bool IsAnchoredAtStart() V8_OVERRIDE;
2439 virtual bool IsAnchoredAtEnd(); 2457 virtual bool IsAnchoredAtEnd() V8_OVERRIDE;
2440 virtual int min_match() { return min_match_; } 2458 virtual int min_match() V8_OVERRIDE { return min_match_; }
2441 virtual int max_match() { return max_match_; } 2459 virtual int max_match() V8_OVERRIDE { return max_match_; }
2442 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } 2460 ZoneList<RegExpTree*>* alternatives() { return alternatives_; }
2443 private: 2461 private:
2444 ZoneList<RegExpTree*>* alternatives_; 2462 ZoneList<RegExpTree*>* alternatives_;
2445 int min_match_; 2463 int min_match_;
2446 int max_match_; 2464 int max_match_;
2447 }; 2465 };
2448 2466
2449 2467
2450 class RegExpAlternative: public RegExpTree { 2468 class RegExpAlternative V8_FINAL : public RegExpTree {
2451 public: 2469 public:
2452 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes); 2470 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes);
2453 virtual void* Accept(RegExpVisitor* visitor, void* data); 2471 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2454 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2472 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2455 RegExpNode* on_success); 2473 RegExpNode* on_success) V8_OVERRIDE;
2456 virtual RegExpAlternative* AsAlternative(); 2474 virtual RegExpAlternative* AsAlternative() V8_OVERRIDE;
2457 virtual Interval CaptureRegisters(); 2475 virtual Interval CaptureRegisters() V8_OVERRIDE;
2458 virtual bool IsAlternative(); 2476 virtual bool IsAlternative() V8_OVERRIDE;
2459 virtual bool IsAnchoredAtStart(); 2477 virtual bool IsAnchoredAtStart() V8_OVERRIDE;
2460 virtual bool IsAnchoredAtEnd(); 2478 virtual bool IsAnchoredAtEnd() V8_OVERRIDE;
2461 virtual int min_match() { return min_match_; } 2479 virtual int min_match() V8_OVERRIDE { return min_match_; }
2462 virtual int max_match() { return max_match_; } 2480 virtual int max_match() V8_OVERRIDE { return max_match_; }
2463 ZoneList<RegExpTree*>* nodes() { return nodes_; } 2481 ZoneList<RegExpTree*>* nodes() { return nodes_; }
2464 private: 2482 private:
2465 ZoneList<RegExpTree*>* nodes_; 2483 ZoneList<RegExpTree*>* nodes_;
2466 int min_match_; 2484 int min_match_;
2467 int max_match_; 2485 int max_match_;
2468 }; 2486 };
2469 2487
2470 2488
2471 class RegExpAssertion: public RegExpTree { 2489 class RegExpAssertion V8_FINAL : public RegExpTree {
2472 public: 2490 public:
2473 enum AssertionType { 2491 enum AssertionType {
2474 START_OF_LINE, 2492 START_OF_LINE,
2475 START_OF_INPUT, 2493 START_OF_INPUT,
2476 END_OF_LINE, 2494 END_OF_LINE,
2477 END_OF_INPUT, 2495 END_OF_INPUT,
2478 BOUNDARY, 2496 BOUNDARY,
2479 NON_BOUNDARY 2497 NON_BOUNDARY
2480 }; 2498 };
2481 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { } 2499 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { }
2482 virtual void* Accept(RegExpVisitor* visitor, void* data); 2500 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2483 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2501 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2484 RegExpNode* on_success); 2502 RegExpNode* on_success) V8_OVERRIDE;
2485 virtual RegExpAssertion* AsAssertion(); 2503 virtual RegExpAssertion* AsAssertion() V8_OVERRIDE;
2486 virtual bool IsAssertion(); 2504 virtual bool IsAssertion() V8_OVERRIDE;
2487 virtual bool IsAnchoredAtStart(); 2505 virtual bool IsAnchoredAtStart() V8_OVERRIDE;
2488 virtual bool IsAnchoredAtEnd(); 2506 virtual bool IsAnchoredAtEnd() V8_OVERRIDE;
2489 virtual int min_match() { return 0; } 2507 virtual int min_match() V8_OVERRIDE { return 0; }
2490 virtual int max_match() { return 0; } 2508 virtual int max_match() V8_OVERRIDE { return 0; }
2491 AssertionType assertion_type() { return assertion_type_; } 2509 AssertionType assertion_type() { return assertion_type_; }
2492 private: 2510 private:
2493 AssertionType assertion_type_; 2511 AssertionType assertion_type_;
2494 }; 2512 };
2495 2513
2496 2514
2497 class CharacterSet BASE_EMBEDDED { 2515 class CharacterSet V8_FINAL BASE_EMBEDDED {
2498 public: 2516 public:
2499 explicit CharacterSet(uc16 standard_set_type) 2517 explicit CharacterSet(uc16 standard_set_type)
2500 : ranges_(NULL), 2518 : ranges_(NULL),
2501 standard_set_type_(standard_set_type) {} 2519 standard_set_type_(standard_set_type) {}
2502 explicit CharacterSet(ZoneList<CharacterRange>* ranges) 2520 explicit CharacterSet(ZoneList<CharacterRange>* ranges)
2503 : ranges_(ranges), 2521 : ranges_(ranges),
2504 standard_set_type_(0) {} 2522 standard_set_type_(0) {}
2505 ZoneList<CharacterRange>* ranges(Zone* zone); 2523 ZoneList<CharacterRange>* ranges(Zone* zone);
2506 uc16 standard_set_type() { return standard_set_type_; } 2524 uc16 standard_set_type() { return standard_set_type_; }
2507 void set_standard_set_type(uc16 special_set_type) { 2525 void set_standard_set_type(uc16 special_set_type) {
2508 standard_set_type_ = special_set_type; 2526 standard_set_type_ = special_set_type;
2509 } 2527 }
2510 bool is_standard() { return standard_set_type_ != 0; } 2528 bool is_standard() { return standard_set_type_ != 0; }
2511 void Canonicalize(); 2529 void Canonicalize();
2512 private: 2530 private:
2513 ZoneList<CharacterRange>* ranges_; 2531 ZoneList<CharacterRange>* ranges_;
2514 // If non-zero, the value represents a standard set (e.g., all whitespace 2532 // If non-zero, the value represents a standard set (e.g., all whitespace
2515 // characters) without having to expand the ranges. 2533 // characters) without having to expand the ranges.
2516 uc16 standard_set_type_; 2534 uc16 standard_set_type_;
2517 }; 2535 };
2518 2536
2519 2537
2520 class RegExpCharacterClass: public RegExpTree { 2538 class RegExpCharacterClass V8_FINAL : public RegExpTree {
2521 public: 2539 public:
2522 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) 2540 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated)
2523 : set_(ranges), 2541 : set_(ranges),
2524 is_negated_(is_negated) { } 2542 is_negated_(is_negated) { }
2525 explicit RegExpCharacterClass(uc16 type) 2543 explicit RegExpCharacterClass(uc16 type)
2526 : set_(type), 2544 : set_(type),
2527 is_negated_(false) { } 2545 is_negated_(false) { }
2528 virtual void* Accept(RegExpVisitor* visitor, void* data); 2546 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2529 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2547 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2530 RegExpNode* on_success); 2548 RegExpNode* on_success) V8_OVERRIDE;
2531 virtual RegExpCharacterClass* AsCharacterClass(); 2549 virtual RegExpCharacterClass* AsCharacterClass() V8_OVERRIDE;
2532 virtual bool IsCharacterClass(); 2550 virtual bool IsCharacterClass() V8_OVERRIDE;
2533 virtual bool IsTextElement() { return true; } 2551 virtual bool IsTextElement() V8_OVERRIDE { return true; }
2534 virtual int min_match() { return 1; } 2552 virtual int min_match() V8_OVERRIDE { return 1; }
2535 virtual int max_match() { return 1; } 2553 virtual int max_match() V8_OVERRIDE { return 1; }
2536 virtual void AppendToText(RegExpText* text, Zone* zone); 2554 virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE;
2537 CharacterSet character_set() { return set_; } 2555 CharacterSet character_set() { return set_; }
2538 // TODO(lrn): Remove need for complex version if is_standard that 2556 // TODO(lrn): Remove need for complex version if is_standard that
2539 // recognizes a mangled standard set and just do { return set_.is_special(); } 2557 // recognizes a mangled standard set and just do { return set_.is_special(); }
2540 bool is_standard(Zone* zone); 2558 bool is_standard(Zone* zone);
2541 // Returns a value representing the standard character set if is_standard() 2559 // Returns a value representing the standard character set if is_standard()
2542 // returns true. 2560 // returns true.
2543 // Currently used values are: 2561 // Currently used values are:
2544 // s : unicode whitespace 2562 // s : unicode whitespace
2545 // S : unicode non-whitespace 2563 // S : unicode non-whitespace
2546 // w : ASCII word character (digit, letter, underscore) 2564 // w : ASCII word character (digit, letter, underscore)
2547 // W : non-ASCII word character 2565 // W : non-ASCII word character
2548 // d : ASCII digit 2566 // d : ASCII digit
2549 // D : non-ASCII digit 2567 // D : non-ASCII digit
2550 // . : non-unicode non-newline 2568 // . : non-unicode non-newline
2551 // * : All characters 2569 // * : All characters
2552 uc16 standard_type() { return set_.standard_set_type(); } 2570 uc16 standard_type() { return set_.standard_set_type(); }
2553 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); } 2571 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); }
2554 bool is_negated() { return is_negated_; } 2572 bool is_negated() { return is_negated_; }
2555 2573
2556 private: 2574 private:
2557 CharacterSet set_; 2575 CharacterSet set_;
2558 bool is_negated_; 2576 bool is_negated_;
2559 }; 2577 };
2560 2578
2561 2579
2562 class RegExpAtom: public RegExpTree { 2580 class RegExpAtom V8_FINAL : public RegExpTree {
2563 public: 2581 public:
2564 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } 2582 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { }
2565 virtual void* Accept(RegExpVisitor* visitor, void* data); 2583 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2566 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2584 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2567 RegExpNode* on_success); 2585 RegExpNode* on_success) V8_OVERRIDE;
2568 virtual RegExpAtom* AsAtom(); 2586 virtual RegExpAtom* AsAtom() V8_OVERRIDE;
2569 virtual bool IsAtom(); 2587 virtual bool IsAtom() V8_OVERRIDE;
2570 virtual bool IsTextElement() { return true; } 2588 virtual bool IsTextElement() V8_OVERRIDE { return true; }
2571 virtual int min_match() { return data_.length(); } 2589 virtual int min_match() V8_OVERRIDE { return data_.length(); }
2572 virtual int max_match() { return data_.length(); } 2590 virtual int max_match() V8_OVERRIDE { return data_.length(); }
2573 virtual void AppendToText(RegExpText* text, Zone* zone); 2591 virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE;
2574 Vector<const uc16> data() { return data_; } 2592 Vector<const uc16> data() { return data_; }
2575 int length() { return data_.length(); } 2593 int length() { return data_.length(); }
2576 private: 2594 private:
2577 Vector<const uc16> data_; 2595 Vector<const uc16> data_;
2578 }; 2596 };
2579 2597
2580 2598
2581 class RegExpText: public RegExpTree { 2599 class RegExpText V8_FINAL : public RegExpTree {
2582 public: 2600 public:
2583 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {} 2601 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {}
2584 virtual void* Accept(RegExpVisitor* visitor, void* data); 2602 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2585 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2603 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2586 RegExpNode* on_success); 2604 RegExpNode* on_success) V8_OVERRIDE;
2587 virtual RegExpText* AsText(); 2605 virtual RegExpText* AsText() V8_OVERRIDE;
2588 virtual bool IsText(); 2606 virtual bool IsText() V8_OVERRIDE;
2589 virtual bool IsTextElement() { return true; } 2607 virtual bool IsTextElement() V8_OVERRIDE { return true; }
2590 virtual int min_match() { return length_; } 2608 virtual int min_match() V8_OVERRIDE { return length_; }
2591 virtual int max_match() { return length_; } 2609 virtual int max_match() V8_OVERRIDE { return length_; }
2592 virtual void AppendToText(RegExpText* text, Zone* zone); 2610 virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE;
2593 void AddElement(TextElement elm, Zone* zone) { 2611 void AddElement(TextElement elm, Zone* zone) {
2594 elements_.Add(elm, zone); 2612 elements_.Add(elm, zone);
2595 length_ += elm.length(); 2613 length_ += elm.length();
2596 } 2614 }
2597 ZoneList<TextElement>* elements() { return &elements_; } 2615 ZoneList<TextElement>* elements() { return &elements_; }
2598 private: 2616 private:
2599 ZoneList<TextElement> elements_; 2617 ZoneList<TextElement> elements_;
2600 int length_; 2618 int length_;
2601 }; 2619 };
2602 2620
2603 2621
2604 class RegExpQuantifier: public RegExpTree { 2622 class RegExpQuantifier V8_FINAL : public RegExpTree {
2605 public: 2623 public:
2606 enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE }; 2624 enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE };
2607 RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body) 2625 RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body)
2608 : body_(body), 2626 : body_(body),
2609 min_(min), 2627 min_(min),
2610 max_(max), 2628 max_(max),
2611 min_match_(min * body->min_match()), 2629 min_match_(min * body->min_match()),
2612 quantifier_type_(type) { 2630 quantifier_type_(type) {
2613 if (max > 0 && body->max_match() > kInfinity / max) { 2631 if (max > 0 && body->max_match() > kInfinity / max) {
2614 max_match_ = kInfinity; 2632 max_match_ = kInfinity;
2615 } else { 2633 } else {
2616 max_match_ = max * body->max_match(); 2634 max_match_ = max * body->max_match();
2617 } 2635 }
2618 } 2636 }
2619 virtual void* Accept(RegExpVisitor* visitor, void* data); 2637 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2620 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2638 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2621 RegExpNode* on_success); 2639 RegExpNode* on_success) V8_OVERRIDE;
2622 static RegExpNode* ToNode(int min, 2640 static RegExpNode* ToNode(int min,
2623 int max, 2641 int max,
2624 bool is_greedy, 2642 bool is_greedy,
2625 RegExpTree* body, 2643 RegExpTree* body,
2626 RegExpCompiler* compiler, 2644 RegExpCompiler* compiler,
2627 RegExpNode* on_success, 2645 RegExpNode* on_success,
2628 bool not_at_start = false); 2646 bool not_at_start = false);
2629 virtual RegExpQuantifier* AsQuantifier(); 2647 virtual RegExpQuantifier* AsQuantifier() V8_OVERRIDE;
2630 virtual Interval CaptureRegisters(); 2648 virtual Interval CaptureRegisters() V8_OVERRIDE;
2631 virtual bool IsQuantifier(); 2649 virtual bool IsQuantifier() V8_OVERRIDE;
2632 virtual int min_match() { return min_match_; } 2650 virtual int min_match() V8_OVERRIDE { return min_match_; }
2633 virtual int max_match() { return max_match_; } 2651 virtual int max_match() V8_OVERRIDE { return max_match_; }
2634 int min() { return min_; } 2652 int min() { return min_; }
2635 int max() { return max_; } 2653 int max() { return max_; }
2636 bool is_possessive() { return quantifier_type_ == POSSESSIVE; } 2654 bool is_possessive() { return quantifier_type_ == POSSESSIVE; }
2637 bool is_non_greedy() { return quantifier_type_ == NON_GREEDY; } 2655 bool is_non_greedy() { return quantifier_type_ == NON_GREEDY; }
2638 bool is_greedy() { return quantifier_type_ == GREEDY; } 2656 bool is_greedy() { return quantifier_type_ == GREEDY; }
2639 RegExpTree* body() { return body_; } 2657 RegExpTree* body() { return body_; }
2640 2658
2641 private: 2659 private:
2642 RegExpTree* body_; 2660 RegExpTree* body_;
2643 int min_; 2661 int min_;
2644 int max_; 2662 int max_;
2645 int min_match_; 2663 int min_match_;
2646 int max_match_; 2664 int max_match_;
2647 QuantifierType quantifier_type_; 2665 QuantifierType quantifier_type_;
2648 }; 2666 };
2649 2667
2650 2668
2651 class RegExpCapture: public RegExpTree { 2669 class RegExpCapture V8_FINAL : public RegExpTree {
2652 public: 2670 public:
2653 explicit RegExpCapture(RegExpTree* body, int index) 2671 explicit RegExpCapture(RegExpTree* body, int index)
2654 : body_(body), index_(index) { } 2672 : body_(body), index_(index) { }
2655 virtual void* Accept(RegExpVisitor* visitor, void* data); 2673 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2656 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2674 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2657 RegExpNode* on_success); 2675 RegExpNode* on_success) V8_OVERRIDE;
2658 static RegExpNode* ToNode(RegExpTree* body, 2676 static RegExpNode* ToNode(RegExpTree* body,
2659 int index, 2677 int index,
2660 RegExpCompiler* compiler, 2678 RegExpCompiler* compiler,
2661 RegExpNode* on_success); 2679 RegExpNode* on_success);
2662 virtual RegExpCapture* AsCapture(); 2680 virtual RegExpCapture* AsCapture() V8_OVERRIDE;
2663 virtual bool IsAnchoredAtStart(); 2681 virtual bool IsAnchoredAtStart() V8_OVERRIDE;
2664 virtual bool IsAnchoredAtEnd(); 2682 virtual bool IsAnchoredAtEnd() V8_OVERRIDE;
2665 virtual Interval CaptureRegisters(); 2683 virtual Interval CaptureRegisters() V8_OVERRIDE;
2666 virtual bool IsCapture(); 2684 virtual bool IsCapture() V8_OVERRIDE;
2667 virtual int min_match() { return body_->min_match(); } 2685 virtual int min_match() V8_OVERRIDE { return body_->min_match(); }
2668 virtual int max_match() { return body_->max_match(); } 2686 virtual int max_match() V8_OVERRIDE { return body_->max_match(); }
2669 RegExpTree* body() { return body_; } 2687 RegExpTree* body() { return body_; }
2670 int index() { return index_; } 2688 int index() { return index_; }
2671 static int StartRegister(int index) { return index * 2; } 2689 static int StartRegister(int index) { return index * 2; }
2672 static int EndRegister(int index) { return index * 2 + 1; } 2690 static int EndRegister(int index) { return index * 2 + 1; }
2673 2691
2674 private: 2692 private:
2675 RegExpTree* body_; 2693 RegExpTree* body_;
2676 int index_; 2694 int index_;
2677 }; 2695 };
2678 2696
2679 2697
2680 class RegExpLookahead: public RegExpTree { 2698 class RegExpLookahead V8_FINAL : public RegExpTree {
2681 public: 2699 public:
2682 RegExpLookahead(RegExpTree* body, 2700 RegExpLookahead(RegExpTree* body,
2683 bool is_positive, 2701 bool is_positive,
2684 int capture_count, 2702 int capture_count,
2685 int capture_from) 2703 int capture_from)
2686 : body_(body), 2704 : body_(body),
2687 is_positive_(is_positive), 2705 is_positive_(is_positive),
2688 capture_count_(capture_count), 2706 capture_count_(capture_count),
2689 capture_from_(capture_from) { } 2707 capture_from_(capture_from) { }
2690 2708
2691 virtual void* Accept(RegExpVisitor* visitor, void* data); 2709 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2692 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2710 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2693 RegExpNode* on_success); 2711 RegExpNode* on_success) V8_OVERRIDE;
2694 virtual RegExpLookahead* AsLookahead(); 2712 virtual RegExpLookahead* AsLookahead() V8_OVERRIDE;
2695 virtual Interval CaptureRegisters(); 2713 virtual Interval CaptureRegisters() V8_OVERRIDE;
2696 virtual bool IsLookahead(); 2714 virtual bool IsLookahead() V8_OVERRIDE;
2697 virtual bool IsAnchoredAtStart(); 2715 virtual bool IsAnchoredAtStart() V8_OVERRIDE;
2698 virtual int min_match() { return 0; } 2716 virtual int min_match() V8_OVERRIDE { return 0; }
2699 virtual int max_match() { return 0; } 2717 virtual int max_match() V8_OVERRIDE { return 0; }
2700 RegExpTree* body() { return body_; } 2718 RegExpTree* body() { return body_; }
2701 bool is_positive() { return is_positive_; } 2719 bool is_positive() { return is_positive_; }
2702 int capture_count() { return capture_count_; } 2720 int capture_count() { return capture_count_; }
2703 int capture_from() { return capture_from_; } 2721 int capture_from() { return capture_from_; }
2704 2722
2705 private: 2723 private:
2706 RegExpTree* body_; 2724 RegExpTree* body_;
2707 bool is_positive_; 2725 bool is_positive_;
2708 int capture_count_; 2726 int capture_count_;
2709 int capture_from_; 2727 int capture_from_;
2710 }; 2728 };
2711 2729
2712 2730
2713 class RegExpBackReference: public RegExpTree { 2731 class RegExpBackReference V8_FINAL : public RegExpTree {
2714 public: 2732 public:
2715 explicit RegExpBackReference(RegExpCapture* capture) 2733 explicit RegExpBackReference(RegExpCapture* capture)
2716 : capture_(capture) { } 2734 : capture_(capture) { }
2717 virtual void* Accept(RegExpVisitor* visitor, void* data); 2735 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2718 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2736 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2719 RegExpNode* on_success); 2737 RegExpNode* on_success) V8_OVERRIDE;
2720 virtual RegExpBackReference* AsBackReference(); 2738 virtual RegExpBackReference* AsBackReference() V8_OVERRIDE;
2721 virtual bool IsBackReference(); 2739 virtual bool IsBackReference() V8_OVERRIDE;
2722 virtual int min_match() { return 0; } 2740 virtual int min_match() V8_OVERRIDE { return 0; }
2723 virtual int max_match() { return capture_->max_match(); } 2741 virtual int max_match() V8_OVERRIDE { return capture_->max_match(); }
2724 int index() { return capture_->index(); } 2742 int index() { return capture_->index(); }
2725 RegExpCapture* capture() { return capture_; } 2743 RegExpCapture* capture() { return capture_; }
2726 private: 2744 private:
2727 RegExpCapture* capture_; 2745 RegExpCapture* capture_;
2728 }; 2746 };
2729 2747
2730 2748
2731 class RegExpEmpty: public RegExpTree { 2749 class RegExpEmpty V8_FINAL : public RegExpTree {
2732 public: 2750 public:
2733 RegExpEmpty() { } 2751 RegExpEmpty() { }
2734 virtual void* Accept(RegExpVisitor* visitor, void* data); 2752 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
2735 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2753 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2736 RegExpNode* on_success); 2754 RegExpNode* on_success) V8_OVERRIDE;
2737 virtual RegExpEmpty* AsEmpty(); 2755 virtual RegExpEmpty* AsEmpty() V8_OVERRIDE;
2738 virtual bool IsEmpty(); 2756 virtual bool IsEmpty() V8_OVERRIDE;
2739 virtual int min_match() { return 0; } 2757 virtual int min_match() V8_OVERRIDE { return 0; }
2740 virtual int max_match() { return 0; } 2758 virtual int max_match() V8_OVERRIDE { return 0; }
2741 static RegExpEmpty* GetInstance() { 2759 static RegExpEmpty* GetInstance() {
2742 static RegExpEmpty* instance = ::new RegExpEmpty(); 2760 static RegExpEmpty* instance = ::new RegExpEmpty();
2743 return instance; 2761 return instance;
2744 } 2762 }
2745 }; 2763 };
2746 2764
2747 2765
2748 // ---------------------------------------------------------------------------- 2766 // ----------------------------------------------------------------------------
2749 // Out-of-line inline constructors (to side-step cyclic dependencies). 2767 // Out-of-line inline constructors (to side-step cyclic dependencies).
2750 2768
2751 inline ModuleVariable::ModuleVariable(VariableProxy* proxy) 2769 inline ModuleVariable::ModuleVariable(VariableProxy* proxy)
2752 : Module(proxy->interface()), 2770 : Module(proxy->interface()),
2753 proxy_(proxy) { 2771 proxy_(proxy) {
2754 } 2772 }
2755 2773
2756 2774
2757 // ---------------------------------------------------------------------------- 2775 // ----------------------------------------------------------------------------
2758 // Basic visitor 2776 // Basic visitor
2759 // - leaf node visitors are abstract. 2777 // - leaf node visitors are abstract.
2760 2778
2761 class AstVisitor BASE_EMBEDDED { 2779 class AstVisitor BASE_EMBEDDED {
2762 public: 2780 public:
2763 AstVisitor() {} 2781 AstVisitor() {}
2764 virtual ~AstVisitor() { } 2782 virtual ~AstVisitor() {}
2765 2783
2766 // Stack overflow check and dynamic dispatch. 2784 // Stack overflow check and dynamic dispatch.
2767 virtual void Visit(AstNode* node) = 0; 2785 virtual void Visit(AstNode* node) = 0;
2768 2786
2769 // Iteration left-to-right. 2787 // Iteration left-to-right.
2770 virtual void VisitDeclarations(ZoneList<Declaration*>* declarations); 2788 virtual void VisitDeclarations(ZoneList<Declaration*>* declarations);
2771 virtual void VisitStatements(ZoneList<Statement*>* statements); 2789 virtual void VisitStatements(ZoneList<Statement*>* statements);
2772 virtual void VisitExpressions(ZoneList<Expression*>* expressions); 2790 virtual void VisitExpressions(ZoneList<Expression*>* expressions);
2773 2791
2774 // Individual AST nodes. 2792 // Individual AST nodes.
2775 #define DEF_VISIT(type) \ 2793 #define DEF_VISIT(type) \
2776 virtual void Visit##type(type* node) = 0; 2794 virtual void Visit##type(type* node) = 0;
2777 AST_NODE_LIST(DEF_VISIT) 2795 AST_NODE_LIST(DEF_VISIT)
2778 #undef DEF_VISIT 2796 #undef DEF_VISIT
2779 }; 2797 };
2780 2798
2781 2799
2782 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ 2800 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \
2783 public: \ 2801 public: \
2784 virtual void Visit(AstNode* node) { \ 2802 virtual void Visit(AstNode* node) V8_FINAL V8_OVERRIDE { \
2785 if (!CheckStackOverflow()) node->Accept(this); \ 2803 if (!CheckStackOverflow()) node->Accept(this); \
2786 } \ 2804 } \
2787 \ 2805 \
2788 void SetStackOverflow() { stack_overflow_ = true; } \ 2806 void SetStackOverflow() { stack_overflow_ = true; } \
2789 void ClearStackOverflow() { stack_overflow_ = false; } \ 2807 void ClearStackOverflow() { stack_overflow_ = false; } \
2790 bool HasStackOverflow() const { return stack_overflow_; } \ 2808 bool HasStackOverflow() const { return stack_overflow_; } \
2791 \ 2809 \
2792 bool CheckStackOverflow() { \ 2810 bool CheckStackOverflow() { \
2793 if (stack_overflow_) return true; \ 2811 if (stack_overflow_) return true; \
2794 StackLimitCheck check(isolate_); \ 2812 StackLimitCheck check(isolate_); \
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2840 AST_NODE_LIST(DEF_VISIT) 2858 AST_NODE_LIST(DEF_VISIT)
2841 #undef DEF_VISIT 2859 #undef DEF_VISIT
2842 }; 2860 };
2843 2861
2844 2862
2845 2863
2846 // ---------------------------------------------------------------------------- 2864 // ----------------------------------------------------------------------------
2847 // AstNode factory 2865 // AstNode factory
2848 2866
2849 template<class Visitor> 2867 template<class Visitor>
2850 class AstNodeFactory BASE_EMBEDDED { 2868 class AstNodeFactory V8_FINAL BASE_EMBEDDED {
2851 public: 2869 public:
2852 AstNodeFactory(Isolate* isolate, Zone* zone) 2870 AstNodeFactory(Isolate* isolate, Zone* zone)
2853 : isolate_(isolate), 2871 : isolate_(isolate),
2854 zone_(zone) { } 2872 zone_(zone) { }
2855 2873
2856 Visitor* visitor() { return &visitor_; } 2874 Visitor* visitor() { return &visitor_; }
2857 2875
2858 #define VISIT_AND_RETURN(NodeType, node) \ 2876 #define VISIT_AND_RETURN(NodeType, node) \
2859 visitor_.Visit##NodeType((node)); \ 2877 visitor_.Visit##NodeType((node)); \
2860 return node; 2878 return node;
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
3225 private: 3243 private:
3226 Isolate* isolate_; 3244 Isolate* isolate_;
3227 Zone* zone_; 3245 Zone* zone_;
3228 Visitor visitor_; 3246 Visitor visitor_;
3229 }; 3247 };
3230 3248
3231 3249
3232 } } // namespace v8::internal 3250 } } // namespace v8::internal
3233 3251
3234 #endif // V8_AST_H_ 3252 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-gap-resolver-arm.h ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698