| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 198 |
| 199 // Mark the expression as being compiled as an expression | 199 // Mark the expression as being compiled as an expression |
| 200 // statement. This is used to transform postfix increments to | 200 // statement. This is used to transform postfix increments to |
| 201 // (faster) prefix increments. | 201 // (faster) prefix increments. |
| 202 virtual void MarkAsStatement() { /* do nothing */ } | 202 virtual void MarkAsStatement() { /* do nothing */ } |
| 203 | 203 |
| 204 // True iff the result can be safely overwritten (to avoid allocation). | 204 // True iff the result can be safely overwritten (to avoid allocation). |
| 205 // False for operations that can return one of their operands. | 205 // False for operations that can return one of their operands. |
| 206 virtual bool ResultOverwriteAllowed() { return false; } | 206 virtual bool ResultOverwriteAllowed() { return false; } |
| 207 | 207 |
| 208 // True iff the expression is a literal represented as a smi. |
| 209 virtual bool IsSmiLiteral() { return false; } |
| 210 |
| 208 // Static type information for this expression. | 211 // Static type information for this expression. |
| 209 StaticType* type() { return &type_; } | 212 StaticType* type() { return &type_; } |
| 210 | 213 |
| 211 // True if the expression is a loop condition. | 214 // True if the expression is a loop condition. |
| 212 bool is_loop_condition() const { | 215 bool is_loop_condition() const { |
| 213 return LoopConditionField::decode(bitfields_); | 216 return LoopConditionField::decode(bitfields_); |
| 214 } | 217 } |
| 215 void set_is_loop_condition(bool flag) { | 218 void set_is_loop_condition(bool flag) { |
| 216 bitfields_ = (bitfields_ & ~LoopConditionField::mask()) | | 219 bitfields_ = (bitfields_ & ~LoopConditionField::mask()) | |
| 217 LoopConditionField::encode(flag); | 220 LoopConditionField::encode(flag); |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 virtual EmptyStatement* AsEmptyStatement() { return this; } | 771 virtual EmptyStatement* AsEmptyStatement() { return this; } |
| 769 }; | 772 }; |
| 770 | 773 |
| 771 | 774 |
| 772 class Literal: public Expression { | 775 class Literal: public Expression { |
| 773 public: | 776 public: |
| 774 explicit Literal(Handle<Object> handle) : handle_(handle) { } | 777 explicit Literal(Handle<Object> handle) : handle_(handle) { } |
| 775 | 778 |
| 776 virtual void Accept(AstVisitor* v); | 779 virtual void Accept(AstVisitor* v); |
| 777 virtual bool IsTrivial() { return true; } | 780 virtual bool IsTrivial() { return true; } |
| 781 virtual bool IsSmiLiteral() { return handle_->IsSmi(); } |
| 778 | 782 |
| 779 // Type testing & conversion. | 783 // Type testing & conversion. |
| 780 virtual Literal* AsLiteral() { return this; } | 784 virtual Literal* AsLiteral() { return this; } |
| 781 | 785 |
| 782 // Check if this literal is identical to the other literal. | 786 // Check if this literal is identical to the other literal. |
| 783 bool IsIdenticalTo(const Literal* other) const { | 787 bool IsIdenticalTo(const Literal* other) const { |
| 784 return handle_.is_identical_to(other->handle_); | 788 return handle_.is_identical_to(other->handle_); |
| 785 } | 789 } |
| 786 | 790 |
| 787 virtual bool IsPropertyName() { | 791 virtual bool IsPropertyName() { |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1922 AST_NODE_LIST(DEF_VISIT) | 1926 AST_NODE_LIST(DEF_VISIT) |
| 1923 #undef DEF_VISIT | 1927 #undef DEF_VISIT |
| 1924 | 1928 |
| 1925 private: | 1929 private: |
| 1926 bool stack_overflow_; | 1930 bool stack_overflow_; |
| 1927 }; | 1931 }; |
| 1928 | 1932 |
| 1929 } } // namespace v8::internal | 1933 } } // namespace v8::internal |
| 1930 | 1934 |
| 1931 #endif // V8_AST_H_ | 1935 #endif // V8_AST_H_ |
| OLD | NEW |