OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3760 // StringTable. | 3760 // StringTable. |
3761 // | 3761 // |
3762 // No special elements in the prefix and the element size is 1 | 3762 // No special elements in the prefix and the element size is 1 |
3763 // because only the string itself (the key) needs to be stored. | 3763 // because only the string itself (the key) needs to be stored. |
3764 class StringTable: public HashTable<StringTableShape, HashTableKey*> { | 3764 class StringTable: public HashTable<StringTableShape, HashTableKey*> { |
3765 public: | 3765 public: |
3766 // Find string in the string table. If it is not there yet, it is | 3766 // Find string in the string table. If it is not there yet, it is |
3767 // added. The return value is the string table which might have | 3767 // added. The return value is the string table which might have |
3768 // been enlarged. If the return value is not a failure, the string | 3768 // been enlarged. If the return value is not a failure, the string |
3769 // pointer *s is set to the string found. | 3769 // pointer *s is set to the string found. |
3770 MUST_USE_RESULT MaybeObject* LookupUtf8String( | |
3771 Vector<const char> str, | |
3772 Object** s); | |
3773 MUST_USE_RESULT MaybeObject* LookupOneByteString( | |
3774 Vector<const uint8_t> str, | |
3775 Object** s); | |
3776 MUST_USE_RESULT MaybeObject* LookupSubStringOneByteString( | |
3777 Handle<SeqOneByteString> str, | |
3778 int from, | |
3779 int length, | |
3780 Object** s); | |
3781 MUST_USE_RESULT MaybeObject* LookupTwoByteString( | |
3782 Vector<const uc16> str, | |
3783 Object** s); | |
3784 MUST_USE_RESULT MaybeObject* LookupString(String* key, Object** s); | 3770 MUST_USE_RESULT MaybeObject* LookupString(String* key, Object** s); |
| 3771 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); |
3785 | 3772 |
3786 // Looks up a string that is equal to the given string and returns | 3773 // Looks up a string that is equal to the given string and returns |
3787 // true if it is found, assigning the string to the given output | 3774 // true if it is found, assigning the string to the given output |
3788 // parameter. | 3775 // parameter. |
3789 bool LookupStringIfExists(String* str, String** result); | 3776 bool LookupStringIfExists(String* str, String** result); |
3790 bool LookupTwoCharsStringIfExists(uint16_t c1, uint16_t c2, String** result); | 3777 bool LookupTwoCharsStringIfExists(uint16_t c1, uint16_t c2, String** result); |
3791 | 3778 |
3792 // Casting. | 3779 // Casting. |
3793 static inline StringTable* cast(Object* obj); | 3780 static inline StringTable* cast(Object* obj); |
3794 | 3781 |
3795 private: | 3782 private: |
3796 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); | |
3797 | |
3798 template <bool seq_ascii> friend class JsonParser; | 3783 template <bool seq_ascii> friend class JsonParser; |
3799 | 3784 |
3800 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); | 3785 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); |
3801 }; | 3786 }; |
3802 | 3787 |
3803 | 3788 |
3804 class MapCacheShape : public BaseShape<HashTableKey*> { | 3789 class MapCacheShape : public BaseShape<HashTableKey*> { |
3805 public: | 3790 public: |
3806 static inline bool IsMatch(HashTableKey* key, Object* value) { | 3791 static inline bool IsMatch(HashTableKey* key, Object* value) { |
3807 return key->IsMatch(value); | 3792 return key->IsMatch(value); |
(...skipping 6963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10771 } else { | 10756 } else { |
10772 value &= ~(1 << bit_position); | 10757 value &= ~(1 << bit_position); |
10773 } | 10758 } |
10774 return value; | 10759 return value; |
10775 } | 10760 } |
10776 }; | 10761 }; |
10777 | 10762 |
10778 } } // namespace v8::internal | 10763 } } // namespace v8::internal |
10779 | 10764 |
10780 #endif // V8_OBJECTS_H_ | 10765 #endif // V8_OBJECTS_H_ |
OLD | NEW |