Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: src/api.cc

Issue 2961003: Allow to capture stack trace for uncaught exceptions (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 i::Handle<i::JSObject> obj = 1431 i::Handle<i::JSObject> obj =
1432 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this)); 1432 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
1433 // Return this.script.data. 1433 // Return this.script.data.
1434 i::Handle<i::JSValue> script = 1434 i::Handle<i::JSValue> script =
1435 i::Handle<i::JSValue>::cast(GetProperty(obj, "script")); 1435 i::Handle<i::JSValue>::cast(GetProperty(obj, "script"));
1436 i::Handle<i::Object> data(i::Script::cast(script->value())->data()); 1436 i::Handle<i::Object> data(i::Script::cast(script->value())->data());
1437 return scope.Close(Utils::ToLocal(data)); 1437 return scope.Close(Utils::ToLocal(data));
1438 } 1438 }
1439 1439
1440 1440
1441 v8::Handle<v8::StackTrace> Message::GetStackTrace() const {
1442 if (IsDeadCheck("v8::Message::GetStackTrace()")) {
1443 return Local<v8::StackTrace>();
1444 }
1445 ENTER_V8;
1446 HandleScope scope;
1447 i::Handle<i::JSObject> obj =
1448 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
1449 i::Handle<i::Object> stackFramesObj = GetProperty(obj, "stackFrames");
1450 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>();
1451 i::Handle<i::JSArray> stackTrace =
1452 i::Handle<i::JSArray>::cast(stackFramesObj);
1453 return scope.Close(Utils::StackTraceToLocal(stackTrace));
1454 }
1455
1456
1441 static i::Handle<i::Object> CallV8HeapFunction(const char* name, 1457 static i::Handle<i::Object> CallV8HeapFunction(const char* name,
1442 i::Handle<i::Object> recv, 1458 i::Handle<i::Object> recv,
1443 int argc, 1459 int argc,
1444 i::Object** argv[], 1460 i::Object** argv[],
1445 bool* has_pending_exception) { 1461 bool* has_pending_exception) {
1446 i::Handle<i::String> fmt_str = i::Factory::LookupAsciiSymbol(name); 1462 i::Handle<i::String> fmt_str = i::Factory::LookupAsciiSymbol(name);
1447 i::Object* object_fun = i::Top::builtins()->GetProperty(*fmt_str); 1463 i::Object* object_fun = i::Top::builtins()->GetProperty(*fmt_str);
1448 i::Handle<i::JSFunction> fun = 1464 i::Handle<i::JSFunction> fun =
1449 i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun)); 1465 i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun));
1450 i::Handle<i::Object> value = 1466 i::Handle<i::Object> value =
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 if (IsDeadCheck("v8::StackTrace::AsArray()")) Local<Array>(); 1592 if (IsDeadCheck("v8::StackTrace::AsArray()")) Local<Array>();
1577 ENTER_V8; 1593 ENTER_V8;
1578 return Utils::ToLocal(Utils::OpenHandle(this)); 1594 return Utils::ToLocal(Utils::OpenHandle(this));
1579 } 1595 }
1580 1596
1581 1597
1582 Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit, 1598 Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit,
1583 StackTraceOptions options) { 1599 StackTraceOptions options) {
1584 if (IsDeadCheck("v8::StackTrace::CurrentStackTrace()")) Local<StackTrace>(); 1600 if (IsDeadCheck("v8::StackTrace::CurrentStackTrace()")) Local<StackTrace>();
1585 ENTER_V8; 1601 ENTER_V8;
1586 return i::Top::CaptureCurrentStackTrace(frame_limit, options); 1602 i::Handle<i::JSArray> stackTrace =
1603 i::Top::CaptureCurrentStackTrace(frame_limit, options);
1604 return Utils::StackTraceToLocal(stackTrace);
1587 } 1605 }
1588 1606
1589 1607
1590 // --- S t a c k F r a m e --- 1608 // --- S t a c k F r a m e ---
1591 1609
1592 int StackFrame::GetLineNumber() const { 1610 int StackFrame::GetLineNumber() const {
1593 if (IsDeadCheck("v8::StackFrame::GetLineNumber()")) { 1611 if (IsDeadCheck("v8::StackFrame::GetLineNumber()")) {
1594 return Message::kNoLineNumberInfo; 1612 return Message::kNoLineNumberInfo;
1595 } 1613 }
1596 ENTER_V8; 1614 ENTER_V8;
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
3775 3793
3776 NeanderObject listener(i::JSObject::cast(listeners.get(i))); 3794 NeanderObject listener(i::JSObject::cast(listeners.get(i)));
3777 i::Handle<i::Proxy> callback_obj(i::Proxy::cast(listener.get(0))); 3795 i::Handle<i::Proxy> callback_obj(i::Proxy::cast(listener.get(0)));
3778 if (callback_obj->proxy() == FUNCTION_ADDR(that)) { 3796 if (callback_obj->proxy() == FUNCTION_ADDR(that)) {
3779 listeners.set(i, i::Heap::undefined_value()); 3797 listeners.set(i, i::Heap::undefined_value());
3780 } 3798 }
3781 } 3799 }
3782 } 3800 }
3783 3801
3784 3802
3803 void V8::SetCaptureStackTraceForUncaughtExceptions(
3804 bool capture,
3805 int frame_limit,
3806 StackTrace::StackTraceOptions options) {
3807 i::Top::SetCaptureStackTraceForUncaughtExceptions(
3808 capture,
3809 frame_limit,
3810 options);
3811 }
3812
3813
3785 void V8::SetCounterFunction(CounterLookupCallback callback) { 3814 void V8::SetCounterFunction(CounterLookupCallback callback) {
3786 if (IsDeadCheck("v8::V8::SetCounterFunction()")) return; 3815 if (IsDeadCheck("v8::V8::SetCounterFunction()")) return;
3787 i::StatsTable::SetCounterFunction(callback); 3816 i::StatsTable::SetCounterFunction(callback);
3788 } 3817 }
3789 3818
3790 void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) { 3819 void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) {
3791 if (IsDeadCheck("v8::V8::SetCreateHistogramFunction()")) return; 3820 if (IsDeadCheck("v8::V8::SetCreateHistogramFunction()")) return;
3792 i::StatsTable::SetCreateHistogramFunction(callback); 3821 i::StatsTable::SetCreateHistogramFunction(callback);
3793 } 3822 }
3794 3823
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
4717 4746
4718 4747
4719 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 4748 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
4720 HandleScopeImplementer* thread_local = 4749 HandleScopeImplementer* thread_local =
4721 reinterpret_cast<HandleScopeImplementer*>(storage); 4750 reinterpret_cast<HandleScopeImplementer*>(storage);
4722 thread_local->IterateThis(v); 4751 thread_local->IterateThis(v);
4723 return storage + ArchiveSpacePerThread(); 4752 return storage + ArchiveSpacePerThread();
4724 } 4753 }
4725 4754
4726 } } // namespace v8::internal 4755 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698