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

Side by Side Diff: src/objects.h

Issue 3020003: StringDictionary::FindEntry optimized for symbol strings. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 5 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 | « no previous file | 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after
2005 2005
2006 // Constant used for denoting a absent entry. 2006 // Constant used for denoting a absent entry.
2007 static const int kNotFound = -1; 2007 static const int kNotFound = -1;
2008 2008
2009 // Maximal capacity of HashTable. Based on maximal length of underlying 2009 // Maximal capacity of HashTable. Based on maximal length of underlying
2010 // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex 2010 // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex
2011 // cannot overflow. 2011 // cannot overflow.
2012 static const int kMaxCapacity = 2012 static const int kMaxCapacity =
2013 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize; 2013 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize;
2014 2014
2015 // Find entry for key otherwise return -1. 2015 // Find entry for key otherwise return kNotFound.
2016 int FindEntry(Key key); 2016 int FindEntry(Key key);
2017 2017
2018 protected: 2018 protected:
2019 2019
2020 // Find the entry at which to insert element with the given key that 2020 // Find the entry at which to insert element with the given key that
2021 // has the given hash value. 2021 // has the given hash value.
2022 uint32_t FindInsertionEntry(uint32_t hash); 2022 uint32_t FindInsertionEntry(uint32_t hash);
2023 2023
2024 // Returns the index for an entry (of the key) 2024 // Returns the index for an entry (of the key)
2025 static inline int EntryToIndex(int entry) { 2025 static inline int EntryToIndex(int entry) {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 ASSERT(obj->IsDictionary()); 2287 ASSERT(obj->IsDictionary());
2288 return reinterpret_cast<StringDictionary*>(obj); 2288 return reinterpret_cast<StringDictionary*>(obj);
2289 } 2289 }
2290 2290
2291 // Copies enumerable keys to preallocated fixed array. 2291 // Copies enumerable keys to preallocated fixed array.
2292 void CopyEnumKeysTo(FixedArray* storage, FixedArray* sort_array); 2292 void CopyEnumKeysTo(FixedArray* storage, FixedArray* sort_array);
2293 2293
2294 // For transforming properties of a JSObject. 2294 // For transforming properties of a JSObject.
2295 Object* TransformPropertiesToFastFor(JSObject* obj, 2295 Object* TransformPropertiesToFastFor(JSObject* obj,
2296 int unused_property_fields); 2296 int unused_property_fields);
2297
2298 // Find entry for key otherwise return kNotFound. Optimzed version of
2299 // HashTable::FindEntry.
2300 int FindEntry(String* key);
2297 }; 2301 };
2298 2302
2299 2303
2300 class NumberDictionaryShape { 2304 class NumberDictionaryShape {
2301 public: 2305 public:
2302 static inline bool IsMatch(uint32_t key, Object* other); 2306 static inline bool IsMatch(uint32_t key, Object* other);
2303 static inline uint32_t Hash(uint32_t key); 2307 static inline uint32_t Hash(uint32_t key);
2304 static inline uint32_t HashForObject(uint32_t key, Object* object); 2308 static inline uint32_t HashForObject(uint32_t key, Object* object);
2305 static inline Object* AsObject(uint32_t key); 2309 static inline Object* AsObject(uint32_t key);
2306 static const int kPrefixSize = 2; 2310 static const int kPrefixSize = 2;
(...skipping 3053 matching lines...) Expand 10 before | Expand all | Expand 10 after
5360 } else { 5364 } else {
5361 value &= ~(1 << bit_position); 5365 value &= ~(1 << bit_position);
5362 } 5366 }
5363 return value; 5367 return value;
5364 } 5368 }
5365 }; 5369 };
5366 5370
5367 } } // namespace v8::internal 5371 } } // namespace v8::internal
5368 5372
5369 #endif // V8_OBJECTS_H_ 5373 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698