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

Unified Diff: src/objects.cc

Issue 762773002: Don't use ConsStringIterator to compute string hashes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 5262ed65671afa93c941173f9124813ab82c56ab..7900ef3bcb35d2e5c405add63c43809b2c5ee27a 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9283,6 +9283,20 @@ uint32_t StringHasher::ComputeUtf8Hash(Vector<const char> chars,
}
+void IteratingStringHasher::VisitConsString(ConsString* cons_string) {
+ int length = cons_string->length();
+ uint16_t* buffer = cons_string->GetIsolate()->cons_string_hashing_buffer();
+ if (cons_string->HasOnlyOneByteChars()) {
+ uint8_t* one_byte_buffer = reinterpret_cast<uint8_t*>(buffer);
+ String::WriteToFlat(cons_string, one_byte_buffer, 0, length);
Yang 2014/11/26 10:46:15 Wouldn't this cause OOB writes for large strings?
+ AddCharacters(one_byte_buffer, length);
+ } else {
+ String::WriteToFlat(cons_string, buffer, 0, length);
+ AddCharacters(buffer, length);
+ }
+}
+
+
void String::PrintOn(FILE* file) {
int length = this->length();
for (int i = 0; i < length; i++) {
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698