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

Unified Diff: src/value-serializer.cc

Issue 2784423002: ValueSerializer: add kOneByteString to expected key fast path. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/value-serializer.cc
diff --git a/src/value-serializer.cc b/src/value-serializer.cc
index acedb4be329fcdf570785051993adbe95b7bef46..59e9b1031ec91930c0515e3ae1c3af1f1c319af2 100644
--- a/src/value-serializer.cc
+++ b/src/value-serializer.cc
@@ -1261,10 +1261,9 @@ bool ValueDeserializer::ReadExpectedString(Handle<String> expected) {
// If the bytes are verbatim what is in the flattened string, then the string
// is successfully consumed.
- if (tag == SerializationTag::kUtf8String && flat.IsOneByte()) {
+ if (tag == SerializationTag::kOneByteString && flat.IsOneByte()) {
Vector<const uint8_t> chars = flat.ToOneByteVector();
if (byte_length == static_cast<size_t>(chars.length()) &&
- String::IsAscii(chars.begin(), chars.length()) &&
memcmp(bytes.begin(), chars.begin(), byte_length) == 0) {
return true;
}
@@ -1274,6 +1273,13 @@ bool ValueDeserializer::ReadExpectedString(Handle<String> expected) {
memcmp(bytes.begin(), chars.begin(), byte_length) == 0) {
return true;
}
+ } else if (tag == SerializationTag::kUtf8String && flat.IsOneByte()) {
+ Vector<const uint8_t> chars = flat.ToOneByteVector();
+ if (byte_length == static_cast<size_t>(chars.length()) &&
+ String::IsAscii(chars.begin(), chars.length()) &&
+ memcmp(bytes.begin(), chars.begin(), byte_length) == 0) {
+ return true;
+ }
}
position_ = original_position;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698