Skip to content

Commit

Permalink
deps: cherry-pick a16c3c9 from upstream V8
Browse files Browse the repository at this point in the history
Original commit message:

    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}

PR-URL: #13515
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
jeremyroman authored and addaleax committed Jul 24, 2017
1 parent e3fcdef commit 8e96729
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 14 deletions.
1 change: 1 addition & 0 deletions deps/v8/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,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",
]
Expand Down
24 changes: 24 additions & 0 deletions deps/v8/include/v8-value-serializer-version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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_
2 changes: 0 additions & 2 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -1789,8 +1789,6 @@ class V8_EXPORT ValueSerializer {
virtual void FreeBufferMemory(void* buffer);
};

static uint32_t GetCurrentDataFormatVersion();

explicit ValueSerializer(Isolate* isolate);
ValueSerializer(Isolate* isolate, Delegate* delegate);
~ValueSerializer();
Expand Down
5 changes: 0 additions & 5 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3225,11 +3225,6 @@ struct ValueSerializer::PrivateData {
i::ValueSerializer serializer;
};

// static
uint32_t ValueSerializer::GetCurrentDataFormatVersion() {
return i::ValueSerializer::GetCurrentDataFormatVersion();
}

ValueSerializer::ValueSerializer(Isolate* isolate)
: ValueSerializer(isolate, nullptr) {}

Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
8 changes: 3 additions & 5 deletions deps/v8/src/value-serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;

Expand Down Expand Up @@ -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),
Expand Down
2 changes: 0 additions & 2 deletions deps/v8/src/value-serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ enum class SerializationTag : uint8_t;
*/
class ValueSerializer {
public:
static uint32_t GetCurrentDataFormatVersion();

ValueSerializer(Isolate* isolate, v8::ValueSerializer::Delegate* delegate);
~ValueSerializer();

Expand Down

0 comments on commit 8e96729

Please sign in to comment.