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 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 Expression* expression_; | 1391 Expression* expression_; |
1392 }; | 1392 }; |
1393 | 1393 |
1394 | 1394 |
1395 class BinaryOperation: public Expression { | 1395 class BinaryOperation: public Expression { |
1396 public: | 1396 public: |
1397 BinaryOperation(Token::Value op, | 1397 BinaryOperation(Token::Value op, |
1398 Expression* left, | 1398 Expression* left, |
1399 Expression* right, | 1399 Expression* right, |
1400 int pos) | 1400 int pos) |
1401 : op_(op), left_(left), right_(right), pos_(pos), is_smi_only_(false) { | 1401 : op_(op), left_(left), right_(right), pos_(pos) { |
1402 ASSERT(Token::IsBinaryOp(op)); | 1402 ASSERT(Token::IsBinaryOp(op)); |
1403 right_id_ = (op == Token::AND || op == Token::OR) | 1403 right_id_ = (op == Token::AND || op == Token::OR) |
1404 ? static_cast<int>(GetNextId()) | 1404 ? static_cast<int>(GetNextId()) |
1405 : AstNode::kNoNumber; | 1405 : AstNode::kNoNumber; |
1406 } | 1406 } |
1407 | 1407 |
1408 // Create the binary operation corresponding to a compound assignment. | 1408 // Create the binary operation corresponding to a compound assignment. |
1409 explicit BinaryOperation(Assignment* assignment); | 1409 explicit BinaryOperation(Assignment* assignment); |
1410 | 1410 |
1411 DECLARE_NODE_TYPE(BinaryOperation) | 1411 DECLARE_NODE_TYPE(BinaryOperation) |
1412 | 1412 |
1413 virtual bool IsInlineable() const; | 1413 virtual bool IsInlineable() const; |
1414 | 1414 |
1415 virtual bool ResultOverwriteAllowed(); | 1415 virtual bool ResultOverwriteAllowed(); |
1416 | 1416 |
1417 Token::Value op() const { return op_; } | 1417 Token::Value op() const { return op_; } |
1418 Expression* left() const { return left_; } | 1418 Expression* left() const { return left_; } |
1419 Expression* right() const { return right_; } | 1419 Expression* right() const { return right_; } |
1420 int position() const { return pos_; } | 1420 int position() const { return pos_; } |
1421 | 1421 |
1422 // Type feedback information. | |
1423 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | |
1424 bool IsSmiOnly() const { return is_smi_only_; } | |
1425 | |
1426 // Bailout support. | 1422 // Bailout support. |
1427 int RightId() const { return right_id_; } | 1423 int RightId() const { return right_id_; } |
1428 | 1424 |
1429 private: | 1425 private: |
1430 Token::Value op_; | 1426 Token::Value op_; |
1431 Expression* left_; | 1427 Expression* left_; |
1432 Expression* right_; | 1428 Expression* right_; |
1433 int pos_; | 1429 int pos_; |
1434 bool is_smi_only_; | |
1435 // The short-circuit logical operations have an AST ID for their | 1430 // The short-circuit logical operations have an AST ID for their |
1436 // right-hand subexpression. | 1431 // right-hand subexpression. |
1437 int right_id_; | 1432 int right_id_; |
1438 }; | 1433 }; |
1439 | 1434 |
1440 | 1435 |
1441 class IncrementOperation: public Expression { | 1436 class IncrementOperation: public Expression { |
1442 public: | 1437 public: |
1443 IncrementOperation(Token::Value op, Expression* expr) | 1438 IncrementOperation(Token::Value op, Expression* expr) |
1444 : op_(op), expression_(expr) { | 1439 : op_(op), expression_(expr) { |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 AST_NODE_LIST(DEF_VISIT) | 2168 AST_NODE_LIST(DEF_VISIT) |
2174 #undef DEF_VISIT | 2169 #undef DEF_VISIT |
2175 | 2170 |
2176 private: | 2171 private: |
2177 bool stack_overflow_; | 2172 bool stack_overflow_; |
2178 }; | 2173 }; |
2179 | 2174 |
2180 } } // namespace v8::internal | 2175 } } // namespace v8::internal |
2181 | 2176 |
2182 #endif // V8_AST_H_ | 2177 #endif // V8_AST_H_ |
OLD | NEW |