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

Side by Side Diff: src/ast.h

Issue 546006: Some cleanup of the toplevel code generator:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 kTestValue 180 kTestValue
181 }; 181 };
182 182
183 Expression() : context_(kUninitialized) {} 183 Expression() : context_(kUninitialized) {}
184 184
185 virtual Expression* AsExpression() { return this; } 185 virtual Expression* AsExpression() { return this; }
186 186
187 virtual bool IsValidJSON() { return false; } 187 virtual bool IsValidJSON() { return false; }
188 virtual bool IsValidLeftHandSide() { return false; } 188 virtual bool IsValidLeftHandSide() { return false; }
189 189
190 // Symbols that cannot be parsed as array indices are considered property
191 // names. We do not treat symbols that can be array indexes as property
192 // names because [] for string objects is handled only by keyed ICs.
193 virtual bool IsPropertyName() { return false; }
194
190 // Mark the expression as being compiled as an expression 195 // Mark the expression as being compiled as an expression
191 // statement. This is used to transform postfix increments to 196 // statement. This is used to transform postfix increments to
192 // (faster) prefix increments. 197 // (faster) prefix increments.
193 virtual void MarkAsStatement() { /* do nothing */ } 198 virtual void MarkAsStatement() { /* do nothing */ }
194 199
195 // Static type information for this expression. 200 // Static type information for this expression.
196 StaticType* type() { return &type_; } 201 StaticType* type() { return &type_; }
197 202
198 Context context() { return context_; } 203 Context context() { return context_; }
199 void set_context(Context context) { context_ = context; } 204 void set_context(Context context) { context_ = context; }
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 // Type testing & conversion. 705 // Type testing & conversion.
701 virtual Literal* AsLiteral() { return this; } 706 virtual Literal* AsLiteral() { return this; }
702 707
703 // Check if this literal is identical to the other literal. 708 // Check if this literal is identical to the other literal.
704 bool IsIdenticalTo(const Literal* other) const { 709 bool IsIdenticalTo(const Literal* other) const {
705 return handle_.is_identical_to(other->handle_); 710 return handle_.is_identical_to(other->handle_);
706 } 711 }
707 712
708 virtual bool IsValidJSON() { return true; } 713 virtual bool IsValidJSON() { return true; }
709 714
715 virtual bool IsPropertyName() {
716 if (handle_->IsSymbol()) {
717 uint32_t ignored;
718 return !String::cast(*handle_)->AsArrayIndex(&ignored);
719 }
720 return false;
721 }
722
710 // Identity testers. 723 // Identity testers.
711 bool IsNull() const { return handle_.is_identical_to(Factory::null_value()); } 724 bool IsNull() const { return handle_.is_identical_to(Factory::null_value()); }
712 bool IsTrue() const { return handle_.is_identical_to(Factory::true_value()); } 725 bool IsTrue() const { return handle_.is_identical_to(Factory::true_value()); }
713 bool IsFalse() const { 726 bool IsFalse() const {
714 return handle_.is_identical_to(Factory::false_value()); 727 return handle_.is_identical_to(Factory::false_value());
715 } 728 }
716 729
717 Handle<Object> handle() const { return handle_; } 730 Handle<Object> handle() const { return handle_; }
718 731
719 private: 732 private:
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 #undef DEF_VISIT 1809 #undef DEF_VISIT
1797 1810
1798 private: 1811 private:
1799 bool stack_overflow_; 1812 bool stack_overflow_;
1800 }; 1813 };
1801 1814
1802 1815
1803 } } // namespace v8::internal 1816 } } // namespace v8::internal
1804 1817
1805 #endif // V8_AST_H_ 1818 #endif // V8_AST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698