| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 FunctionLiteral* fun_; | 428 FunctionLiteral* fun_; |
| 429 }; | 429 }; |
| 430 | 430 |
| 431 | 431 |
| 432 class IterationStatement: public BreakableStatement { | 432 class IterationStatement: public BreakableStatement { |
| 433 public: | 433 public: |
| 434 // Type testing & conversion. | 434 // Type testing & conversion. |
| 435 virtual IterationStatement* AsIterationStatement() { return this; } | 435 virtual IterationStatement* AsIterationStatement() { return this; } |
| 436 | 436 |
| 437 Statement* body() const { return body_; } | 437 Statement* body() const { return body_; } |
| 438 void set_body(Statement* stmt) { body_ = stmt; } |
| 438 | 439 |
| 439 // Bailout support. | 440 // Bailout support. |
| 440 int OsrEntryId() const { return osr_entry_id_; } | 441 int OsrEntryId() const { return osr_entry_id_; } |
| 441 virtual int ContinueId() const = 0; | 442 virtual int ContinueId() const = 0; |
| 442 | 443 |
| 443 // Code generation | 444 // Code generation |
| 444 BreakTarget* continue_target() { return &continue_target_; } | 445 BreakTarget* continue_target() { return &continue_target_; } |
| 445 | 446 |
| 446 protected: | 447 protected: |
| 447 explicit inline IterationStatement(ZoneStringList* labels); | 448 explicit inline IterationStatement(ZoneStringList* labels); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 Expression* cond, | 525 Expression* cond, |
| 525 Statement* next, | 526 Statement* next, |
| 526 Statement* body) { | 527 Statement* body) { |
| 527 IterationStatement::Initialize(body); | 528 IterationStatement::Initialize(body); |
| 528 init_ = init; | 529 init_ = init; |
| 529 cond_ = cond; | 530 cond_ = cond; |
| 530 next_ = next; | 531 next_ = next; |
| 531 } | 532 } |
| 532 | 533 |
| 533 Statement* init() const { return init_; } | 534 Statement* init() const { return init_; } |
| 535 void set_init(Statement* stmt) { init_ = stmt; } |
| 534 Expression* cond() const { return cond_; } | 536 Expression* cond() const { return cond_; } |
| 537 void set_cond(Expression* expr) { cond_ = expr; } |
| 535 Statement* next() const { return next_; } | 538 Statement* next() const { return next_; } |
| 539 void set_next(Statement* stmt) { next_ = stmt; } |
| 536 | 540 |
| 537 bool may_have_function_literal() const { | 541 bool may_have_function_literal() const { |
| 538 return may_have_function_literal_; | 542 return may_have_function_literal_; |
| 539 } | 543 } |
| 540 void set_may_have_function_literal(bool value) { | 544 void set_may_have_function_literal(bool value) { |
| 541 may_have_function_literal_ = value; | 545 may_have_function_literal_ = value; |
| 542 } | 546 } |
| 543 | 547 |
| 544 // Bailout support. | 548 // Bailout support. |
| 545 virtual int ContinueId() const { return next_id_; } | 549 virtual int ContinueId() const { return next_id_; } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 568 void Initialize(Expression* each, Expression* enumerable, Statement* body) { | 572 void Initialize(Expression* each, Expression* enumerable, Statement* body) { |
| 569 IterationStatement::Initialize(body); | 573 IterationStatement::Initialize(body); |
| 570 each_ = each; | 574 each_ = each; |
| 571 enumerable_ = enumerable; | 575 enumerable_ = enumerable; |
| 572 } | 576 } |
| 573 | 577 |
| 574 Expression* each() const { return each_; } | 578 Expression* each() const { return each_; } |
| 575 Expression* enumerable() const { return enumerable_; } | 579 Expression* enumerable() const { return enumerable_; } |
| 576 | 580 |
| 577 // Bailout support. | 581 // Bailout support. |
| 578 int AssignmentId() const { return assignment_id_; } | |
| 579 virtual int ContinueId() const { return EntryId(); } | 582 virtual int ContinueId() const { return EntryId(); } |
| 580 | 583 |
| 581 private: | 584 private: |
| 582 Expression* each_; | 585 Expression* each_; |
| 583 Expression* enumerable_; | 586 Expression* enumerable_; |
| 584 int assignment_id_; | |
| 585 }; | 587 }; |
| 586 | 588 |
| 587 | 589 |
| 588 class ExpressionStatement: public Statement { | 590 class ExpressionStatement: public Statement { |
| 589 public: | 591 public: |
| 590 explicit ExpressionStatement(Expression* expression) | 592 explicit ExpressionStatement(Expression* expression) |
| 591 : expression_(expression) { } | 593 : expression_(expression) { } |
| 592 | 594 |
| 593 DECLARE_NODE_TYPE(ExpressionStatement) | 595 DECLARE_NODE_TYPE(ExpressionStatement) |
| 594 | 596 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 | 741 |
| 740 DECLARE_NODE_TYPE(IfStatement) | 742 DECLARE_NODE_TYPE(IfStatement) |
| 741 | 743 |
| 742 virtual bool IsInlineable() const; | 744 virtual bool IsInlineable() const; |
| 743 | 745 |
| 744 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } | 746 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } |
| 745 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } | 747 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } |
| 746 | 748 |
| 747 Expression* condition() const { return condition_; } | 749 Expression* condition() const { return condition_; } |
| 748 Statement* then_statement() const { return then_statement_; } | 750 Statement* then_statement() const { return then_statement_; } |
| 751 void set_then_statement(Statement* stmt) { then_statement_ = stmt; } |
| 749 Statement* else_statement() const { return else_statement_; } | 752 Statement* else_statement() const { return else_statement_; } |
| 753 void set_else_statement(Statement* stmt) { else_statement_ = stmt; } |
| 750 | 754 |
| 751 private: | 755 private: |
| 752 Expression* condition_; | 756 Expression* condition_; |
| 753 Statement* then_statement_; | 757 Statement* then_statement_; |
| 754 Statement* else_statement_; | 758 Statement* else_statement_; |
| 755 }; | 759 }; |
| 756 | 760 |
| 757 | 761 |
| 758 // NOTE: TargetCollectors are represented as nodes to fit in the target | 762 // NOTE: TargetCollectors are represented as nodes to fit in the target |
| 759 // stack in the compiler; this should probably be reworked. | 763 // stack in the compiler; this should probably be reworked. |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 private: | 1425 private: |
| 1422 Token::Value op_; | 1426 Token::Value op_; |
| 1423 Expression* expression_; | 1427 Expression* expression_; |
| 1424 int pos_; | 1428 int pos_; |
| 1425 }; | 1429 }; |
| 1426 | 1430 |
| 1427 | 1431 |
| 1428 class CountOperation: public Expression { | 1432 class CountOperation: public Expression { |
| 1429 public: | 1433 public: |
| 1430 CountOperation(bool is_prefix, IncrementOperation* increment, int pos) | 1434 CountOperation(bool is_prefix, IncrementOperation* increment, int pos) |
| 1431 : is_prefix_(is_prefix), increment_(increment), pos_(pos), | 1435 : is_prefix_(is_prefix), increment_(increment), pos_(pos) { } |
| 1432 assignment_id_(GetNextId()) { | |
| 1433 } | |
| 1434 | 1436 |
| 1435 DECLARE_NODE_TYPE(CountOperation) | 1437 DECLARE_NODE_TYPE(CountOperation) |
| 1436 | 1438 |
| 1437 bool is_prefix() const { return is_prefix_; } | 1439 bool is_prefix() const { return is_prefix_; } |
| 1438 bool is_postfix() const { return !is_prefix_; } | 1440 bool is_postfix() const { return !is_prefix_; } |
| 1439 | 1441 |
| 1440 Token::Value op() const { return increment_->op(); } | 1442 Token::Value op() const { return increment_->op(); } |
| 1441 Token::Value binary_op() { | 1443 Token::Value binary_op() { |
| 1442 return (op() == Token::INC) ? Token::ADD : Token::SUB; | 1444 return (op() == Token::INC) ? Token::ADD : Token::SUB; |
| 1443 } | 1445 } |
| 1444 | 1446 |
| 1445 Expression* expression() const { return increment_->expression(); } | 1447 Expression* expression() const { return increment_->expression(); } |
| 1446 IncrementOperation* increment() const { return increment_; } | 1448 IncrementOperation* increment() const { return increment_; } |
| 1447 int position() const { return pos_; } | 1449 int position() const { return pos_; } |
| 1448 | 1450 |
| 1449 virtual void MarkAsStatement() { is_prefix_ = true; } | 1451 virtual void MarkAsStatement() { is_prefix_ = true; } |
| 1450 | 1452 |
| 1451 virtual bool IsInlineable() const; | 1453 virtual bool IsInlineable() const; |
| 1452 | 1454 |
| 1453 // Bailout support. | |
| 1454 int AssignmentId() const { return assignment_id_; } | |
| 1455 | |
| 1456 private: | 1455 private: |
| 1457 bool is_prefix_; | 1456 bool is_prefix_; |
| 1458 IncrementOperation* increment_; | 1457 IncrementOperation* increment_; |
| 1459 int pos_; | 1458 int pos_; |
| 1460 int assignment_id_; | |
| 1461 }; | 1459 }; |
| 1462 | 1460 |
| 1463 | 1461 |
| 1464 class CompareOperation: public Expression { | 1462 class CompareOperation: public Expression { |
| 1465 public: | 1463 public: |
| 1466 CompareOperation(Token::Value op, | 1464 CompareOperation(Token::Value op, |
| 1467 Expression* left, | 1465 Expression* left, |
| 1468 Expression* right, | 1466 Expression* right, |
| 1469 int pos) | 1467 int pos) |
| 1470 : op_(op), left_(left), right_(right), pos_(pos), compare_type_(NONE) { | 1468 : op_(op), left_(left), right_(right), pos_(pos), compare_type_(NONE) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 | 1578 |
| 1581 // Type feedback information. | 1579 // Type feedback information. |
| 1582 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1580 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1583 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1581 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1584 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1582 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
| 1585 virtual Handle<Map> GetMonomorphicReceiverType() { | 1583 virtual Handle<Map> GetMonomorphicReceiverType() { |
| 1586 return monomorphic_receiver_type_; | 1584 return monomorphic_receiver_type_; |
| 1587 } | 1585 } |
| 1588 | 1586 |
| 1589 // Bailout support. | 1587 // Bailout support. |
| 1590 int CompoundLoadId() const { return compound_load_id_; } | 1588 int compound_bailout_id() const { return compound_bailout_id_; } |
| 1591 int AssignmentId() const { return assignment_id_; } | |
| 1592 | 1589 |
| 1593 private: | 1590 private: |
| 1594 Token::Value op_; | 1591 Token::Value op_; |
| 1595 Expression* target_; | 1592 Expression* target_; |
| 1596 Expression* value_; | 1593 Expression* value_; |
| 1597 int pos_; | 1594 int pos_; |
| 1598 BinaryOperation* binary_operation_; | 1595 BinaryOperation* binary_operation_; |
| 1599 int compound_load_id_; | 1596 int compound_bailout_id_; |
| 1600 int assignment_id_; | |
| 1601 | 1597 |
| 1602 bool block_start_; | 1598 bool block_start_; |
| 1603 bool block_end_; | 1599 bool block_end_; |
| 1604 | 1600 |
| 1605 bool is_monomorphic_; | 1601 bool is_monomorphic_; |
| 1606 ZoneMapList* receiver_types_; | 1602 ZoneMapList* receiver_types_; |
| 1607 Handle<Map> monomorphic_receiver_type_; | 1603 Handle<Map> monomorphic_receiver_type_; |
| 1608 }; | 1604 }; |
| 1609 | 1605 |
| 1610 | 1606 |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 AST_NODE_LIST(DEF_VISIT) | 2125 AST_NODE_LIST(DEF_VISIT) |
| 2130 #undef DEF_VISIT | 2126 #undef DEF_VISIT |
| 2131 | 2127 |
| 2132 private: | 2128 private: |
| 2133 bool stack_overflow_; | 2129 bool stack_overflow_; |
| 2134 }; | 2130 }; |
| 2135 | 2131 |
| 2136 } } // namespace v8::internal | 2132 } } // namespace v8::internal |
| 2137 | 2133 |
| 2138 #endif // V8_AST_H_ | 2134 #endif // V8_AST_H_ |
| OLD | NEW |