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