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

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..f4d22188b68fa747ae837d0367ab5d9050fb5cc8 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9283,6 +9283,23 @@ uint32_t StringHasher::ComputeUtf8Hash(Vector<const char> chars,
}
+void IteratingStringHasher::VisitConsString(ConsString* cons_string) {
+ const int max_length = String::kMaxHashCalcLength;
+ int length = std::min(cons_string->length(), max_length);
+ if (cons_string->HasOnlyOneByteChars()) {
+ uint8_t* buffer = new uint8_t[length];
+ String::WriteToFlat(cons_string, buffer, 0, length);
+ AddCharacters(buffer, length);
+ delete[] buffer;
+ } else {
+ uint16_t* buffer = new uint16_t[length];
+ String::WriteToFlat(cons_string, buffer, 0, length);
+ AddCharacters(buffer, length);
+ delete[] buffer;
+ }
+}
+
+
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