OLD | NEW |
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 V(Assignment) \ | 83 V(Assignment) \ |
84 V(Throw) \ | 84 V(Throw) \ |
85 V(Property) \ | 85 V(Property) \ |
86 V(Call) \ | 86 V(Call) \ |
87 V(CallNew) \ | 87 V(CallNew) \ |
88 V(CallRuntime) \ | 88 V(CallRuntime) \ |
89 V(UnaryOperation) \ | 89 V(UnaryOperation) \ |
90 V(CountOperation) \ | 90 V(CountOperation) \ |
91 V(BinaryOperation) \ | 91 V(BinaryOperation) \ |
92 V(CompareOperation) \ | 92 V(CompareOperation) \ |
93 V(CompareToNull) \ | |
94 V(ThisFunction) | 93 V(ThisFunction) |
95 | 94 |
96 #define AST_NODE_LIST(V) \ | 95 #define AST_NODE_LIST(V) \ |
97 V(Declaration) \ | 96 V(Declaration) \ |
98 STATEMENT_NODE_LIST(V) \ | 97 STATEMENT_NODE_LIST(V) \ |
99 EXPRESSION_NODE_LIST(V) | 98 EXPRESSION_NODE_LIST(V) |
100 | 99 |
101 // Forward declarations | 100 // Forward declarations |
102 class BitVector; | 101 class BitVector; |
103 class DefinitionInfo; | 102 class DefinitionInfo; |
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 virtual bool IsInlineable() const; | 1457 virtual bool IsInlineable() const; |
1459 | 1458 |
1460 // Type feedback information. | 1459 // Type feedback information. |
1461 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1460 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
1462 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } | 1461 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } |
1463 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } | 1462 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } |
1464 | 1463 |
1465 // Match special cases. | 1464 // Match special cases. |
1466 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); | 1465 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); |
1467 bool IsLiteralCompareUndefined(Expression** expr); | 1466 bool IsLiteralCompareUndefined(Expression** expr); |
| 1467 bool IsLiteralCompareNull(Expression** expr); |
1468 | 1468 |
1469 private: | 1469 private: |
1470 Token::Value op_; | 1470 Token::Value op_; |
1471 Expression* left_; | 1471 Expression* left_; |
1472 Expression* right_; | 1472 Expression* right_; |
1473 int pos_; | 1473 int pos_; |
1474 | 1474 |
1475 enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY }; | 1475 enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY }; |
1476 CompareTypeFeedback compare_type_; | 1476 CompareTypeFeedback compare_type_; |
1477 }; | 1477 }; |
1478 | 1478 |
1479 | 1479 |
1480 class CompareToNull: public Expression { | |
1481 public: | |
1482 CompareToNull(Isolate* isolate, bool is_strict, Expression* expression) | |
1483 : Expression(isolate), is_strict_(is_strict), expression_(expression) { } | |
1484 | |
1485 DECLARE_NODE_TYPE(CompareToNull) | |
1486 | |
1487 virtual bool IsInlineable() const; | |
1488 | |
1489 bool is_strict() const { return is_strict_; } | |
1490 Token::Value op() const { return is_strict_ ? Token::EQ_STRICT : Token::EQ; } | |
1491 Expression* expression() const { return expression_; } | |
1492 | |
1493 private: | |
1494 bool is_strict_; | |
1495 Expression* expression_; | |
1496 }; | |
1497 | |
1498 | |
1499 class Conditional: public Expression { | 1480 class Conditional: public Expression { |
1500 public: | 1481 public: |
1501 Conditional(Isolate* isolate, | 1482 Conditional(Isolate* isolate, |
1502 Expression* condition, | 1483 Expression* condition, |
1503 Expression* then_expression, | 1484 Expression* then_expression, |
1504 Expression* else_expression, | 1485 Expression* else_expression, |
1505 int then_expression_position, | 1486 int then_expression_position, |
1506 int else_expression_position) | 1487 int else_expression_position) |
1507 : Expression(isolate), | 1488 : Expression(isolate), |
1508 condition_(condition), | 1489 condition_(condition), |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 | 2121 |
2141 private: | 2122 private: |
2142 Isolate* isolate_; | 2123 Isolate* isolate_; |
2143 bool stack_overflow_; | 2124 bool stack_overflow_; |
2144 }; | 2125 }; |
2145 | 2126 |
2146 | 2127 |
2147 } } // namespace v8::internal | 2128 } } // namespace v8::internal |
2148 | 2129 |
2149 #endif // V8_AST_H_ | 2130 #endif // V8_AST_H_ |
OLD | NEW |