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

Side by Side Diff: src/ast.h

Issue 6691058: Restart AST node numbering when we enter a function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporate codereview suggestions. Created 9 years, 8 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/full-codegen-arm.cc ('k') | src/hydrogen.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 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 class AstNode: public ZoneObject { 126 class AstNode: public ZoneObject {
127 public: 127 public:
128 #define DECLARE_TYPE_ENUM(type) k##type, 128 #define DECLARE_TYPE_ENUM(type) k##type,
129 enum Type { 129 enum Type {
130 AST_NODE_LIST(DECLARE_TYPE_ENUM) 130 AST_NODE_LIST(DECLARE_TYPE_ENUM)
131 kInvalid = -1 131 kInvalid = -1
132 }; 132 };
133 #undef DECLARE_TYPE_ENUM 133 #undef DECLARE_TYPE_ENUM
134 134
135 static const int kNoNumber = -1; 135 static const int kNoNumber = -1;
136 static const int kFunctionEntryId = 2; // Using 0 could disguise errors.
136 137
137 AstNode() : id_(GetNextId()) { 138 AstNode() : id_(GetNextId()) {
138 Isolate* isolate = Isolate::Current(); 139 Isolate* isolate = Isolate::Current();
139 isolate->set_ast_node_count(isolate->ast_node_count() + 1); 140 isolate->set_ast_node_count(isolate->ast_node_count() + 1);
140 } 141 }
141 142
142 virtual ~AstNode() { } 143 virtual ~AstNode() { }
143 144
144 virtual void Accept(AstVisitor* v) = 0; 145 virtual void Accept(AstVisitor* v) = 0;
145 virtual Type node_type() const { return kInvalid; } 146 virtual Type node_type() const { return kInvalid; }
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 FunctionLiteral(Handle<String> name, 1720 FunctionLiteral(Handle<String> name,
1720 Scope* scope, 1721 Scope* scope,
1721 ZoneList<Statement*>* body, 1722 ZoneList<Statement*>* body,
1722 int materialized_literal_count, 1723 int materialized_literal_count,
1723 int expected_property_count, 1724 int expected_property_count,
1724 bool has_only_simple_this_property_assignments, 1725 bool has_only_simple_this_property_assignments,
1725 Handle<FixedArray> this_property_assignments, 1726 Handle<FixedArray> this_property_assignments,
1726 int num_parameters, 1727 int num_parameters,
1727 int start_position, 1728 int start_position,
1728 int end_position, 1729 int end_position,
1729 bool is_expression, 1730 bool is_expression)
1730 bool contains_loops)
1731 : name_(name), 1731 : name_(name),
1732 scope_(scope), 1732 scope_(scope),
1733 body_(body), 1733 body_(body),
1734 materialized_literal_count_(materialized_literal_count), 1734 materialized_literal_count_(materialized_literal_count),
1735 expected_property_count_(expected_property_count), 1735 expected_property_count_(expected_property_count),
1736 has_only_simple_this_property_assignments_( 1736 has_only_simple_this_property_assignments_(
1737 has_only_simple_this_property_assignments), 1737 has_only_simple_this_property_assignments),
1738 this_property_assignments_(this_property_assignments), 1738 this_property_assignments_(this_property_assignments),
1739 num_parameters_(num_parameters), 1739 num_parameters_(num_parameters),
1740 start_position_(start_position), 1740 start_position_(start_position),
1741 end_position_(end_position), 1741 end_position_(end_position),
1742 is_expression_(is_expression), 1742 is_expression_(is_expression),
1743 contains_loops_(contains_loops),
1744 function_token_position_(RelocInfo::kNoPosition), 1743 function_token_position_(RelocInfo::kNoPosition),
1745 inferred_name_(HEAP->empty_string()), 1744 inferred_name_(HEAP->empty_string()),
1746 pretenure_(false) { } 1745 pretenure_(false) { }
1747 1746
1748 DECLARE_NODE_TYPE(FunctionLiteral) 1747 DECLARE_NODE_TYPE(FunctionLiteral)
1749 1748
1750 Handle<String> name() const { return name_; } 1749 Handle<String> name() const { return name_; }
1751 Scope* scope() const { return scope_; } 1750 Scope* scope() const { return scope_; }
1752 ZoneList<Statement*>* body() const { return body_; } 1751 ZoneList<Statement*>* body() const { return body_; }
1753 void set_function_token_position(int pos) { function_token_position_ = pos; } 1752 void set_function_token_position(int pos) { function_token_position_ = pos; }
1754 int function_token_position() const { return function_token_position_; } 1753 int function_token_position() const { return function_token_position_; }
1755 int start_position() const { return start_position_; } 1754 int start_position() const { return start_position_; }
1756 int end_position() const { return end_position_; } 1755 int end_position() const { return end_position_; }
1757 bool is_expression() const { return is_expression_; } 1756 bool is_expression() const { return is_expression_; }
1758 bool contains_loops() const { return contains_loops_; }
1759 bool strict_mode() const; 1757 bool strict_mode() const;
1760 1758
1761 int materialized_literal_count() { return materialized_literal_count_; } 1759 int materialized_literal_count() { return materialized_literal_count_; }
1762 int expected_property_count() { return expected_property_count_; } 1760 int expected_property_count() { return expected_property_count_; }
1763 bool has_only_simple_this_property_assignments() { 1761 bool has_only_simple_this_property_assignments() {
1764 return has_only_simple_this_property_assignments_; 1762 return has_only_simple_this_property_assignments_;
1765 } 1763 }
1766 Handle<FixedArray> this_property_assignments() { 1764 Handle<FixedArray> this_property_assignments() {
1767 return this_property_assignments_; 1765 return this_property_assignments_;
1768 } 1766 }
(...skipping 19 matching lines...) Expand all
1788 Scope* scope_; 1786 Scope* scope_;
1789 ZoneList<Statement*>* body_; 1787 ZoneList<Statement*>* body_;
1790 int materialized_literal_count_; 1788 int materialized_literal_count_;
1791 int expected_property_count_; 1789 int expected_property_count_;
1792 bool has_only_simple_this_property_assignments_; 1790 bool has_only_simple_this_property_assignments_;
1793 Handle<FixedArray> this_property_assignments_; 1791 Handle<FixedArray> this_property_assignments_;
1794 int num_parameters_; 1792 int num_parameters_;
1795 int start_position_; 1793 int start_position_;
1796 int end_position_; 1794 int end_position_;
1797 bool is_expression_; 1795 bool is_expression_;
1798 bool contains_loops_;
1799 bool strict_mode_; 1796 bool strict_mode_;
1800 int function_token_position_; 1797 int function_token_position_;
1801 Handle<String> inferred_name_; 1798 Handle<String> inferred_name_;
1802 bool pretenure_; 1799 bool pretenure_;
1803 }; 1800 };
1804 1801
1805 1802
1806 class SharedFunctionInfoLiteral: public Expression { 1803 class SharedFunctionInfoLiteral: public Expression {
1807 public: 1804 public:
1808 explicit SharedFunctionInfoLiteral( 1805 explicit SharedFunctionInfoLiteral(
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 2217
2221 private: 2218 private:
2222 Isolate* isolate_; 2219 Isolate* isolate_;
2223 bool stack_overflow_; 2220 bool stack_overflow_;
2224 }; 2221 };
2225 2222
2226 2223
2227 } } // namespace v8::internal 2224 } } // namespace v8::internal
2228 2225
2229 #endif // V8_AST_H_ 2226 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698