Skip to content

Commit

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

    [api] remove deprecated snapshot APIs

    R=verwaest@chromium.org

    Fixed: v8:7463
    Change-Id: I3d0127865ad0430d38124c3ad8ed3bc63ba4e6d3
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2149421
    Auto-Submit: Yang Guo <yangguo@chromium.org>
    Commit-Queue: Toon Verwaest <verwaest@chromium.org>
    Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#67169}

Refs: v8/v8@fa3e37e

PR-URL: nodejs#32885
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
  • Loading branch information
addaleax authored and targos committed May 23, 2020
1 parent 1c1c8de commit 8a40a30
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 52 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.14',
'v8_embedder_string': '-node.15',

##### V8 defaults for Node.js #####

Expand Down
17 changes: 0 additions & 17 deletions deps/v8/include/v8.h
Expand Up @@ -6451,11 +6451,6 @@ class V8_EXPORT FunctionTemplate : public Template {
SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
const CFunction* c_function = nullptr);

/** Get a template included in the snapshot by index. */
V8_DEPRECATED("Use v8::Isolate::GetDataFromSnapshotOnce instead")
static MaybeLocal<FunctionTemplate> FromSnapshot(Isolate* isolate,
size_t index);

/**
* Creates a function template backed/cached by a private property.
*/
Expand Down Expand Up @@ -6745,11 +6740,6 @@ class V8_EXPORT ObjectTemplate : public Template {
Isolate* isolate,
Local<FunctionTemplate> constructor = Local<FunctionTemplate>());

/** Get a template included in the snapshot by index. */
V8_DEPRECATED("Use v8::Isolate::GetDataFromSnapshotOnce instead")
static MaybeLocal<ObjectTemplate> FromSnapshot(Isolate* isolate,
size_t index);

/** Creates a new instance of this template.*/
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);

Expand Down Expand Up @@ -9862,13 +9852,6 @@ class V8_EXPORT SnapshotCreator {
SerializeInternalFieldsCallback callback =
SerializeInternalFieldsCallback());

/**
* Add a template to be included in the snapshot blob.
* \returns the index of the template in the snapshot blob.
*/
V8_DEPRECATED("use AddData instead")
size_t AddTemplate(Local<Template> template_obj);

/**
* Attach arbitrary V8::Data to the context snapshot, which can be retrieved
* via Context::GetDataFromSnapshot after deserialization. This data does not
Expand Down
34 changes: 0 additions & 34 deletions deps/v8/src/api/api.cc
Expand Up @@ -659,10 +659,6 @@ size_t SnapshotCreator::AddContext(Local<Context> context,
return index;
}

size_t SnapshotCreator::AddTemplate(Local<Template> template_obj) {
return AddData(template_obj);
}

size_t SnapshotCreator::AddData(i::Address object) {
DCHECK_NE(object, i::kNullAddress);
SnapshotCreatorData* data = SnapshotCreatorData::cast(data_);
Expand Down Expand Up @@ -1523,21 +1519,6 @@ Local<FunctionTemplate> FunctionTemplate::New(
return templ;
}

MaybeLocal<FunctionTemplate> FunctionTemplate::FromSnapshot(Isolate* isolate,
size_t index) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::FixedArray serialized_objects = i_isolate->heap()->serialized_objects();
int int_index = static_cast<int>(index);
if (int_index < serialized_objects.length()) {
i::Object info = serialized_objects.get(int_index);
if (info.IsFunctionTemplateInfo()) {
return Utils::ToLocal(i::Handle<i::FunctionTemplateInfo>(
i::FunctionTemplateInfo::cast(info), i_isolate));
}
}
return Local<FunctionTemplate>();
}

Local<FunctionTemplate> FunctionTemplate::NewWithCache(
Isolate* isolate, FunctionCallback callback, Local<Private> cache_property,
Local<Value> data, Local<Signature> signature, int length,
Expand Down Expand Up @@ -1730,21 +1711,6 @@ Local<ObjectTemplate> ObjectTemplate::New(
return ObjectTemplateNew(isolate, constructor, false);
}

MaybeLocal<ObjectTemplate> ObjectTemplate::FromSnapshot(Isolate* isolate,
size_t index) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::FixedArray serialized_objects = i_isolate->heap()->serialized_objects();
int int_index = static_cast<int>(index);
if (int_index < serialized_objects.length()) {
i::Object info = serialized_objects.get(int_index);
if (info.IsObjectTemplateInfo()) {
return Utils::ToLocal(i::Handle<i::ObjectTemplateInfo>(
i::ObjectTemplateInfo::cast(info), i_isolate));
}
}
return Local<ObjectTemplate>();
}

// Ensure that the object template has a constructor. If no
// constructor is available we create one.
static i::Handle<i::FunctionTemplateInfo> EnsureConstructor(
Expand Down

0 comments on commit 8a40a30

Please sign in to comment.