Commit c15c7373 authored by dcarney's avatar dcarney Committed by Commit bot

remove SignatureInfo class

BUG=

Review URL: https://codereview.chromium.org/855903002

Cr-Commit-Position: refs/heads/master@{#26129}
parent db653e54
......@@ -4103,11 +4103,6 @@ class V8_EXPORT ObjectTemplate : public Template {
*/
class V8_EXPORT Signature : public Data {
public:
V8_DEPRECATED("An embedder needs to check the arguments itself",
static Local<Signature> New(
Isolate* isolate, Handle<FunctionTemplate> receiver,
int argc, Handle<FunctionTemplate> argv[] = 0));
static Local<Signature> New(
Isolate* isolate,
Handle<FunctionTemplate> receiver = Handle<FunctionTemplate>());
......
......@@ -854,39 +854,9 @@ Local<FunctionTemplate> FunctionTemplate::New(
}
Local<Signature> Signature::New(Isolate* isolate,
Handle<FunctionTemplate> receiver, int argc,
Handle<FunctionTemplate> argv[]) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
LOG_API(i_isolate, "Signature::New");
ENTER_V8(i_isolate);
i::Handle<i::SignatureInfo> obj =
Utils::OpenHandle(*Signature::New(isolate, receiver));
if (argc > 0) {
i::Handle<i::FixedArray> args = i_isolate->factory()->NewFixedArray(argc);
for (int i = 0; i < argc; i++) {
if (!argv[i].IsEmpty())
args->set(i, *Utils::OpenHandle(*argv[i]));
}
obj->set_args(*args);
}
return Utils::ToLocal(obj);
}
Local<Signature> Signature::New(Isolate* isolate,
Handle<FunctionTemplate> receiver) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
LOG_API(i_isolate, "Signature::New");
ENTER_V8(i_isolate);
i::Handle<i::Struct> struct_obj =
i_isolate->factory()->NewStruct(i::SIGNATURE_INFO_TYPE);
// TODO(jochen): Replace SignatureInfo with FunctionTemplateInfo once the
// deprecated API is deleted.
i::Handle<i::SignatureInfo> obj =
i::Handle<i::SignatureInfo>::cast(struct_obj);
if (!receiver.IsEmpty()) obj->set_receiver(*Utils::OpenHandle(*receiver));
return Utils::ToLocal(obj);
return Utils::SignatureToLocal(Utils::OpenHandle(*receiver));
}
......
......@@ -139,7 +139,7 @@ class RegisteredExtension {
V(Template, TemplateInfo) \
V(FunctionTemplate, FunctionTemplateInfo) \
V(ObjectTemplate, ObjectTemplateInfo) \
V(Signature, SignatureInfo) \
V(Signature, FunctionTemplateInfo) \
V(AccessorSignature, FunctionTemplateInfo) \
V(TypeSwitch, TypeSwitchInfo) \
V(Data, Object) \
......@@ -247,8 +247,8 @@ class Utils {
v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
static inline Local<ObjectTemplate> ToLocal(
v8::internal::Handle<v8::internal::ObjectTemplateInfo> obj);
static inline Local<Signature> ToLocal(
v8::internal::Handle<v8::internal::SignatureInfo> obj);
static inline Local<Signature> SignatureToLocal(
v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
static inline Local<AccessorSignature> AccessorSignatureToLocal(
v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
static inline Local<TypeSwitch> ToLocal(
......@@ -350,7 +350,7 @@ TYPED_ARRAYS(MAKE_TO_LOCAL_TYPED_ARRAY)
MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate)
MAKE_TO_LOCAL(ToLocal, ObjectTemplateInfo, ObjectTemplate)
MAKE_TO_LOCAL(ToLocal, SignatureInfo, Signature)
MAKE_TO_LOCAL(SignatureToLocal, FunctionTemplateInfo, Signature)
MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature)
MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch)
MAKE_TO_LOCAL(MessageToLocal, Object, Message)
......
......@@ -1045,38 +1045,18 @@ static inline Object* FindHidden(Heap* heap,
// overwritten with undefined. Note that holder and the arguments are
// implicitly rewritten with the first object in the hidden prototype
// chain that actually has the expected type.
static inline Object* TypeCheck(Heap* heap,
int argc,
Object** argv,
static inline Object* TypeCheck(Heap* heap, Object* recv,
FunctionTemplateInfo* info) {
Object* recv = argv[0];
// API calls are only supported with JSObject receivers.
if (!recv->IsJSObject()) return heap->null_value();
Object* sig_obj = info->signature();
if (sig_obj->IsUndefined()) return recv;
SignatureInfo* sig = SignatureInfo::cast(sig_obj);
Object* recv_type = info->signature();
if (recv_type->IsUndefined()) return recv;
// If necessary, check the receiver
Object* recv_type = sig->receiver();
Object* holder = recv;
if (!recv_type->IsUndefined()) {
holder = FindHidden(heap, holder, FunctionTemplateInfo::cast(recv_type));
if (holder == heap->null_value()) return heap->null_value();
}
Object* args_obj = sig->args();
// If there is no argument signature we're done
if (args_obj->IsUndefined()) return holder;
FixedArray* args = FixedArray::cast(args_obj);
int length = args->length();
if (argc <= length) length = argc - 1;
for (int i = 0; i < length; i++) {
Object* argtype = args->get(i);
if (argtype->IsUndefined()) continue;
Object** arg = &argv[-1 - i];
Object* current = *arg;
current = FindHidden(heap, current, FunctionTemplateInfo::cast(argtype));
if (current == heap->null_value()) current = heap->undefined_value();
*arg = current;
}
return holder;
}
......@@ -1101,14 +1081,10 @@ MUST_USE_RESULT static Object* HandleApiCallHelper(
fun_data, Handle<JSObject>::cast(args.receiver())));
}
SharedFunctionInfo* shared = function->shared();
if (shared->strict_mode() == SLOPPY && !shared->native()) {
Object* recv = args[0];
DCHECK(!recv->IsNull());
if (recv->IsUndefined()) args[0] = function->global_proxy();
}
DCHECK(!args[0]->IsNull());
if (args[0]->IsUndefined()) args[0] = function->global_proxy();
Object* raw_holder = TypeCheck(heap, args.length(), &args[0], *fun_data);
Object* raw_holder = TypeCheck(heap, args[0], *fun_data);
if (raw_holder->IsNull()) {
// This function cannot be called with the given receiver. Abort!
......
......@@ -92,19 +92,11 @@ void CallOptimization::AnalyzePossibleApiFunction(Handle<JSFunction> function) {
// Require a C++ callback.
if (info->call_code()->IsUndefined()) return;
api_call_info_ =
Handle<CallHandlerInfo>(CallHandlerInfo::cast(info->call_code()));
api_call_info_ = handle(CallHandlerInfo::cast(info->call_code()));
// Accept signatures that either have no restrictions at all or
// only have restrictions on the receiver.
if (!info->signature()->IsUndefined()) {
Handle<SignatureInfo> signature =
Handle<SignatureInfo>(SignatureInfo::cast(info->signature()));
if (!signature->args()->IsUndefined()) return;
if (!signature->receiver()->IsUndefined()) {
expected_receiver_type_ = Handle<FunctionTemplateInfo>(
FunctionTemplateInfo::cast(signature->receiver()));
}
expected_receiver_type_ =
handle(FunctionTemplateInfo::cast(info->signature()));
}
is_simple_api_call_ = true;
......
......@@ -957,13 +957,6 @@ void ObjectTemplateInfo::ObjectTemplateInfoVerify() {
}
void SignatureInfo::SignatureInfoVerify() {
CHECK(IsSignatureInfo());
VerifyPointer(receiver());
VerifyPointer(args());
}
void TypeSwitchInfo::TypeSwitchInfoVerify() {
CHECK(IsTypeSwitchInfo());
VerifyPointer(types());
......
......@@ -5540,9 +5540,6 @@ ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset)
ACCESSORS(ObjectTemplateInfo, internal_field_count, Object,
kInternalFieldCountOffset)
ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset)
ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset)
ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset)
......
......@@ -941,14 +941,6 @@ void ObjectTemplateInfo::ObjectTemplateInfoPrint(std::ostream& os) { // NOLINT
}
void SignatureInfo::SignatureInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "SignatureInfo");
os << "\n - receiver: " << Brief(receiver());
os << "\n - args: " << Brief(args());
os << "\n";
}
void TypeSwitchInfo::TypeSwitchInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "TypeSwitchInfo");
os << "\n - types: " << Brief(types());
......
......@@ -140,7 +140,6 @@
// - FunctionTemplateInfo
// - ObjectTemplateInfo
// - Script
// - SignatureInfo
// - TypeSwitchInfo
// - DebugInfo
// - BreakPointInfo
......@@ -527,7 +526,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \
V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \
V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \
V(SIGNATURE_INFO, SignatureInfo, signature_info) \
V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \
V(SCRIPT, Script, script) \
V(ALLOCATION_SITE, AllocationSite, allocation_site) \
......@@ -10684,26 +10682,6 @@ class ObjectTemplateInfo: public TemplateInfo {
};
class SignatureInfo: public Struct {
public:
DECL_ACCESSORS(receiver, Object)
DECL_ACCESSORS(args, Object)
DECLARE_CAST(SignatureInfo)
// Dispatched behavior.
DECLARE_PRINTER(SignatureInfo)
DECLARE_VERIFIER(SignatureInfo)
static const int kReceiverOffset = Struct::kHeaderSize;
static const int kArgsOffset = kReceiverOffset + kPointerSize;
static const int kSize = kArgsOffset + kPointerSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo);
};
class TypeSwitchInfo: public Struct {
public:
DECL_ACCESSORS(types, Object)
......
......@@ -216,8 +216,8 @@ KNOWN_MAPS = {
0x08cd9: (187, "JSMessageObjectMap"),
0x08d01: (136, "ForeignMap"),
0x08d29: (189, "NeanderMap"),
0x08d51: (170, "AllocationSiteMap"),
0x08d79: (171, "AllocationMementoMap"),
0x08d51: (171, "AllocationMementoMap"),
0x08d79: (170, "AllocationSiteMap"),
0x08da1: (174, "PolymorphicCodeCacheMap"),
0x08dc9: (172, "ScriptMap"),
0x08e19: (189, "ExternalMap"),
......@@ -229,13 +229,12 @@ KNOWN_MAPS = {
0x09021: (165, "CallHandlerInfoMap"),
0x09049: (166, "FunctionTemplateInfoMap"),
0x09071: (167, "ObjectTemplateInfoMap"),
0x09099: (168, "SignatureInfoMap"),
0x090c1: (169, "TypeSwitchInfoMap"),
0x090e9: (173, "CodeCacheMap"),
0x09111: (175, "TypeFeedbackInfoMap"),
0x09139: (176, "AliasedArgumentsEntryMap"),
0x09161: (178, "DebugInfoMap"),
0x09189: (179, "BreakPointInfoMap"),
0x09099: (169, "TypeSwitchInfoMap"),
0x090c1: (173, "CodeCacheMap"),
0x090e9: (175, "TypeFeedbackInfoMap"),
0x09111: (176, "AliasedArgumentsEntryMap"),
0x09139: (178, "DebugInfoMap"),
0x09161: (179, "BreakPointInfoMap"),
}
# List of known V8 objects.
......@@ -265,7 +264,7 @@ KNOWN_OBJECTS = {
("OLD_POINTER_SPACE", 0x17685): "SymbolRegistry",
("OLD_POINTER_SPACE", 0x18041): "EmptySlowElementDictionary",
("OLD_POINTER_SPACE", 0x181dd): "AllocationSitesScratchpad",
("OLD_POINTER_SPACE", 0x4559d): "StringTable",
("OLD_POINTER_SPACE", 0x4560d): "StringTable",
("OLD_DATA_SPACE", 0x08081): "EmptyDescriptorArray",
("OLD_DATA_SPACE", 0x08089): "EmptyFixedArray",
("OLD_DATA_SPACE", 0x080a9): "NanValue",
......@@ -291,6 +290,6 @@ KNOWN_OBJECTS = {
("OLD_DATA_SPACE", 0x082ed): "EmptyFixedUint8ClampedArray",
("OLD_DATA_SPACE", 0x082f5): "InfinityValue",
("OLD_DATA_SPACE", 0x08301): "MinusZeroValue",
("CODE_SPACE", 0x136a1): "JsConstructEntryCode",
("CODE_SPACE", 0x2c421): "JsEntryCode",
("CODE_SPACE", 0x16881): "JsEntryCode",
("CODE_SPACE", 0x2a8e1): "JsConstructEntryCode",
}
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