remove SignatureInfo class
authordcarney <dcarney@chromium.org>
Mon, 19 Jan 2015 12:17:09 +0000 (04:17 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 19 Jan 2015 12:17:23 +0000 (12:17 +0000)
BUG=

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

Cr-Commit-Position: refs/heads/master@{#26129}

include/v8.h
src/api.cc
src/api.h
src/builtins.cc
src/ic/call-optimization.cc
src/objects-debug.cc
src/objects-inl.h
src/objects-printer.cc
src/objects.h
tools/v8heapconst.py

index 2d605c2c8d4fe67624b19f485397ef4db9942522..c6eade0abdf4b33875359cb53ec888c92849c583 100644 (file)
@@ -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>());
index feacc306b0ff906f46116858a57e5362611bdfe7..b953d8b8dd4895c5150242b3be01832b7da6f3d4 100644 (file)
@@ -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));
 }
 
 
index d2a120c92f8285cdac4fa7d23ab14366b60828a1..5f3f33405210b4d0a70df4bd78905d99238d57fa 100644 (file)
--- a/src/api.h
+++ b/src/api.h
@@ -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)
index 3e68ff3cc22d415e54a6aab8302e6d0e82650d3c..782d4141c933ec411a7db8d36692731aef8047fe 100644 (file)
@@ -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!
index 7ef1b7ed82ea9796cd83efbaa3c84fe864a7f9ad..065b1472eb66c3cb8e4a8ac241099b77b032a623 100644 (file)
@@ -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;
index 9c03dcc2eacb4cd93b782e9520a99740fabbcf12..0f54e49347328b4900de29eb5393dd2a50219c45 100644 (file)
@@ -957,13 +957,6 @@ void ObjectTemplateInfo::ObjectTemplateInfoVerify() {
 }
 
 
-void SignatureInfo::SignatureInfoVerify() {
-  CHECK(IsSignatureInfo());
-  VerifyPointer(receiver());
-  VerifyPointer(args());
-}
-
-
 void TypeSwitchInfo::TypeSwitchInfoVerify() {
   CHECK(IsTypeSwitchInfo());
   VerifyPointer(types());
index 076df3d932ec7309bb1aa0a792cc6efa91cece93..9cc7f00dcc16f2f631ce7d3a2ce589e03e9788f2 100644 (file)
@@ -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)
index b7329a98a83b09ccee8d24fc96a7bae07ab05d5a..3af953a0b83f125443dce49459d080ace046ec46 100644 (file)
@@ -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());
index 5b0e714cfc42917662b7739e99ccca0c69c40d32..1ce676c985aa97620db39248a11c450e384f7305 100644 (file)
 //         - 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)
index 613039053139a28f8104eeb02394cf3b8e29462a..8ef0c1093893d2283a512d1c6ff0c0577baf84d4 100644 (file)
@@ -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",
 }