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

Unified Diff: src/snapshot-source-sink.h

Issue 1008923003: Serializer: micro-optimizations for the deserializer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « src/serialize.cc ('k') | src/snapshot-source-sink.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot-source-sink.h
diff --git a/src/snapshot-source-sink.h b/src/snapshot-source-sink.h
index 66feaecca4ff5024b63838cf9c040aea3f172591..c105607ef376c84c6263b35acd2e6276d1fb6147 100644
--- a/src/snapshot-source-sink.h
+++ b/src/snapshot-source-sink.h
@@ -36,16 +36,17 @@ class SnapshotByteSource FINAL {
return data_[position_++];
}
- int32_t GetUnalignedInt();
-
void Advance(int by) { position_ += by; }
void CopyRaw(byte* to, int number_of_bytes);
inline int GetInt() {
- // This way of variable-length encoding integers does not suffer from branch
- // mispredictions.
- uint32_t answer = GetUnalignedInt();
+ // This way of decoding variable-length encoded integers does not
+ // suffer from branch mispredictions.
vogelheim 2015/03/16 15:23:08 Any idea why the compiler didn't inline GetUnalign
vogelheim 2015/03/16 15:23:08 The DCHECK for exceeding the buffer is gone. Was t
+ uint32_t answer = data_[position_];
+ answer |= data_[position_ + 1] << 8;
+ answer |= data_[position_ + 2] << 16;
+ answer |= data_[position_ + 3] << 24;
int bytes = (answer & 3) + 1;
Advance(bytes);
uint32_t mask = 0xffffffffu;
« no previous file with comments | « src/serialize.cc ('k') | src/snapshot-source-sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698