Commit a16c3c91 authored by jbroman's avatar jbroman Committed by Commit bot

Expose the ValueSerializer data format version as a compile-time constant.

BUG=chromium:704293

Review-Url: https://codereview.chromium.org/2804643006
Cr-Commit-Position: refs/heads/master@{#44945}
parent 5317d43e
......@@ -1012,6 +1012,7 @@ v8_header_set("v8_version") {
configs = [ ":internal_config" ]
sources = [
"include/v8-value-serializer-version.h",
"include/v8-version-string.h",
"include/v8-version.h",
]
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* Compile-time constants.
*
* This header provides access to information about the value serializer at
* compile time, without declaring or defining any symbols that require linking
* to V8.
*/
#ifndef INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_
#define INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_
#include <stdint.h>
namespace v8 {
constexpr uint32_t CurrentValueSerializerFormatVersion() { return 13; }
} // namespace v8
#endif // INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_
......@@ -1793,8 +1793,6 @@ class V8_EXPORT ValueSerializer {
virtual void FreeBufferMemory(void* buffer);
};
static uint32_t GetCurrentDataFormatVersion();
explicit ValueSerializer(Isolate* isolate);
ValueSerializer(Isolate* isolate, Delegate* delegate);
~ValueSerializer();
......
......@@ -3215,11 +3215,6 @@ struct ValueSerializer::PrivateData {
i::ValueSerializer serializer;
};
// static
uint32_t ValueSerializer::GetCurrentDataFormatVersion() {
return i::ValueSerializer::GetCurrentDataFormatVersion();
}
ValueSerializer::ValueSerializer(Isolate* isolate)
: ValueSerializer(isolate, nullptr) {}
......
......@@ -389,6 +389,7 @@
'../include/v8-profiler.h',
'../include/v8-testing.h',
'../include/v8-util.h',
'../include/v8-value-serializer-version.h',
'../include/v8-version-string.h',
'../include/v8-version.h',
'../include/v8.h',
......
......@@ -6,6 +6,7 @@
#include <type_traits>
#include "include/v8-value-serializer-version.h"
#include "src/base/logging.h"
#include "src/conversions.h"
#include "src/factory.h"
......@@ -30,6 +31,8 @@ namespace internal {
// Version 13: host objects have an explicit tag (rather than handling all
// unknown tags)
static const uint32_t kLatestVersion = 13;
static_assert(kLatestVersion == v8::CurrentValueSerializerFormatVersion(),
"Exported format version must match latest version.");
static const int kPretenureThreshold = 100 * KB;
......@@ -154,11 +157,6 @@ enum class WasmEncodingTag : uint8_t {
} // namespace
// static
uint32_t ValueSerializer::GetCurrentDataFormatVersion() {
return kLatestVersion;
}
ValueSerializer::ValueSerializer(Isolate* isolate,
v8::ValueSerializer::Delegate* delegate)
: isolate_(isolate),
......
......@@ -43,8 +43,6 @@ enum class SerializationTag : uint8_t;
*/
class ValueSerializer {
public:
static uint32_t GetCurrentDataFormatVersion();
ValueSerializer(Isolate* isolate, v8::ValueSerializer::Delegate* delegate);
~ValueSerializer();
......
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