Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/objects.h

Issue 265553003: StringTable::Lookup*IfExist() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include "allocation.h" 8 #include "allocation.h"
9 #include "assert-scope.h" 9 #include "assert-scope.h"
10 #include "builtins.h" 10 #include "builtins.h"
(...skipping 3813 matching lines...) Expand 10 before | Expand all | Expand 10 after
3824 static const int kPrefixSize = 0; 3824 static const int kPrefixSize = 0;
3825 static const int kEntrySize = 1; 3825 static const int kEntrySize = 1;
3826 }; 3826 };
3827 3827
3828 class SeqOneByteString; 3828 class SeqOneByteString;
3829 3829
3830 // StringTable. 3830 // StringTable.
3831 // 3831 //
3832 // No special elements in the prefix and the element size is 1 3832 // No special elements in the prefix and the element size is 1
3833 // because only the string itself (the key) needs to be stored. 3833 // because only the string itself (the key) needs to be stored.
3834 // TODO(ishell): Make StringTable a singleton class and move
3835 // Heap::InternalizeStringXX() methods here.
3836 class StringTable: public HashTable<StringTable, 3834 class StringTable: public HashTable<StringTable,
3837 StringTableShape, 3835 StringTableShape,
3838 HashTableKey*> { 3836 HashTableKey*> {
3839 public: 3837 public:
3840 // Find string in the string table. If it is not there yet, it is 3838 // Find string in the string table. If it is not there yet, it is
3841 // added. The return value is the string found. 3839 // added. The return value is the string found.
3842 static Handle<String> LookupString(Isolate* isolate, Handle<String> key); 3840 static Handle<String> LookupString(Isolate* isolate, Handle<String> key);
3843 static Handle<String> LookupKey(Isolate* isolate, HashTableKey* key); 3841 static Handle<String> LookupKey(Isolate* isolate, HashTableKey* key);
3844 3842
3843 // Tries to internalize given string and returns string handle on success
3844 // or an empty handle otherwise.
3845 MUST_USE_RESULT static MaybeHandle<String> InternalizeStringIfExists(
3846 Isolate* isolate,
3847 Handle<String> string);
3848
3845 // Looks up a string that is equal to the given string and returns 3849 // Looks up a string that is equal to the given string and returns
3846 // true if it is found, assigning the string to the given output 3850 // string handle if it is found, or an empty handle otherwise.
3847 // parameter. 3851 MUST_USE_RESULT static MaybeHandle<String> LookupStringIfExists(
3848 bool LookupStringIfExists(String* str, String** result); 3852 Isolate* isolate,
3849 bool LookupTwoCharsStringIfExists(uint16_t c1, uint16_t c2, String** result); 3853 Handle<String> str);
3854 MUST_USE_RESULT static MaybeHandle<String> LookupTwoCharsStringIfExists(
3855 Isolate* isolate,
3856 uint16_t c1,
3857 uint16_t c2);
3850 3858
3851 // Casting. 3859 // Casting.
3852 static inline StringTable* cast(Object* obj); 3860 static inline StringTable* cast(Object* obj);
3853 3861
3854 private: 3862 private:
3855 template <bool seq_ascii> friend class JsonParser; 3863 template <bool seq_ascii> friend class JsonParser;
3856 3864
3857 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); 3865 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable);
3858 }; 3866 };
3859 3867
(...skipping 7311 matching lines...) Expand 10 before | Expand all | Expand 10 after
11171 } else { 11179 } else {
11172 value &= ~(1 << bit_position); 11180 value &= ~(1 << bit_position);
11173 } 11181 }
11174 return value; 11182 return value;
11175 } 11183 }
11176 }; 11184 };
11177 11185
11178 } } // namespace v8::internal 11186 } } // namespace v8::internal
11179 11187
11180 #endif // V8_OBJECTS_H_ 11188 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698