Commit 61d25b01 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Push stacktrace and die if the receiver is of unknown type.

Review URL: https://chromiumcodereview.appspot.com/10917086

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12443 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9ff7ec1c
......@@ -535,6 +535,24 @@ Handle<String> Isolate::StackTraceString() {
}
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) {
if (capture_stack_trace_for_uncaught_exceptions_) {
// Capture stack trace for a detailed exception message.
......
......@@ -707,6 +707,10 @@ class Isolate {
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);
......
......@@ -141,6 +141,9 @@ void Object::Lookup(String* name, LookupResult* result) {
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.
......
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