| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 } | 1463 } |
| 1464 bool IsInFactoryScope() const; | 1464 bool IsInFactoryScope() const; |
| 1465 | 1465 |
| 1466 intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 1466 intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
| 1467 | 1467 |
| 1468 intptr_t end_token_pos() const { return raw_ptr()->end_token_pos_; } | 1468 intptr_t end_token_pos() const { return raw_ptr()->end_token_pos_; } |
| 1469 void set_end_token_pos(intptr_t value) const { | 1469 void set_end_token_pos(intptr_t value) const { |
| 1470 raw_ptr()->end_token_pos_ = value; | 1470 raw_ptr()->end_token_pos_ = value; |
| 1471 } | 1471 } |
| 1472 | 1472 |
| 1473 static intptr_t num_fixed_parameters_offset() { | |
| 1474 return OFFSET_OF(RawFunction, num_fixed_parameters_); | |
| 1475 } | |
| 1476 intptr_t num_fixed_parameters() const { | 1473 intptr_t num_fixed_parameters() const { |
| 1477 return raw_ptr()->num_fixed_parameters_; | 1474 return raw_ptr()->num_fixed_parameters_; |
| 1478 } | 1475 } |
| 1479 void set_num_fixed_parameters(intptr_t value) const; | 1476 void set_num_fixed_parameters(intptr_t value) const; |
| 1480 | 1477 |
| 1481 static intptr_t num_optional_parameters_offset() { | 1478 bool HasOptionalParameters() const { |
| 1482 return OFFSET_OF(RawFunction, num_optional_parameters_); | 1479 return (num_optional_positional_parameters() + |
| 1480 num_optional_named_parameters()) > 0; |
| 1483 } | 1481 } |
| 1484 intptr_t num_optional_parameters() const { | 1482 |
| 1485 return raw_ptr()->num_optional_parameters_; | 1483 intptr_t num_optional_positional_parameters() const { |
| 1484 return raw_ptr()->num_optional_positional_parameters_; |
| 1486 } | 1485 } |
| 1487 void set_num_optional_parameters(intptr_t value) const; | 1486 void set_num_optional_positional_parameters(intptr_t value) const; |
| 1487 |
| 1488 intptr_t num_optional_named_parameters() const { |
| 1489 return raw_ptr()->num_optional_named_parameters_; |
| 1490 } |
| 1491 void set_num_optional_named_parameters(intptr_t value) const; |
| 1488 | 1492 |
| 1489 static intptr_t usage_counter_offset() { | 1493 static intptr_t usage_counter_offset() { |
| 1490 return OFFSET_OF(RawFunction, usage_counter_); | 1494 return OFFSET_OF(RawFunction, usage_counter_); |
| 1491 } | 1495 } |
| 1492 intptr_t usage_counter() const { | 1496 intptr_t usage_counter() const { |
| 1493 return raw_ptr()->usage_counter_; | 1497 return raw_ptr()->usage_counter_; |
| 1494 } | 1498 } |
| 1495 void set_usage_counter(intptr_t value) const { | 1499 void set_usage_counter(intptr_t value) const { |
| 1496 raw_ptr()->usage_counter_ = value; | 1500 raw_ptr()->usage_counter_ = value; |
| 1497 } | 1501 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1514 bool is_native() const { return NativeBit::decode(raw_ptr()->kind_tag_); } | 1518 bool is_native() const { return NativeBit::decode(raw_ptr()->kind_tag_); } |
| 1515 void set_is_native(bool value) const; | 1519 void set_is_native(bool value) const; |
| 1516 | 1520 |
| 1517 bool is_abstract() const { return AbstractBit::decode(raw_ptr()->kind_tag_); } | 1521 bool is_abstract() const { return AbstractBit::decode(raw_ptr()->kind_tag_); } |
| 1518 void set_is_abstract(bool value) const; | 1522 void set_is_abstract(bool value) const; |
| 1519 | 1523 |
| 1520 bool HasOptimizedCode() const; | 1524 bool HasOptimizedCode() const; |
| 1521 | 1525 |
| 1522 intptr_t NumberOfParameters() const; | 1526 intptr_t NumberOfParameters() const; |
| 1523 intptr_t NumberOfImplicitParameters() const; | 1527 intptr_t NumberOfImplicitParameters() const; |
| 1528 void SetNumberOfParameters(intptr_t num_fixed_parameters, |
| 1529 intptr_t num_optional_parameters, |
| 1530 bool are_optional_positional) const; |
| 1524 | 1531 |
| 1525 // Returns true if the argument counts are valid for calling this function. | 1532 // Returns true if the argument counts are valid for calling this function. |
| 1526 // Otherwise, it returns false and the reason (if error_message is not NULL). | 1533 // Otherwise, it returns false and the reason (if error_message is not NULL). |
| 1527 bool AreValidArgumentCounts(int num_arguments, | 1534 bool AreValidArgumentCounts(int num_arguments, |
| 1528 int num_named_arguments, | 1535 int num_named_arguments, |
| 1529 String* error_message) const; | 1536 String* error_message) const; |
| 1530 | 1537 |
| 1531 // Returns true if the total argument count and the names of optional | 1538 // Returns true if the total argument count and the names of optional |
| 1532 // arguments are valid for calling this function. | 1539 // arguments are valid for calling this function. |
| 1533 // Otherwise, it returns false and the reason (if error_message is not NULL). | 1540 // Otherwise, it returns false and the reason (if error_message is not NULL). |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; | 1666 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; |
| 1660 class HasFinallyBit : public BitField<bool, kHasFinallyBit, 1> {}; | 1667 class HasFinallyBit : public BitField<bool, kHasFinallyBit, 1> {}; |
| 1661 class NativeBit : public BitField<bool, kNativeBit, 1> {}; | 1668 class NativeBit : public BitField<bool, kNativeBit, 1> {}; |
| 1662 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; | 1669 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; |
| 1663 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; | 1670 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; |
| 1664 class KindBits : | 1671 class KindBits : |
| 1665 public BitField<RawFunction::Kind, kKindTagBit, kKindTagSize> {}; // NOLINT | 1672 public BitField<RawFunction::Kind, kKindTagBit, kKindTagSize> {}; // NOLINT |
| 1666 | 1673 |
| 1667 void set_name(const String& value) const; | 1674 void set_name(const String& value) const; |
| 1668 void set_kind(RawFunction::Kind value) const; | 1675 void set_kind(RawFunction::Kind value) const; |
| 1669 void set_is_static(bool is_static) const; | 1676 void set_is_static(bool value) const; |
| 1670 void set_is_const(bool is_const) const; | 1677 void set_is_const(bool value) const; |
| 1671 void set_is_external(bool value) const; | 1678 void set_is_external(bool value) const; |
| 1672 void set_parent_function(const Function& value) const; | 1679 void set_parent_function(const Function& value) const; |
| 1673 void set_owner(const Object& value) const; | 1680 void set_owner(const Object& value) const; |
| 1674 void set_token_pos(intptr_t value) const; | 1681 void set_token_pos(intptr_t value) const; |
| 1675 void set_implicit_closure_function(const Function& value) const; | 1682 void set_implicit_closure_function(const Function& value) const; |
| 1676 void set_kind_tag(intptr_t value) const; | 1683 void set_kind_tag(intptr_t value) const; |
| 1677 static RawFunction* New(); | 1684 static RawFunction* New(); |
| 1678 | 1685 |
| 1679 RawString* BuildSignature(bool instantiate, | 1686 RawString* BuildSignature(bool instantiate, |
| 1680 NameVisibility name_visibility, | 1687 NameVisibility name_visibility, |
| 1681 const AbstractTypeArguments& instantiator) const; | 1688 const AbstractTypeArguments& instantiator) const; |
| 1682 | 1689 |
| 1683 // Check the subtype or 'more specific' relationship. | 1690 // Check the subtype or 'more specific' relationship. |
| 1684 bool TypeTest(TypeTestKind test_kind, | 1691 bool TypeTest(TypeTestKind test_kind, |
| 1685 const AbstractTypeArguments& type_arguments, | 1692 const AbstractTypeArguments& type_arguments, |
| 1686 const Function& other, | 1693 const Function& other, |
| 1687 const AbstractTypeArguments& other_type_arguments, | 1694 const AbstractTypeArguments& other_type_arguments, |
| 1688 Error* malformed_error) const; | 1695 Error* malformed_error) const; |
| 1689 | 1696 |
| 1690 // Checks the type of the formal parameter at the given position for | 1697 // Checks the type of the formal parameter at the given position for |
| 1691 // subtyping or 'more specific' relationship between the type of this function | 1698 // subtyping or 'more specific' relationship between the type of this function |
| 1692 // and the type of the other function. | 1699 // and the type of the other function. |
| 1693 bool TestParameterType(TypeTestKind test_kind, | 1700 bool TestParameterType(TypeTestKind test_kind, |
| 1694 intptr_t parameter_position, | 1701 intptr_t parameter_position, |
| 1702 intptr_t other_parameter_position, |
| 1695 const AbstractTypeArguments& type_arguments, | 1703 const AbstractTypeArguments& type_arguments, |
| 1696 const Function& other, | 1704 const Function& other, |
| 1697 const AbstractTypeArguments& other_type_arguments, | 1705 const AbstractTypeArguments& other_type_arguments, |
| 1698 Error* malformed_error) const; | 1706 Error* malformed_error) const; |
| 1699 | 1707 |
| 1700 HEAP_OBJECT_IMPLEMENTATION(Function, Object); | 1708 HEAP_OBJECT_IMPLEMENTATION(Function, Object); |
| 1701 friend class Class; | 1709 friend class Class; |
| 1702 }; | 1710 }; |
| 1703 | 1711 |
| 1704 | 1712 |
| (...skipping 3855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5560 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5568 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5561 return false; | 5569 return false; |
| 5562 } | 5570 } |
| 5563 } | 5571 } |
| 5564 return true; | 5572 return true; |
| 5565 } | 5573 } |
| 5566 | 5574 |
| 5567 } // namespace dart | 5575 } // namespace dart |
| 5568 | 5576 |
| 5569 #endif // VM_OBJECT_H_ | 5577 #endif // VM_OBJECT_H_ |
| OLD | NEW |