Commit ec010748 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[snapshot] Use adler32 to create the embedded blob checksum

The snapshot's Checksum function internally uses adler32, which
appears to be significantly faster than base::hash_range and almost as
fast as doing nothing at all.

Test times, measured with

$ time tools/run-tests.py --outdir out/release-with-dchecks/
--exit-after-n-failures=1 --quickcheck

base::hash_range: 1m35s
adler32: 1m15s
nop: 1m13s

Bug: chromium:1047818
Change-Id: I8def62f6276a3d06d06911abf5368f59331245ea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2187492Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67649}
parent 13968f9e
......@@ -7,6 +7,7 @@
#include "src/codegen/assembler-inl.h"
#include "src/codegen/callable.h"
#include "src/objects/objects-inl.h"
#include "src/snapshot/snapshot-utils.h"
#include "src/snapshot/snapshot.h"
namespace v8 {
......@@ -306,7 +307,10 @@ Address EmbeddedData::InstructionEndOfBytecodeHandlers() const {
size_t EmbeddedData::CreateEmbeddedBlobHash() const {
STATIC_ASSERT(EmbeddedBlobHashOffset() == 0);
STATIC_ASSERT(EmbeddedBlobHashSize() == kSizetSize);
return base::hash_range(data_ + EmbeddedBlobHashSize(), data_ + size_);
// Hash the entire blob except the hash field itself.
Vector<const byte> payload(data_ + EmbeddedBlobHashSize(),
size_ - EmbeddedBlobHashSize());
return Checksum(payload);
}
void EmbeddedData::PrintStatistics() const {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment