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 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 ZoneList<Expression*>* arguments_; | 1281 ZoneList<Expression*>* arguments_; |
1282 }; | 1282 }; |
1283 | 1283 |
1284 | 1284 |
1285 class UnaryOperation: public Expression { | 1285 class UnaryOperation: public Expression { |
1286 public: | 1286 public: |
1287 UnaryOperation(Isolate* isolate, | 1287 UnaryOperation(Isolate* isolate, |
1288 Token::Value op, | 1288 Token::Value op, |
1289 Expression* expression, | 1289 Expression* expression, |
1290 int pos) | 1290 int pos) |
1291 : Expression(isolate), op_(op), expression_(expression), pos_(pos) { | 1291 : Expression(isolate), |
| 1292 op_(op), |
| 1293 expression_(expression), |
| 1294 pos_(pos), |
| 1295 materialize_true_id_(AstNode::kNoNumber), |
| 1296 materialize_false_id_(AstNode::kNoNumber) { |
1292 ASSERT(Token::IsUnaryOp(op)); | 1297 ASSERT(Token::IsUnaryOp(op)); |
| 1298 if (op == Token::NOT) { |
| 1299 materialize_true_id_ = GetNextId(isolate); |
| 1300 materialize_false_id_ = GetNextId(isolate); |
| 1301 } |
1293 } | 1302 } |
1294 | 1303 |
1295 DECLARE_NODE_TYPE(UnaryOperation) | 1304 DECLARE_NODE_TYPE(UnaryOperation) |
1296 | 1305 |
1297 virtual bool IsInlineable() const; | 1306 virtual bool IsInlineable() const; |
1298 | 1307 |
1299 virtual bool ResultOverwriteAllowed(); | 1308 virtual bool ResultOverwriteAllowed(); |
1300 | 1309 |
1301 Token::Value op() const { return op_; } | 1310 Token::Value op() const { return op_; } |
1302 Expression* expression() const { return expression_; } | 1311 Expression* expression() const { return expression_; } |
1303 virtual int position() const { return pos_; } | 1312 virtual int position() const { return pos_; } |
1304 | 1313 |
| 1314 int MaterializeTrueId() { return materialize_true_id_; } |
| 1315 int MaterializeFalseId() { return materialize_false_id_; } |
| 1316 |
1305 private: | 1317 private: |
1306 Token::Value op_; | 1318 Token::Value op_; |
1307 Expression* expression_; | 1319 Expression* expression_; |
1308 int pos_; | 1320 int pos_; |
| 1321 |
| 1322 // For unary not (Token::NOT), the AST ids where true and false will |
| 1323 // actually be materialized, respectively. |
| 1324 int materialize_true_id_; |
| 1325 int materialize_false_id_; |
1309 }; | 1326 }; |
1310 | 1327 |
1311 | 1328 |
1312 class BinaryOperation: public Expression { | 1329 class BinaryOperation: public Expression { |
1313 public: | 1330 public: |
1314 BinaryOperation(Isolate* isolate, | 1331 BinaryOperation(Isolate* isolate, |
1315 Token::Value op, | 1332 Token::Value op, |
1316 Expression* left, | 1333 Expression* left, |
1317 Expression* right, | 1334 Expression* right, |
1318 int pos) | 1335 int pos) |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 | 2104 |
2088 private: | 2105 private: |
2089 Isolate* isolate_; | 2106 Isolate* isolate_; |
2090 bool stack_overflow_; | 2107 bool stack_overflow_; |
2091 }; | 2108 }; |
2092 | 2109 |
2093 | 2110 |
2094 } } // namespace v8::internal | 2111 } } // namespace v8::internal |
2095 | 2112 |
2096 #endif // V8_AST_H_ | 2113 #endif // V8_AST_H_ |
OLD | NEW |