Revision: 12443
Author:   [email protected]
Date:     Wed Sep  5 05:30:49 2012
Log:      Push stacktrace and die if the receiver is of unknown type.

Review URL: https://chromiumcodereview.appspot.com/10917086
http://code.google.com/p/v8/source/detail?r=12443

Modified:
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/isolate.h
 /branches/bleeding_edge/src/objects.cc

=======================================
--- /branches/bleeding_edge/src/isolate.cc      Tue Aug 28 07:43:28 2012
+++ /branches/bleeding_edge/src/isolate.cc      Wed Sep  5 05:30:49 2012
@@ -533,6 +533,24 @@
     return factory()->empty_symbol();
   }
 }
+
+
+void Isolate::PushStackTraceAndDie(unsigned int magic,
+                                   Object* object,
+                                   Map* map,
+                                   unsigned int magic2) {
+  const int kMaxStackTraceSize = 8192;
+  Handle<String> trace = StackTraceString();
+  char buffer[kMaxStackTraceSize];
+  int length = Min(kMaxStackTraceSize - 1, trace->length());
+  String::WriteToFlat(*trace, buffer, 0, length);
+  buffer[length] = '\0';
+  OS::PrintError("Stacktrace (%x-%x) %p %p: %s\n",
+                 magic, magic2,
+                 static_cast<void*>(object), static_cast<void*>(map),
+                 buffer);
+  OS::Abort();
+}


void Isolate::CaptureAndSetCurrentStackTraceFor(Handle<JSObject> error_object) {
=======================================
--- /branches/bleeding_edge/src/isolate.h       Tue Aug 28 04:25:08 2012
+++ /branches/bleeding_edge/src/isolate.h       Wed Sep  5 05:30:49 2012
@@ -707,6 +707,10 @@
   void PrintStack(StringStream* accumulator);
   void PrintStack();
   Handle<String> StackTraceString();
+  NO_INLINE(void PushStackTraceAndDie(unsigned int magic,
+                                      Object* object,
+                                      Map* map,
+                                      unsigned int magic2));
   Handle<JSArray> CaptureCurrentStackTrace(
       int frame_limit,
       StackTrace::StackTraceOptions options);
=======================================
--- /branches/bleeding_edge/src/objects.cc      Mon Sep  3 06:27:17 2012
+++ /branches/bleeding_edge/src/objects.cc      Wed Sep  5 05:30:49 2012
@@ -141,6 +141,9 @@
       holder = native_context->string_function()->instance_prototype();
     } else if (IsBoolean()) {
       holder = native_context->boolean_function()->instance_prototype();
+    } else {
+      Isolate::Current()->PushStackTraceAndDie(
+          0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001);
     }
   }
   ASSERT(holder != NULL);  // Cannot handle null or undefined.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to