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

Side by Side Diff: src/objects.h

Issue 765473006: Make TemplateLiteral hashing algorithm more memory efficient (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Change assertions in StringHasher extensions, add comment about hash key usage Created 6 years 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
« no previous file with comments | « no previous file | src/objects-inl.h » ('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 <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 8471 matching lines...) Expand 10 before | Expand all | Expand 10 after
8482 static uint32_t MakeArrayIndexHash(uint32_t value, int length); 8482 static uint32_t MakeArrayIndexHash(uint32_t value, int length);
8483 8483
8484 // No string is allowed to have a hash of zero. That value is reserved 8484 // No string is allowed to have a hash of zero. That value is reserved
8485 // for internal properties. If the hash calculation yields zero then we 8485 // for internal properties. If the hash calculation yields zero then we
8486 // use 27 instead. 8486 // use 27 instead.
8487 static const int kZeroHash = 27; 8487 static const int kZeroHash = 27;
8488 8488
8489 // Reusable parts of the hashing algorithm. 8489 // Reusable parts of the hashing algorithm.
8490 INLINE(static uint32_t AddCharacterCore(uint32_t running_hash, uint16_t c)); 8490 INLINE(static uint32_t AddCharacterCore(uint32_t running_hash, uint16_t c));
8491 INLINE(static uint32_t GetHashCore(uint32_t running_hash)); 8491 INLINE(static uint32_t GetHashCore(uint32_t running_hash));
8492 INLINE(static uint32_t ComputeRunningHash(uint32_t running_hash,
8493 const uc16* chars, int length));
8494 INLINE(static uint32_t ComputeRunningHashOneByte(uint32_t running_hash,
8495 const char* chars,
8496 int length));
8492 8497
8493 protected: 8498 protected:
8494 // Returns the value to store in the hash field of a string with 8499 // Returns the value to store in the hash field of a string with
8495 // the given length and contents. 8500 // the given length and contents.
8496 uint32_t GetHashField(); 8501 uint32_t GetHashField();
8497 // Returns true if the hash of this string can be computed without 8502 // Returns true if the hash of this string can be computed without
8498 // looking at the contents. 8503 // looking at the contents.
8499 inline bool has_trivial_hash(); 8504 inline bool has_trivial_hash();
8500 // Adds a block of characters to the hash. 8505 // Adds a block of characters to the hash.
8501 template<typename Char> 8506 template<typename Char>
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after
10977 } else { 10982 } else {
10978 value &= ~(1 << bit_position); 10983 value &= ~(1 << bit_position);
10979 } 10984 }
10980 return value; 10985 return value;
10981 } 10986 }
10982 }; 10987 };
10983 10988
10984 } } // namespace v8::internal 10989 } } // namespace v8::internal
10985 10990
10986 #endif // V8_OBJECTS_H_ 10991 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698