Commit 88619ce5 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[serializer] Fix missing changes to bytecode value encoding

https://crrev.com/c/2369172 had a few remaining comments that
accidentally weren't addressed in the final submitted patch.

Tbr: jgruber@chromium.org
Change-Id: If0cff18f5078f17a6f70d27c71090dcc64f23ddd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2388114Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69662}
parent 42d2cd75
......@@ -217,6 +217,14 @@ class SerializerDeserializer : public RootVisitor {
};
// Helper class for encoding and decoding a value into and from a bytecode.
//
// The value is encoded by allocating an entire bytecode range, and encoding
// the value as an index in that range, starting at kMinValue; thus the range
// of values
// [kMinValue, kMinValue + 1, ... , kMaxValue]
// is encoded as
// [kBytecode, kBytecode + 1, ... , kBytecode + (N - 1)]
// where N is the number of values, i.e. kMaxValue - kMinValue + 1.
template <Bytecode kBytecode, int kMinValue, int kMaxValue,
typename TValue = int>
struct BytecodeValueEncoder {
......@@ -241,7 +249,7 @@ class SerializerDeserializer : public RootVisitor {
template <Bytecode bytecode>
using SpaceEncoder =
BytecodeValueEncoder<bytecode, 0, kNumberOfSpaces, SnapshotSpace>;
BytecodeValueEncoder<bytecode, 0, kNumberOfSpaces - 1, SnapshotSpace>;
using NewObject = SpaceEncoder<kNewObject>;
using BackRef = SpaceEncoder<kBackref>;
......
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