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 6740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6751 // | 6751 // |
6752 // The API expects that all ExternalStrings are created through the | 6752 // The API expects that all ExternalStrings are created through the |
6753 // API. Therefore, ExternalStrings should not be used internally. | 6753 // API. Therefore, ExternalStrings should not be used internally. |
6754 class ExternalString: public String { | 6754 class ExternalString: public String { |
6755 public: | 6755 public: |
6756 // Casting | 6756 // Casting |
6757 static inline ExternalString* cast(Object* obj); | 6757 static inline ExternalString* cast(Object* obj); |
6758 | 6758 |
6759 // Layout description. | 6759 // Layout description. |
6760 static const int kResourceOffset = POINTER_SIZE_ALIGN(String::kSize); | 6760 static const int kResourceOffset = POINTER_SIZE_ALIGN(String::kSize); |
6761 static const int kSize = kResourceOffset + kPointerSize; | 6761 static const int kResourceDataOffset = kResourceOffset + kPointerSize; |
| 6762 static const int kSize = kResourceDataOffset + kPointerSize; |
| 6763 |
| 6764 // Clear the cached pointer to the character array provided by the resource. |
| 6765 // This cache is updated the first time the character array is accessed. |
| 6766 inline void clear_data_cache(); |
6762 | 6767 |
6763 STATIC_CHECK(kResourceOffset == Internals::kStringResourceOffset); | 6768 STATIC_CHECK(kResourceOffset == Internals::kStringResourceOffset); |
6764 | 6769 |
6765 private: | 6770 private: |
6766 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); | 6771 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); |
6767 }; | 6772 }; |
6768 | 6773 |
6769 | 6774 |
6770 // The ExternalAsciiString class is an external string backed by an | 6775 // The ExternalAsciiString class is an external string backed by an |
6771 // ASCII string. | 6776 // ASCII string. |
6772 class ExternalAsciiString: public ExternalString { | 6777 class ExternalAsciiString: public ExternalString { |
6773 public: | 6778 public: |
6774 static const bool kHasAsciiEncoding = true; | 6779 static const bool kHasAsciiEncoding = true; |
6775 | 6780 |
6776 typedef v8::String::ExternalAsciiStringResource Resource; | 6781 typedef v8::String::ExternalAsciiStringResource Resource; |
6777 | 6782 |
6778 // The underlying resource. | 6783 // The underlying resource. |
6779 inline const Resource* resource(); | 6784 inline const Resource* resource(); |
6780 inline void set_resource(const Resource* buffer); | 6785 inline void set_resource(const Resource* buffer); |
6781 | 6786 |
| 6787 inline const char* GetChars(); |
| 6788 |
6782 // Dispatched behavior. | 6789 // Dispatched behavior. |
6783 uint16_t ExternalAsciiStringGet(int index); | 6790 inline uint16_t ExternalAsciiStringGet(int index); |
6784 | 6791 |
6785 // Casting. | 6792 // Casting. |
6786 static inline ExternalAsciiString* cast(Object* obj); | 6793 static inline ExternalAsciiString* cast(Object* obj); |
6787 | 6794 |
6788 // Garbage collection support. | 6795 // Garbage collection support. |
6789 inline void ExternalAsciiStringIterateBody(ObjectVisitor* v); | 6796 inline void ExternalAsciiStringIterateBody(ObjectVisitor* v); |
6790 | 6797 |
6791 template<typename StaticVisitor> | 6798 template<typename StaticVisitor> |
6792 inline void ExternalAsciiStringIterateBody(); | 6799 inline void ExternalAsciiStringIterateBody(); |
6793 | 6800 |
(...skipping 15 matching lines...) Expand all Loading... |
6809 class ExternalTwoByteString: public ExternalString { | 6816 class ExternalTwoByteString: public ExternalString { |
6810 public: | 6817 public: |
6811 static const bool kHasAsciiEncoding = false; | 6818 static const bool kHasAsciiEncoding = false; |
6812 | 6819 |
6813 typedef v8::String::ExternalStringResource Resource; | 6820 typedef v8::String::ExternalStringResource Resource; |
6814 | 6821 |
6815 // The underlying string resource. | 6822 // The underlying string resource. |
6816 inline const Resource* resource(); | 6823 inline const Resource* resource(); |
6817 inline void set_resource(const Resource* buffer); | 6824 inline void set_resource(const Resource* buffer); |
6818 | 6825 |
| 6826 inline const uint16_t* GetChars(); |
| 6827 |
6819 // Dispatched behavior. | 6828 // Dispatched behavior. |
6820 uint16_t ExternalTwoByteStringGet(int index); | 6829 inline uint16_t ExternalTwoByteStringGet(int index); |
6821 | 6830 |
6822 // For regexp code. | 6831 // For regexp code. |
6823 const uint16_t* ExternalTwoByteStringGetData(unsigned start); | 6832 inline const uint16_t* ExternalTwoByteStringGetData(unsigned start); |
6824 | 6833 |
6825 // Casting. | 6834 // Casting. |
6826 static inline ExternalTwoByteString* cast(Object* obj); | 6835 static inline ExternalTwoByteString* cast(Object* obj); |
6827 | 6836 |
6828 // Garbage collection support. | 6837 // Garbage collection support. |
6829 inline void ExternalTwoByteStringIterateBody(ObjectVisitor* v); | 6838 inline void ExternalTwoByteStringIterateBody(ObjectVisitor* v); |
6830 | 6839 |
6831 template<typename StaticVisitor> | 6840 template<typename StaticVisitor> |
6832 inline void ExternalTwoByteStringIterateBody(); | 6841 inline void ExternalTwoByteStringIterateBody(); |
6833 | 6842 |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7878 } else { | 7887 } else { |
7879 value &= ~(1 << bit_position); | 7888 value &= ~(1 << bit_position); |
7880 } | 7889 } |
7881 return value; | 7890 return value; |
7882 } | 7891 } |
7883 }; | 7892 }; |
7884 | 7893 |
7885 } } // namespace v8::internal | 7894 } } // namespace v8::internal |
7886 | 7895 |
7887 #endif // V8_OBJECTS_H_ | 7896 #endif // V8_OBJECTS_H_ |
OLD | NEW |