| 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 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 RawArray* TokenObjects() const; | 1833 RawArray* TokenObjects() const; |
| 1834 void SetTokenObjects(const Array& value) const; | 1834 void SetTokenObjects(const Array& value) const; |
| 1835 | 1835 |
| 1836 RawExternalUint8Array* GetStream() const; | 1836 RawExternalUint8Array* GetStream() const; |
| 1837 void SetStream(const ExternalUint8Array& stream) const; | 1837 void SetStream(const ExternalUint8Array& stream) const; |
| 1838 | 1838 |
| 1839 RawString* GenerateSource() const; | 1839 RawString* GenerateSource() const; |
| 1840 intptr_t ComputeSourcePosition(intptr_t tok_pos) const; | 1840 intptr_t ComputeSourcePosition(intptr_t tok_pos) const; |
| 1841 intptr_t ComputeTokenPosition(intptr_t src_pos) const; | 1841 intptr_t ComputeTokenPosition(intptr_t src_pos) const; |
| 1842 | 1842 |
| 1843 RawString* PrivateKey() const; |
| 1844 |
| 1843 static const intptr_t kBytesPerElement = 1; | 1845 static const intptr_t kBytesPerElement = 1; |
| 1844 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 1846 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
| 1845 | 1847 |
| 1846 static intptr_t InstanceSize() { | 1848 static intptr_t InstanceSize() { |
| 1847 return RoundedAllocationSize(sizeof(RawTokenStream)); | 1849 return RoundedAllocationSize(sizeof(RawTokenStream)); |
| 1848 } | 1850 } |
| 1849 | 1851 |
| 1850 static RawTokenStream* New(intptr_t length); | 1852 static RawTokenStream* New(intptr_t length); |
| 1851 static RawTokenStream* New(const Scanner::GrowableTokenStream& tokens, | 1853 static RawTokenStream* New(const Scanner::GrowableTokenStream& tokens, |
| 1852 const String& private_key); | 1854 const String& private_key); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 const ExternalUint8Array& data_; | 1889 const ExternalUint8Array& data_; |
| 1888 ReadStream stream_; | 1890 ReadStream stream_; |
| 1889 Array& token_objects_; | 1891 Array& token_objects_; |
| 1890 Object& obj_; | 1892 Object& obj_; |
| 1891 intptr_t cur_token_pos_; | 1893 intptr_t cur_token_pos_; |
| 1892 Token::Kind cur_token_kind_; | 1894 Token::Kind cur_token_kind_; |
| 1893 intptr_t cur_token_obj_index_; | 1895 intptr_t cur_token_obj_index_; |
| 1894 }; | 1896 }; |
| 1895 | 1897 |
| 1896 private: | 1898 private: |
| 1897 RawString* PrivateKey() const; | |
| 1898 void SetPrivateKey(const String& value) const; | 1899 void SetPrivateKey(const String& value) const; |
| 1899 | 1900 |
| 1900 static RawTokenStream* New(); | 1901 static RawTokenStream* New(); |
| 1901 static void DataFinalizer(void *peer); | 1902 static void DataFinalizer(void *peer); |
| 1902 | 1903 |
| 1903 HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); | 1904 HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); |
| 1904 friend class Class; | 1905 friend class Class; |
| 1905 }; | 1906 }; |
| 1906 | 1907 |
| 1907 | 1908 |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3517 static void Copy(const String& dst, | 3518 static void Copy(const String& dst, |
| 3518 intptr_t dst_offset, | 3519 intptr_t dst_offset, |
| 3519 const uint32_t* characters, | 3520 const uint32_t* characters, |
| 3520 intptr_t len); | 3521 intptr_t len); |
| 3521 static void Copy(const String& dst, | 3522 static void Copy(const String& dst, |
| 3522 intptr_t dst_offset, | 3523 intptr_t dst_offset, |
| 3523 const String& src, | 3524 const String& src, |
| 3524 intptr_t src_offset, | 3525 intptr_t src_offset, |
| 3525 intptr_t len); | 3526 intptr_t len); |
| 3526 | 3527 |
| 3527 static RawString* EscapeDoubleQuotes(const String& str); | 3528 static RawString* EscapeSpecialCharacters(const String& str, bool raw_str); |
| 3528 | 3529 |
| 3529 static RawString* Concat(const String& str1, | 3530 static RawString* Concat(const String& str1, |
| 3530 const String& str2, | 3531 const String& str2, |
| 3531 Heap::Space space = Heap::kNew); | 3532 Heap::Space space = Heap::kNew); |
| 3532 static RawString* ConcatAll(const Array& strings, | 3533 static RawString* ConcatAll(const Array& strings, |
| 3533 Heap::Space space = Heap::kNew); | 3534 Heap::Space space = Heap::kNew); |
| 3534 | 3535 |
| 3535 static RawString* SubString(const String& str, | 3536 static RawString* SubString(const String& str, |
| 3536 intptr_t begin_index, | 3537 intptr_t begin_index, |
| 3537 Heap::Space space = Heap::kNew); | 3538 Heap::Space space = Heap::kNew); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3586 class OneByteString : public String { | 3587 class OneByteString : public String { |
| 3587 public: | 3588 public: |
| 3588 virtual int32_t CharAt(intptr_t index) const { | 3589 virtual int32_t CharAt(intptr_t index) const { |
| 3589 return *CharAddr(index); | 3590 return *CharAddr(index); |
| 3590 } | 3591 } |
| 3591 | 3592 |
| 3592 virtual intptr_t CharSize() const { | 3593 virtual intptr_t CharSize() const { |
| 3593 return kOneByteChar; | 3594 return kOneByteChar; |
| 3594 } | 3595 } |
| 3595 | 3596 |
| 3596 RawOneByteString* EscapeDoubleQuotes() const; | 3597 RawOneByteString* EscapeSpecialCharacters(bool raw_str) const; |
| 3597 | 3598 |
| 3598 bool EqualsIgnoringPrivateKey(const OneByteString& str) const; | 3599 bool EqualsIgnoringPrivateKey(const OneByteString& str) const; |
| 3599 | 3600 |
| 3600 // We use the same maximum elements for all strings. | 3601 // We use the same maximum elements for all strings. |
| 3601 static const intptr_t kBytesPerElement = 1; | 3602 static const intptr_t kBytesPerElement = 1; |
| 3602 static const intptr_t kMaxElements = String::kMaxElements; | 3603 static const intptr_t kMaxElements = String::kMaxElements; |
| 3603 | 3604 |
| 3604 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } | 3605 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } |
| 3605 | 3606 |
| 3606 static intptr_t InstanceSize() { | 3607 static intptr_t InstanceSize() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 class TwoByteString : public String { | 3663 class TwoByteString : public String { |
| 3663 public: | 3664 public: |
| 3664 virtual int32_t CharAt(intptr_t index) const { | 3665 virtual int32_t CharAt(intptr_t index) const { |
| 3665 return *CharAddr(index); | 3666 return *CharAddr(index); |
| 3666 } | 3667 } |
| 3667 | 3668 |
| 3668 virtual intptr_t CharSize() const { | 3669 virtual intptr_t CharSize() const { |
| 3669 return kTwoByteChar; | 3670 return kTwoByteChar; |
| 3670 } | 3671 } |
| 3671 | 3672 |
| 3672 RawTwoByteString* EscapeDoubleQuotes() const; | 3673 RawTwoByteString* EscapeSpecialCharacters(bool raw_str) const; |
| 3673 | 3674 |
| 3674 // We use the same maximum elements for all strings. | 3675 // We use the same maximum elements for all strings. |
| 3675 static const intptr_t kBytesPerElement = 2; | 3676 static const intptr_t kBytesPerElement = 2; |
| 3676 static const intptr_t kMaxElements = String::kMaxElements; | 3677 static const intptr_t kMaxElements = String::kMaxElements; |
| 3677 | 3678 |
| 3678 static intptr_t InstanceSize() { | 3679 static intptr_t InstanceSize() { |
| 3679 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_)); | 3680 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_)); |
| 3680 return 0; | 3681 return 0; |
| 3681 } | 3682 } |
| 3682 | 3683 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3724 class FourByteString : public String { | 3725 class FourByteString : public String { |
| 3725 public: | 3726 public: |
| 3726 virtual int32_t CharAt(intptr_t index) const { | 3727 virtual int32_t CharAt(intptr_t index) const { |
| 3727 return *CharAddr(index); | 3728 return *CharAddr(index); |
| 3728 } | 3729 } |
| 3729 | 3730 |
| 3730 virtual intptr_t CharSize() const { | 3731 virtual intptr_t CharSize() const { |
| 3731 return kFourByteChar; | 3732 return kFourByteChar; |
| 3732 } | 3733 } |
| 3733 | 3734 |
| 3734 RawFourByteString* EscapeDoubleQuotes() const; | 3735 RawFourByteString* EscapeSpecialCharacters(bool raw_str) const; |
| 3735 | 3736 |
| 3736 static const intptr_t kBytesPerElement = 4; | 3737 static const intptr_t kBytesPerElement = 4; |
| 3737 static const intptr_t kMaxElements = String::kMaxElements; | 3738 static const intptr_t kMaxElements = String::kMaxElements; |
| 3738 | 3739 |
| 3739 static intptr_t InstanceSize() { | 3740 static intptr_t InstanceSize() { |
| 3740 ASSERT(sizeof(RawFourByteString) == OFFSET_OF(RawFourByteString, data_)); | 3741 ASSERT(sizeof(RawFourByteString) == OFFSET_OF(RawFourByteString, data_)); |
| 3741 return 0; | 3742 return 0; |
| 3742 } | 3743 } |
| 3743 | 3744 |
| 3744 static intptr_t InstanceSize(intptr_t len) { | 3745 static intptr_t InstanceSize(intptr_t len) { |
| (...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5568 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5569 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5569 return false; | 5570 return false; |
| 5570 } | 5571 } |
| 5571 } | 5572 } |
| 5572 return true; | 5573 return true; |
| 5573 } | 5574 } |
| 5574 | 5575 |
| 5575 } // namespace dart | 5576 } // namespace dart |
| 5576 | 5577 |
| 5577 #endif // VM_OBJECT_H_ | 5578 #endif // VM_OBJECT_H_ |
| OLD | NEW |