OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_AST_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 330 |
331 // Helpers for ToBoolean conversion. | 331 // Helpers for ToBoolean conversion. |
332 virtual bool ToBooleanIsTrue() const { return false; } | 332 virtual bool ToBooleanIsTrue() const { return false; } |
333 virtual bool ToBooleanIsFalse() const { return false; } | 333 virtual bool ToBooleanIsFalse() const { return false; } |
334 | 334 |
335 // Symbols that cannot be parsed as array indices are considered property | 335 // Symbols that cannot be parsed as array indices are considered property |
336 // names. We do not treat symbols that can be array indexes as property | 336 // names. We do not treat symbols that can be array indexes as property |
337 // names because [] for string objects is handled only by keyed ICs. | 337 // names because [] for string objects is handled only by keyed ICs. |
338 virtual bool IsPropertyName() const { return false; } | 338 virtual bool IsPropertyName() const { return false; } |
339 | 339 |
340 // True iff the result can be safely overwritten (to avoid allocation). | |
341 // False for operations that can return one of their operands. | |
342 virtual bool ResultOverwriteAllowed() const { return false; } | |
343 | |
344 // True iff the expression is a literal represented as a smi. | 340 // True iff the expression is a literal represented as a smi. |
345 bool IsSmiLiteral() const; | 341 bool IsSmiLiteral() const; |
346 | 342 |
347 // True iff the expression is a string literal. | 343 // True iff the expression is a string literal. |
348 bool IsStringLiteral() const; | 344 bool IsStringLiteral() const; |
349 | 345 |
350 // True iff the expression is the null literal. | 346 // True iff the expression is the null literal. |
351 bool IsNullLiteral() const; | 347 bool IsNullLiteral() const; |
352 | 348 |
353 // True if we can prove that the expression is the undefined literal. | 349 // True if we can prove that the expression is the undefined literal. |
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 | 2067 |
2072 Token::Value op_; | 2068 Token::Value op_; |
2073 Expression* expression_; | 2069 Expression* expression_; |
2074 }; | 2070 }; |
2075 | 2071 |
2076 | 2072 |
2077 class BinaryOperation FINAL : public Expression { | 2073 class BinaryOperation FINAL : public Expression { |
2078 public: | 2074 public: |
2079 DECLARE_NODE_TYPE(BinaryOperation) | 2075 DECLARE_NODE_TYPE(BinaryOperation) |
2080 | 2076 |
2081 bool ResultOverwriteAllowed() const OVERRIDE; | |
2082 | |
2083 Token::Value op() const { return static_cast<Token::Value>(op_); } | 2077 Token::Value op() const { return static_cast<Token::Value>(op_); } |
2084 Expression* left() const { return left_; } | 2078 Expression* left() const { return left_; } |
2085 Expression* right() const { return right_; } | 2079 Expression* right() const { return right_; } |
2086 Handle<AllocationSite> allocation_site() const { return allocation_site_; } | 2080 Handle<AllocationSite> allocation_site() const { return allocation_site_; } |
2087 void set_allocation_site(Handle<AllocationSite> allocation_site) { | 2081 void set_allocation_site(Handle<AllocationSite> allocation_site) { |
2088 allocation_site_ = allocation_site; | 2082 allocation_site_ = allocation_site; |
2089 } | 2083 } |
2090 | 2084 |
2091 // The short-circuit logical operations need an AST ID for their | 2085 // The short-circuit logical operations need an AST ID for their |
2092 // right-hand subexpression. | 2086 // right-hand subexpression. |
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3558 | 3552 |
3559 private: | 3553 private: |
3560 Zone* zone_; | 3554 Zone* zone_; |
3561 AstValueFactory* ast_value_factory_; | 3555 AstValueFactory* ast_value_factory_; |
3562 }; | 3556 }; |
3563 | 3557 |
3564 | 3558 |
3565 } } // namespace v8::internal | 3559 } } // namespace v8::internal |
3566 | 3560 |
3567 #endif // V8_AST_H_ | 3561 #endif // V8_AST_H_ |
OLD | NEW |