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

Side by Side Diff: src/ast.h

Issue 8462010: Add a level of indirection to exception handler addresses. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporate review changes. Created 9 years, 1 month 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/macro-assembler-arm.cc ('k') | src/code-stubs.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 ZoneList<Label*>* targets() { return &targets_; } 828 ZoneList<Label*>* targets() { return &targets_; }
829 virtual bool IsInlineable() const; 829 virtual bool IsInlineable() const;
830 830
831 private: 831 private:
832 ZoneList<Label*> targets_; 832 ZoneList<Label*> targets_;
833 }; 833 };
834 834
835 835
836 class TryStatement: public Statement { 836 class TryStatement: public Statement {
837 public: 837 public:
838 explicit TryStatement(Block* try_block) 838 explicit TryStatement(int index, Block* try_block)
839 : try_block_(try_block), escaping_targets_(NULL) { } 839 : index_(index),
840 try_block_(try_block),
841 escaping_targets_(NULL) {
842 }
840 843
841 void set_escaping_targets(ZoneList<Label*>* targets) { 844 void set_escaping_targets(ZoneList<Label*>* targets) {
842 escaping_targets_ = targets; 845 escaping_targets_ = targets;
843 } 846 }
844 847
848 int index() const { return index_; }
845 Block* try_block() const { return try_block_; } 849 Block* try_block() const { return try_block_; }
846 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } 850 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; }
847 virtual bool IsInlineable() const; 851 virtual bool IsInlineable() const;
848 852
849 private: 853 private:
854 // Unique (per-function) index of this handler. This is not an AST ID.
855 int index_;
856
850 Block* try_block_; 857 Block* try_block_;
851 ZoneList<Label*>* escaping_targets_; 858 ZoneList<Label*>* escaping_targets_;
852 }; 859 };
853 860
854 861
855 class TryCatchStatement: public TryStatement { 862 class TryCatchStatement: public TryStatement {
856 public: 863 public:
857 TryCatchStatement(Block* try_block, 864 TryCatchStatement(int index,
865 Block* try_block,
858 Scope* scope, 866 Scope* scope,
859 Variable* variable, 867 Variable* variable,
860 Block* catch_block) 868 Block* catch_block)
861 : TryStatement(try_block), 869 : TryStatement(index, try_block),
862 scope_(scope), 870 scope_(scope),
863 variable_(variable), 871 variable_(variable),
864 catch_block_(catch_block) { 872 catch_block_(catch_block) {
865 } 873 }
866 874
867 DECLARE_NODE_TYPE(TryCatchStatement) 875 DECLARE_NODE_TYPE(TryCatchStatement)
868 876
869 Scope* scope() { return scope_; } 877 Scope* scope() { return scope_; }
870 Variable* variable() { return variable_; } 878 Variable* variable() { return variable_; }
871 Block* catch_block() const { return catch_block_; } 879 Block* catch_block() const { return catch_block_; }
872 virtual bool IsInlineable() const; 880 virtual bool IsInlineable() const;
873 881
874 private: 882 private:
875 Scope* scope_; 883 Scope* scope_;
876 Variable* variable_; 884 Variable* variable_;
877 Block* catch_block_; 885 Block* catch_block_;
878 }; 886 };
879 887
880 888
881 class TryFinallyStatement: public TryStatement { 889 class TryFinallyStatement: public TryStatement {
882 public: 890 public:
883 TryFinallyStatement(Block* try_block, Block* finally_block) 891 TryFinallyStatement(int index, Block* try_block, Block* finally_block)
884 : TryStatement(try_block), 892 : TryStatement(index, try_block),
885 finally_block_(finally_block) { } 893 finally_block_(finally_block) { }
886 894
887 DECLARE_NODE_TYPE(TryFinallyStatement) 895 DECLARE_NODE_TYPE(TryFinallyStatement)
888 896
889 Block* finally_block() const { return finally_block_; } 897 Block* finally_block() const { return finally_block_; }
890 virtual bool IsInlineable() const; 898 virtual bool IsInlineable() const;
891 899
892 private: 900 private:
893 Block* finally_block_; 901 Block* finally_block_;
894 }; 902 };
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 NAMED_EXPRESSION, 1645 NAMED_EXPRESSION,
1638 DECLARATION 1646 DECLARATION
1639 }; 1647 };
1640 1648
1641 FunctionLiteral(Isolate* isolate, 1649 FunctionLiteral(Isolate* isolate,
1642 Handle<String> name, 1650 Handle<String> name,
1643 Scope* scope, 1651 Scope* scope,
1644 ZoneList<Statement*>* body, 1652 ZoneList<Statement*>* body,
1645 int materialized_literal_count, 1653 int materialized_literal_count,
1646 int expected_property_count, 1654 int expected_property_count,
1655 int handler_count,
1647 bool has_only_simple_this_property_assignments, 1656 bool has_only_simple_this_property_assignments,
1648 Handle<FixedArray> this_property_assignments, 1657 Handle<FixedArray> this_property_assignments,
1649 int parameter_count, 1658 int parameter_count,
1650 Type type, 1659 Type type,
1651 bool has_duplicate_parameters) 1660 bool has_duplicate_parameters)
1652 : Expression(isolate), 1661 : Expression(isolate),
1653 name_(name), 1662 name_(name),
1654 scope_(scope), 1663 scope_(scope),
1655 body_(body), 1664 body_(body),
1656 this_property_assignments_(this_property_assignments), 1665 this_property_assignments_(this_property_assignments),
1657 inferred_name_(isolate->factory()->empty_string()), 1666 inferred_name_(isolate->factory()->empty_string()),
1658 materialized_literal_count_(materialized_literal_count), 1667 materialized_literal_count_(materialized_literal_count),
1659 expected_property_count_(expected_property_count), 1668 expected_property_count_(expected_property_count),
1669 handler_count_(handler_count),
1660 parameter_count_(parameter_count), 1670 parameter_count_(parameter_count),
1661 function_token_position_(RelocInfo::kNoPosition) { 1671 function_token_position_(RelocInfo::kNoPosition) {
1662 bitfield_ = 1672 bitfield_ =
1663 HasOnlySimpleThisPropertyAssignments::encode( 1673 HasOnlySimpleThisPropertyAssignments::encode(
1664 has_only_simple_this_property_assignments) | 1674 has_only_simple_this_property_assignments) |
1665 IsExpression::encode(type != DECLARATION) | 1675 IsExpression::encode(type != DECLARATION) |
1666 IsAnonymous::encode(type == ANONYMOUS_EXPRESSION) | 1676 IsAnonymous::encode(type == ANONYMOUS_EXPRESSION) |
1667 Pretenure::encode(false) | 1677 Pretenure::encode(false) |
1668 HasDuplicateParameters::encode(has_duplicate_parameters); 1678 HasDuplicateParameters::encode(has_duplicate_parameters);
1669 } 1679 }
1670 1680
1671 DECLARE_NODE_TYPE(FunctionLiteral) 1681 DECLARE_NODE_TYPE(FunctionLiteral)
1672 1682
1673 Handle<String> name() const { return name_; } 1683 Handle<String> name() const { return name_; }
1674 Scope* scope() const { return scope_; } 1684 Scope* scope() const { return scope_; }
1675 ZoneList<Statement*>* body() const { return body_; } 1685 ZoneList<Statement*>* body() const { return body_; }
1676 void set_function_token_position(int pos) { function_token_position_ = pos; } 1686 void set_function_token_position(int pos) { function_token_position_ = pos; }
1677 int function_token_position() const { return function_token_position_; } 1687 int function_token_position() const { return function_token_position_; }
1678 int start_position() const; 1688 int start_position() const;
1679 int end_position() const; 1689 int end_position() const;
1680 bool is_expression() const { return IsExpression::decode(bitfield_); } 1690 bool is_expression() const { return IsExpression::decode(bitfield_); }
1681 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } 1691 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); }
1682 bool strict_mode() const { return strict_mode_flag() == kStrictMode; } 1692 bool strict_mode() const { return strict_mode_flag() == kStrictMode; }
1683 StrictModeFlag strict_mode_flag() const; 1693 StrictModeFlag strict_mode_flag() const;
1684 1694
1685 int materialized_literal_count() { return materialized_literal_count_; } 1695 int materialized_literal_count() { return materialized_literal_count_; }
1686 int expected_property_count() { return expected_property_count_; } 1696 int expected_property_count() { return expected_property_count_; }
1697 int handler_count() { return handler_count_; }
1687 bool has_only_simple_this_property_assignments() { 1698 bool has_only_simple_this_property_assignments() {
1688 return HasOnlySimpleThisPropertyAssignments::decode(bitfield_); 1699 return HasOnlySimpleThisPropertyAssignments::decode(bitfield_);
1689 } 1700 }
1690 Handle<FixedArray> this_property_assignments() { 1701 Handle<FixedArray> this_property_assignments() {
1691 return this_property_assignments_; 1702 return this_property_assignments_;
1692 } 1703 }
1693 int parameter_count() { return parameter_count_; } 1704 int parameter_count() { return parameter_count_; }
1694 1705
1695 bool AllowsLazyCompilation(); 1706 bool AllowsLazyCompilation();
1696 1707
(...skipping 17 matching lines...) Expand all
1714 1725
1715 private: 1726 private:
1716 Handle<String> name_; 1727 Handle<String> name_;
1717 Scope* scope_; 1728 Scope* scope_;
1718 ZoneList<Statement*>* body_; 1729 ZoneList<Statement*>* body_;
1719 Handle<FixedArray> this_property_assignments_; 1730 Handle<FixedArray> this_property_assignments_;
1720 Handle<String> inferred_name_; 1731 Handle<String> inferred_name_;
1721 1732
1722 int materialized_literal_count_; 1733 int materialized_literal_count_;
1723 int expected_property_count_; 1734 int expected_property_count_;
1735 int handler_count_;
1724 int parameter_count_; 1736 int parameter_count_;
1725 int function_token_position_; 1737 int function_token_position_;
1726 1738
1727 unsigned bitfield_; 1739 unsigned bitfield_;
1728 class HasOnlySimpleThisPropertyAssignments: public BitField<bool, 0, 1> {}; 1740 class HasOnlySimpleThisPropertyAssignments: public BitField<bool, 0, 1> {};
1729 class IsExpression: public BitField<bool, 1, 1> {}; 1741 class IsExpression: public BitField<bool, 1, 1> {};
1730 class IsAnonymous: public BitField<bool, 2, 1> {}; 1742 class IsAnonymous: public BitField<bool, 2, 1> {};
1731 class Pretenure: public BitField<bool, 3, 1> {}; 1743 class Pretenure: public BitField<bool, 3, 1> {};
1732 class HasDuplicateParameters: public BitField<bool, 4, 1> {}; 1744 class HasDuplicateParameters: public BitField<bool, 4, 1> {};
1733 }; 1745 };
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 2167
2156 private: 2168 private:
2157 Isolate* isolate_; 2169 Isolate* isolate_;
2158 bool stack_overflow_; 2170 bool stack_overflow_;
2159 }; 2171 };
2160 2172
2161 2173
2162 } } // namespace v8::internal 2174 } } // namespace v8::internal
2163 2175
2164 #endif // V8_AST_H_ 2176 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698