| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // Evaluated for its side effects. | 214 // Evaluated for its side effects. |
| 215 kEffect, | 215 kEffect, |
| 216 // Evaluated for its value (and side effects). | 216 // Evaluated for its value (and side effects). |
| 217 kValue, | 217 kValue, |
| 218 // Evaluated for control flow (and side effects). | 218 // Evaluated for control flow (and side effects). |
| 219 kTest | 219 kTest |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 Expression() : bitfields_(0) {} | 222 Expression() : bitfields_(0) {} |
| 223 | 223 |
| 224 virtual int position() const { |
| 225 UNREACHABLE(); |
| 226 return 0; |
| 227 } |
| 228 |
| 224 virtual Expression* AsExpression() { return this; } | 229 virtual Expression* AsExpression() { return this; } |
| 225 | 230 |
| 226 virtual bool IsTrivial() { return false; } | 231 virtual bool IsTrivial() { return false; } |
| 227 virtual bool IsValidLeftHandSide() { return false; } | 232 virtual bool IsValidLeftHandSide() { return false; } |
| 228 | 233 |
| 229 // Helpers for ToBoolean conversion. | 234 // Helpers for ToBoolean conversion. |
| 230 virtual bool ToBooleanIsTrue() { return false; } | 235 virtual bool ToBooleanIsTrue() { return false; } |
| 231 virtual bool ToBooleanIsFalse() { return false; } | 236 virtual bool ToBooleanIsFalse() { return false; } |
| 232 | 237 |
| 233 // Symbols that cannot be parsed as array indices are considered property | 238 // Symbols that cannot be parsed as array indices are considered property |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 315 } |
| 311 | 316 |
| 312 // How many bitwise logical or shift operators are used in this expression? | 317 // How many bitwise logical or shift operators are used in this expression? |
| 313 int num_bit_ops() { return NumBitOpsField::decode(bitfields_); } | 318 int num_bit_ops() { return NumBitOpsField::decode(bitfields_); } |
| 314 void set_num_bit_ops(int num_bit_ops) { | 319 void set_num_bit_ops(int num_bit_ops) { |
| 315 bitfields_ &= ~NumBitOpsField::mask(); | 320 bitfields_ &= ~NumBitOpsField::mask(); |
| 316 num_bit_ops = Min(num_bit_ops, kMaxNumBitOps); | 321 num_bit_ops = Min(num_bit_ops, kMaxNumBitOps); |
| 317 bitfields_ |= NumBitOpsField::encode(num_bit_ops); | 322 bitfields_ |= NumBitOpsField::encode(num_bit_ops); |
| 318 } | 323 } |
| 319 | 324 |
| 325 ExternalArrayType external_array_type() const { |
| 326 return ExternalArrayTypeField::decode(bitfields_); |
| 327 } |
| 328 void set_external_array_type(ExternalArrayType array_type) { |
| 329 bitfields_ &= ~ExternalArrayTypeField::mask(); |
| 330 bitfields_ |= ExternalArrayTypeField::encode(array_type); |
| 331 } |
| 332 |
| 320 private: | 333 private: |
| 321 static const int kMaxNumBitOps = (1 << 5) - 1; | 334 static const int kMaxNumBitOps = (1 << 5) - 1; |
| 322 | 335 |
| 323 uint32_t bitfields_; | 336 uint32_t bitfields_; |
| 324 StaticType type_; | 337 StaticType type_; |
| 325 | 338 |
| 326 // Using template BitField<type, start, size>. | 339 // Using template BitField<type, start, size>. |
| 327 class SideEffectFreeField : public BitField<bool, 0, 1> {}; | 340 class SideEffectFreeField : public BitField<bool, 0, 1> {}; |
| 328 class NoNegativeZeroField : public BitField<bool, 1, 1> {}; | 341 class NoNegativeZeroField : public BitField<bool, 1, 1> {}; |
| 329 class ToInt32Field : public BitField<bool, 2, 1> {}; | 342 class ToInt32Field : public BitField<bool, 2, 1> {}; |
| 330 class NumBitOpsField : public BitField<int, 3, 5> {}; | 343 class NumBitOpsField : public BitField<int, 3, 5> {}; |
| 331 class LoopConditionField: public BitField<bool, 8, 1> {}; | 344 class LoopConditionField: public BitField<bool, 8, 1> {}; |
| 345 class ExternalArrayTypeField: public BitField<ExternalArrayType, 9, 4> {}; |
| 332 }; | 346 }; |
| 333 | 347 |
| 334 | 348 |
| 335 /** | 349 /** |
| 336 * A sentinel used during pre parsing that represents some expression | 350 * A sentinel used during pre parsing that represents some expression |
| 337 * that is a valid left hand side without having to actually build | 351 * that is a valid left hand side without having to actually build |
| 338 * the expression. | 352 * the expression. |
| 339 */ | 353 */ |
| 340 class ValidLeftHandSideSentinel: public Expression { | 354 class ValidLeftHandSideSentinel: public Expression { |
| 341 public: | 355 public: |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 CaseClause(Expression* label, ZoneList<Statement*>* statements, int pos); | 702 CaseClause(Expression* label, ZoneList<Statement*>* statements, int pos); |
| 689 | 703 |
| 690 bool is_default() const { return label_ == NULL; } | 704 bool is_default() const { return label_ == NULL; } |
| 691 Expression* label() const { | 705 Expression* label() const { |
| 692 CHECK(!is_default()); | 706 CHECK(!is_default()); |
| 693 return label_; | 707 return label_; |
| 694 } | 708 } |
| 695 JumpTarget* body_target() { return &body_target_; } | 709 JumpTarget* body_target() { return &body_target_; } |
| 696 ZoneList<Statement*>* statements() const { return statements_; } | 710 ZoneList<Statement*>* statements() const { return statements_; } |
| 697 | 711 |
| 698 int position() { return position_; } | 712 int position() const { return position_; } |
| 699 void set_position(int pos) { position_ = pos; } | 713 void set_position(int pos) { position_ = pos; } |
| 700 | 714 |
| 701 int EntryId() { return entry_id_; } | 715 int EntryId() { return entry_id_; } |
| 702 | 716 |
| 703 // Type feedback information. | 717 // Type feedback information. |
| 704 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 718 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 705 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } | 719 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } |
| 706 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } | 720 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } |
| 707 | 721 |
| 708 private: | 722 private: |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 is_function_prototype_(false), | 1252 is_function_prototype_(false), |
| 1239 is_arguments_access_(false) { } | 1253 is_arguments_access_(false) { } |
| 1240 | 1254 |
| 1241 DECLARE_NODE_TYPE(Property) | 1255 DECLARE_NODE_TYPE(Property) |
| 1242 | 1256 |
| 1243 virtual bool IsValidLeftHandSide() { return true; } | 1257 virtual bool IsValidLeftHandSide() { return true; } |
| 1244 virtual bool IsInlineable() const; | 1258 virtual bool IsInlineable() const; |
| 1245 | 1259 |
| 1246 Expression* obj() const { return obj_; } | 1260 Expression* obj() const { return obj_; } |
| 1247 Expression* key() const { return key_; } | 1261 Expression* key() const { return key_; } |
| 1248 int position() const { return pos_; } | 1262 virtual int position() const { return pos_; } |
| 1249 bool is_synthetic() const { return type_ == SYNTHETIC; } | 1263 bool is_synthetic() const { return type_ == SYNTHETIC; } |
| 1250 | 1264 |
| 1251 bool IsStringLength() const { return is_string_length_; } | 1265 bool IsStringLength() const { return is_string_length_; } |
| 1252 bool IsStringAccess() const { return is_string_access_; } | 1266 bool IsStringAccess() const { return is_string_access_; } |
| 1253 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1267 bool IsFunctionPrototype() const { return is_function_prototype_; } |
| 1254 | 1268 |
| 1255 // Marks that this is actually an argument rewritten to a keyed property | 1269 // Marks that this is actually an argument rewritten to a keyed property |
| 1256 // accessing the argument through the arguments shadow object. | 1270 // accessing the argument through the arguments shadow object. |
| 1257 void set_is_arguments_access(bool is_arguments_access) { | 1271 void set_is_arguments_access(bool is_arguments_access) { |
| 1258 is_arguments_access_ = is_arguments_access; | 1272 is_arguments_access_ = is_arguments_access; |
| 1259 } | 1273 } |
| 1260 bool is_arguments_access() const { return is_arguments_access_; } | 1274 bool is_arguments_access() const { return is_arguments_access_; } |
| 1261 | 1275 |
| 1262 ExternalArrayType GetExternalArrayType() const { return array_type_; } | |
| 1263 void SetExternalArrayType(ExternalArrayType array_type) { | |
| 1264 array_type_ = array_type; | |
| 1265 } | |
| 1266 | |
| 1267 // Type feedback information. | 1276 // Type feedback information. |
| 1268 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1277 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1269 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1278 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1270 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1279 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
| 1271 virtual bool IsArrayLength() { return is_array_length_; } | 1280 virtual bool IsArrayLength() { return is_array_length_; } |
| 1272 virtual Handle<Map> GetMonomorphicReceiverType() { | 1281 virtual Handle<Map> GetMonomorphicReceiverType() { |
| 1273 return monomorphic_receiver_type_; | 1282 return monomorphic_receiver_type_; |
| 1274 } | 1283 } |
| 1275 | 1284 |
| 1276 private: | 1285 private: |
| 1277 Expression* obj_; | 1286 Expression* obj_; |
| 1278 Expression* key_; | 1287 Expression* key_; |
| 1279 int pos_; | 1288 int pos_; |
| 1280 Type type_; | 1289 Type type_; |
| 1281 | 1290 |
| 1282 ZoneMapList* receiver_types_; | 1291 ZoneMapList* receiver_types_; |
| 1283 bool is_monomorphic_ : 1; | 1292 bool is_monomorphic_ : 1; |
| 1284 bool is_array_length_ : 1; | 1293 bool is_array_length_ : 1; |
| 1285 bool is_string_length_ : 1; | 1294 bool is_string_length_ : 1; |
| 1286 bool is_string_access_ : 1; | 1295 bool is_string_access_ : 1; |
| 1287 bool is_function_prototype_ : 1; | 1296 bool is_function_prototype_ : 1; |
| 1288 bool is_arguments_access_ : 1; | 1297 bool is_arguments_access_ : 1; |
| 1289 Handle<Map> monomorphic_receiver_type_; | 1298 Handle<Map> monomorphic_receiver_type_; |
| 1290 ExternalArrayType array_type_; | |
| 1291 }; | 1299 }; |
| 1292 | 1300 |
| 1293 | 1301 |
| 1294 class Call: public Expression { | 1302 class Call: public Expression { |
| 1295 public: | 1303 public: |
| 1296 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) | 1304 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) |
| 1297 : expression_(expression), | 1305 : expression_(expression), |
| 1298 arguments_(arguments), | 1306 arguments_(arguments), |
| 1299 pos_(pos), | 1307 pos_(pos), |
| 1300 is_monomorphic_(false), | 1308 is_monomorphic_(false), |
| 1301 check_type_(RECEIVER_MAP_CHECK), | 1309 check_type_(RECEIVER_MAP_CHECK), |
| 1302 receiver_types_(NULL), | 1310 receiver_types_(NULL), |
| 1303 return_id_(GetNextId()) { | 1311 return_id_(GetNextId()) { |
| 1304 } | 1312 } |
| 1305 | 1313 |
| 1306 DECLARE_NODE_TYPE(Call) | 1314 DECLARE_NODE_TYPE(Call) |
| 1307 | 1315 |
| 1308 virtual bool IsInlineable() const; | 1316 virtual bool IsInlineable() const; |
| 1309 | 1317 |
| 1310 Expression* expression() const { return expression_; } | 1318 Expression* expression() const { return expression_; } |
| 1311 ZoneList<Expression*>* arguments() const { return arguments_; } | 1319 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1312 int position() { return pos_; } | 1320 virtual int position() const { return pos_; } |
| 1313 | 1321 |
| 1314 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1322 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1315 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1323 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
| 1316 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1324 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1317 CheckType check_type() const { return check_type_; } | 1325 CheckType check_type() const { return check_type_; } |
| 1318 Handle<JSFunction> target() { return target_; } | 1326 Handle<JSFunction> target() { return target_; } |
| 1319 Handle<JSObject> holder() { return holder_; } | 1327 Handle<JSObject> holder() { return holder_; } |
| 1320 Handle<JSGlobalPropertyCell> cell() { return cell_; } | 1328 Handle<JSGlobalPropertyCell> cell() { return cell_; } |
| 1321 | 1329 |
| 1322 bool ComputeTarget(Handle<Map> type, Handle<String> name); | 1330 bool ComputeTarget(Handle<Map> type, Handle<String> name); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 public: | 1388 public: |
| 1381 CallNew(Expression* expression, ZoneList<Expression*>* arguments, int pos) | 1389 CallNew(Expression* expression, ZoneList<Expression*>* arguments, int pos) |
| 1382 : expression_(expression), arguments_(arguments), pos_(pos) { } | 1390 : expression_(expression), arguments_(arguments), pos_(pos) { } |
| 1383 | 1391 |
| 1384 DECLARE_NODE_TYPE(CallNew) | 1392 DECLARE_NODE_TYPE(CallNew) |
| 1385 | 1393 |
| 1386 virtual bool IsInlineable() const; | 1394 virtual bool IsInlineable() const; |
| 1387 | 1395 |
| 1388 Expression* expression() const { return expression_; } | 1396 Expression* expression() const { return expression_; } |
| 1389 ZoneList<Expression*>* arguments() const { return arguments_; } | 1397 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1390 int position() { return pos_; } | 1398 virtual int position() const { return pos_; } |
| 1391 | 1399 |
| 1392 private: | 1400 private: |
| 1393 Expression* expression_; | 1401 Expression* expression_; |
| 1394 ZoneList<Expression*>* arguments_; | 1402 ZoneList<Expression*>* arguments_; |
| 1395 int pos_; | 1403 int pos_; |
| 1396 }; | 1404 }; |
| 1397 | 1405 |
| 1398 | 1406 |
| 1399 // The CallRuntime class does not represent any official JavaScript | 1407 // The CallRuntime class does not represent any official JavaScript |
| 1400 // language construct. Instead it is used to call a C or JS function | 1408 // language construct. Instead it is used to call a C or JS function |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 | 1471 |
| 1464 DECLARE_NODE_TYPE(BinaryOperation) | 1472 DECLARE_NODE_TYPE(BinaryOperation) |
| 1465 | 1473 |
| 1466 virtual bool IsInlineable() const; | 1474 virtual bool IsInlineable() const; |
| 1467 | 1475 |
| 1468 virtual bool ResultOverwriteAllowed(); | 1476 virtual bool ResultOverwriteAllowed(); |
| 1469 | 1477 |
| 1470 Token::Value op() const { return op_; } | 1478 Token::Value op() const { return op_; } |
| 1471 Expression* left() const { return left_; } | 1479 Expression* left() const { return left_; } |
| 1472 Expression* right() const { return right_; } | 1480 Expression* right() const { return right_; } |
| 1473 int position() const { return pos_; } | 1481 virtual int position() const { return pos_; } |
| 1474 | 1482 |
| 1475 // Bailout support. | 1483 // Bailout support. |
| 1476 int RightId() const { return right_id_; } | 1484 int RightId() const { return right_id_; } |
| 1477 | 1485 |
| 1478 private: | 1486 private: |
| 1479 Token::Value op_; | 1487 Token::Value op_; |
| 1480 Expression* left_; | 1488 Expression* left_; |
| 1481 Expression* right_; | 1489 Expression* right_; |
| 1482 int pos_; | 1490 int pos_; |
| 1483 // The short-circuit logical operations have an AST ID for their | 1491 // The short-circuit logical operations have an AST ID for their |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1500 | 1508 |
| 1501 bool is_prefix() const { return is_prefix_; } | 1509 bool is_prefix() const { return is_prefix_; } |
| 1502 bool is_postfix() const { return !is_prefix_; } | 1510 bool is_postfix() const { return !is_prefix_; } |
| 1503 | 1511 |
| 1504 Token::Value op() const { return op_; } | 1512 Token::Value op() const { return op_; } |
| 1505 Token::Value binary_op() { | 1513 Token::Value binary_op() { |
| 1506 return (op() == Token::INC) ? Token::ADD : Token::SUB; | 1514 return (op() == Token::INC) ? Token::ADD : Token::SUB; |
| 1507 } | 1515 } |
| 1508 | 1516 |
| 1509 Expression* expression() const { return expression_; } | 1517 Expression* expression() const { return expression_; } |
| 1510 int position() const { return pos_; } | 1518 virtual int position() const { return pos_; } |
| 1511 | 1519 |
| 1512 virtual void MarkAsStatement() { is_prefix_ = true; } | 1520 virtual void MarkAsStatement() { is_prefix_ = true; } |
| 1513 | 1521 |
| 1514 virtual bool IsInlineable() const; | 1522 virtual bool IsInlineable() const; |
| 1515 | 1523 |
| 1524 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1525 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1526 virtual Handle<Map> GetMonomorphicReceiverType() { |
| 1527 return monomorphic_receiver_type_; |
| 1528 } |
| 1529 |
| 1516 // Bailout support. | 1530 // Bailout support. |
| 1517 int AssignmentId() const { return assignment_id_; } | 1531 int AssignmentId() const { return assignment_id_; } |
| 1518 int CountId() const { return count_id_; } | 1532 int CountId() const { return count_id_; } |
| 1519 | 1533 |
| 1520 private: | 1534 private: |
| 1521 Token::Value op_; | 1535 Token::Value op_; |
| 1522 bool is_prefix_; | 1536 bool is_prefix_; |
| 1537 bool is_monomorphic_; |
| 1523 Expression* expression_; | 1538 Expression* expression_; |
| 1524 int pos_; | 1539 int pos_; |
| 1525 int assignment_id_; | 1540 int assignment_id_; |
| 1526 int count_id_; | 1541 int count_id_; |
| 1542 Handle<Map> monomorphic_receiver_type_; |
| 1527 }; | 1543 }; |
| 1528 | 1544 |
| 1529 | 1545 |
| 1530 class CompareOperation: public Expression { | 1546 class CompareOperation: public Expression { |
| 1531 public: | 1547 public: |
| 1532 CompareOperation(Token::Value op, | 1548 CompareOperation(Token::Value op, |
| 1533 Expression* left, | 1549 Expression* left, |
| 1534 Expression* right, | 1550 Expression* right, |
| 1535 int pos) | 1551 int pos) |
| 1536 : op_(op), left_(left), right_(right), pos_(pos), compare_type_(NONE) { | 1552 : op_(op), left_(left), right_(right), pos_(pos), compare_type_(NONE) { |
| 1537 ASSERT(Token::IsCompareOp(op)); | 1553 ASSERT(Token::IsCompareOp(op)); |
| 1538 } | 1554 } |
| 1539 | 1555 |
| 1540 DECLARE_NODE_TYPE(CompareOperation) | 1556 DECLARE_NODE_TYPE(CompareOperation) |
| 1541 | 1557 |
| 1542 Token::Value op() const { return op_; } | 1558 Token::Value op() const { return op_; } |
| 1543 Expression* left() const { return left_; } | 1559 Expression* left() const { return left_; } |
| 1544 Expression* right() const { return right_; } | 1560 Expression* right() const { return right_; } |
| 1545 int position() const { return pos_; } | 1561 virtual int position() const { return pos_; } |
| 1546 | 1562 |
| 1547 virtual bool IsInlineable() const; | 1563 virtual bool IsInlineable() const; |
| 1548 | 1564 |
| 1549 // Type feedback information. | 1565 // Type feedback information. |
| 1550 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1566 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1551 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } | 1567 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } |
| 1552 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } | 1568 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } |
| 1553 | 1569 |
| 1554 private: | 1570 private: |
| 1555 Token::Value op_; | 1571 Token::Value op_; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 | 1646 |
| 1631 virtual bool IsInlineable() const; | 1647 virtual bool IsInlineable() const; |
| 1632 | 1648 |
| 1633 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } | 1649 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } |
| 1634 | 1650 |
| 1635 Token::Value binary_op() const; | 1651 Token::Value binary_op() const; |
| 1636 | 1652 |
| 1637 Token::Value op() const { return op_; } | 1653 Token::Value op() const { return op_; } |
| 1638 Expression* target() const { return target_; } | 1654 Expression* target() const { return target_; } |
| 1639 Expression* value() const { return value_; } | 1655 Expression* value() const { return value_; } |
| 1640 int position() { return pos_; } | 1656 virtual int position() const { return pos_; } |
| 1641 BinaryOperation* binary_operation() const { return binary_operation_; } | 1657 BinaryOperation* binary_operation() const { return binary_operation_; } |
| 1642 | 1658 |
| 1643 // This check relies on the definition order of token in token.h. | 1659 // This check relies on the definition order of token in token.h. |
| 1644 bool is_compound() const { return op() > Token::ASSIGN; } | 1660 bool is_compound() const { return op() > Token::ASSIGN; } |
| 1645 | 1661 |
| 1646 // An initialization block is a series of statments of the form | 1662 // An initialization block is a series of statments of the form |
| 1647 // x.y.z.a = ...; x.y.z.b = ...; etc. The parser marks the beginning and | 1663 // x.y.z.a = ...; x.y.z.b = ...; etc. The parser marks the beginning and |
| 1648 // ending of these blocks to allow for optimizations of initialization | 1664 // ending of these blocks to allow for optimizations of initialization |
| 1649 // blocks. | 1665 // blocks. |
| 1650 bool starts_initialization_block() { return block_start_; } | 1666 bool starts_initialization_block() { return block_start_; } |
| 1651 bool ends_initialization_block() { return block_end_; } | 1667 bool ends_initialization_block() { return block_end_; } |
| 1652 void mark_block_start() { block_start_ = true; } | 1668 void mark_block_start() { block_start_ = true; } |
| 1653 void mark_block_end() { block_end_ = true; } | 1669 void mark_block_end() { block_end_ = true; } |
| 1654 | 1670 |
| 1655 // Type feedback information. | 1671 // Type feedback information. |
| 1656 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1672 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1657 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1673 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1658 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1674 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
| 1659 virtual Handle<Map> GetMonomorphicReceiverType() { | 1675 virtual Handle<Map> GetMonomorphicReceiverType() { |
| 1660 return monomorphic_receiver_type_; | 1676 return monomorphic_receiver_type_; |
| 1661 } | 1677 } |
| 1662 ExternalArrayType GetExternalArrayType() const { return array_type_; } | |
| 1663 void SetExternalArrayType(ExternalArrayType array_type) { | |
| 1664 array_type_ = array_type; | |
| 1665 } | |
| 1666 | 1678 |
| 1667 // Bailout support. | 1679 // Bailout support. |
| 1668 int CompoundLoadId() const { return compound_load_id_; } | 1680 int CompoundLoadId() const { return compound_load_id_; } |
| 1669 int AssignmentId() const { return assignment_id_; } | 1681 int AssignmentId() const { return assignment_id_; } |
| 1670 | 1682 |
| 1671 private: | 1683 private: |
| 1672 Token::Value op_; | 1684 Token::Value op_; |
| 1673 Expression* target_; | 1685 Expression* target_; |
| 1674 Expression* value_; | 1686 Expression* value_; |
| 1675 int pos_; | 1687 int pos_; |
| 1676 BinaryOperation* binary_operation_; | 1688 BinaryOperation* binary_operation_; |
| 1677 int compound_load_id_; | 1689 int compound_load_id_; |
| 1678 int assignment_id_; | 1690 int assignment_id_; |
| 1679 | 1691 |
| 1680 bool block_start_; | 1692 bool block_start_; |
| 1681 bool block_end_; | 1693 bool block_end_; |
| 1682 | 1694 |
| 1683 bool is_monomorphic_; | 1695 bool is_monomorphic_; |
| 1684 ZoneMapList* receiver_types_; | 1696 ZoneMapList* receiver_types_; |
| 1685 Handle<Map> monomorphic_receiver_type_; | 1697 Handle<Map> monomorphic_receiver_type_; |
| 1686 ExternalArrayType array_type_; | |
| 1687 }; | 1698 }; |
| 1688 | 1699 |
| 1689 | 1700 |
| 1690 class Throw: public Expression { | 1701 class Throw: public Expression { |
| 1691 public: | 1702 public: |
| 1692 Throw(Expression* exception, int pos) | 1703 Throw(Expression* exception, int pos) |
| 1693 : exception_(exception), pos_(pos) {} | 1704 : exception_(exception), pos_(pos) {} |
| 1694 | 1705 |
| 1695 DECLARE_NODE_TYPE(Throw) | 1706 DECLARE_NODE_TYPE(Throw) |
| 1696 | 1707 |
| 1697 Expression* exception() const { return exception_; } | 1708 Expression* exception() const { return exception_; } |
| 1698 int position() const { return pos_; } | 1709 virtual int position() const { return pos_; } |
| 1699 | 1710 |
| 1700 private: | 1711 private: |
| 1701 Expression* exception_; | 1712 Expression* exception_; |
| 1702 int pos_; | 1713 int pos_; |
| 1703 }; | 1714 }; |
| 1704 | 1715 |
| 1705 | 1716 |
| 1706 class FunctionLiteral: public Expression { | 1717 class FunctionLiteral: public Expression { |
| 1707 public: | 1718 public: |
| 1708 FunctionLiteral(Handle<String> name, | 1719 FunctionLiteral(Handle<String> name, |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 | 2220 |
| 2210 private: | 2221 private: |
| 2211 Isolate* isolate_; | 2222 Isolate* isolate_; |
| 2212 bool stack_overflow_; | 2223 bool stack_overflow_; |
| 2213 }; | 2224 }; |
| 2214 | 2225 |
| 2215 | 2226 |
| 2216 } } // namespace v8::internal | 2227 } } // namespace v8::internal |
| 2217 | 2228 |
| 2218 #endif // V8_AST_H_ | 2229 #endif // V8_AST_H_ |
| OLD | NEW |