Commit 99a927c6 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[api] Remove obsolete FunctionTemplate::SetHiddenPrototype().

The `FunctionTemplate::SetHiddenPrototype()` API was deprecated
beginning of the year and all uses in Node.js and Chrome have been
removed appropriately. This removes the implementation of the method
and the bit in the `FunctionTemplateInfo`, but retains the bit in
the Map for now. That will be cleaned up as a second step later.

Bug: v8:9183, v8:9267
Change-Id: I9aa2fc484b3321f4f42a29a0a38d72a6d30054a7
Cq-Include-Trybots: luci.chromium.try:linux-rel,win7-rel
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1627329
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61771}
parent 5b46f573
......@@ -5902,21 +5902,6 @@ class V8_EXPORT FunctionTemplate : public Template {
*/
void SetAcceptAnyReceiver(bool value);
/**
* Determines whether the __proto__ accessor ignores instances of
* the function template. If instances of the function template are
* ignored, __proto__ skips all instances and instead returns the
* next object in the prototype chain.
*
* Call with a value of true to make the __proto__ accessor ignore
* instances of the function template. Call with a value of false
* to make the __proto__ accessor not ignore instances of the
* function template. By default, instances of a function template
* are not ignored.
*/
V8_DEPRECATED("This feature is incompatible with ES6+.",
void SetHiddenPrototype(bool value));
/**
* Sets the ReadOnly flag in the attributes of the 'prototype' property
* of functions created from this FunctionTemplate to true.
......
......@@ -486,7 +486,7 @@ MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate,
InstantiateObject(
isolate,
handle(ObjectTemplateInfo::cast(prototype_templ), isolate),
Handle<JSReceiver>(), data->hidden_prototype(), true),
Handle<JSReceiver>(), false, true),
JSFunction);
}
Object parent = data->GetParentTemplate();
......@@ -515,7 +515,7 @@ MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate,
function);
}
MaybeHandle<JSObject> result =
ConfigureInstance(isolate, function, data, data->hidden_prototype());
ConfigureInstance(isolate, function, data, false);
if (result.is_null()) {
// Uncache on error.
if (serial_number) {
......
......@@ -1607,14 +1607,6 @@ void FunctionTemplate::SetAcceptAnyReceiver(bool value) {
info->set_accept_any_receiver(value);
}
void FunctionTemplate::SetHiddenPrototype(bool value) {
auto info = Utils::OpenHandle(this);
EnsureNotInstantiated(info, "v8::FunctionTemplate::SetHiddenPrototype");
auto isolate = info->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
info->set_hidden_prototype(value);
}
void FunctionTemplate::ReadOnlyPrototype() {
auto info = Utils::OpenHandle(this);
EnsureNotInstantiated(info, "v8::FunctionTemplate::ReadOnlyPrototype");
......
......@@ -2001,7 +2001,6 @@ void FunctionTemplateInfo::FunctionTemplateInfoPrint(
os << "\n - property_accessors: " << Brief(property_accessors());
os << "\n - signature: " << Brief(signature());
os << "\n - cached_property_name: " << Brief(cached_property_name());
os << "\n - hidden_prototype: " << (hidden_prototype() ? "true" : "false");
os << "\n - undetectable: " << (undetectable() ? "true" : "false");
os << "\n - need_access_check: " << (needs_access_check() ? "true" : "false");
os << "\n - instantiated: " << (instantiated() ? "true" : "false");
......
......@@ -2642,27 +2642,13 @@ void Map::SetPrototype(Isolate* isolate, Handle<Map> map,
RuntimeCallTimerScope stats_scope(isolate, *map,
RuntimeCallCounterId::kMap_SetPrototype);
bool is_hidden = false;
if (prototype->IsJSObject()) {
Handle<JSObject> prototype_jsobj = Handle<JSObject>::cast(prototype);
JSObject::OptimizeAsPrototype(prototype_jsobj, enable_prototype_setup_mode);
Object maybe_constructor = prototype_jsobj->map().GetConstructor();
if (maybe_constructor.IsJSFunction()) {
JSFunction constructor = JSFunction::cast(maybe_constructor);
Object data = constructor.shared().function_data();
is_hidden = (data.IsFunctionTemplateInfo() &&
FunctionTemplateInfo::cast(data).hidden_prototype()) ||
prototype->IsJSGlobalObject();
} else if (maybe_constructor.IsFunctionTemplateInfo()) {
is_hidden =
FunctionTemplateInfo::cast(maybe_constructor).hidden_prototype() ||
prototype->IsJSGlobalObject();
}
} else {
DCHECK(prototype->IsNull(isolate) || prototype->IsJSProxy());
}
map->set_has_hidden_prototype(is_hidden);
map->set_has_hidden_prototype(prototype->IsJSGlobalObject());
WriteBarrierMode wb_mode =
prototype->IsNull(isolate) ? SKIP_WRITE_BARRIER : UPDATE_WRITE_BARRIER;
......
......@@ -40,8 +40,6 @@ ACCESSORS(FunctionTemplateInfo, rare_data, HeapObject,
ACCESSORS(FunctionTemplateInfo, cached_property_name, Object,
kCachedPropertyNameOffset)
SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset)
BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype,
kHiddenPrototypeBit)
BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit)
BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check,
kNeedsAccessCheckBit)
......
......@@ -139,7 +139,6 @@ class FunctionTemplateInfo : public TemplateInfo {
DECL_ACCESSORS(cached_property_name, Object)
// Begin flag bits ---------------------
DECL_BOOLEAN_ACCESSORS(hidden_prototype)
DECL_BOOLEAN_ACCESSORS(undetectable)
// If set, object instances created by this function
......@@ -189,13 +188,12 @@ class FunctionTemplateInfo : public TemplateInfo {
Handle<Object> getter);
// Bit position in the flag, from least significant bit position.
static const int kHiddenPrototypeBit = 0;
static const int kUndetectableBit = 1;
static const int kNeedsAccessCheckBit = 2;
static const int kReadOnlyPrototypeBit = 3;
static const int kRemovePrototypeBit = 4;
static const int kDoNotCacheBit = 5;
static const int kAcceptAnyReceiver = 6;
static const int kUndetectableBit = 0;
static const int kNeedsAccessCheckBit = 1;
static const int kReadOnlyPrototypeBit = 2;
static const int kRemovePrototypeBit = 3;
static const int kDoNotCacheBit = 4;
static const int kAcceptAnyReceiver = 5;
private:
static inline FunctionTemplateRareData EnsureFunctionTemplateRareData(
......
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