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

Side by Side Diff: src/api.cc

Issue 655243002: Introduce v8::Exception::GetStackTrace API method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: added test Created 6 years, 2 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') | test/cctest/test-api.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 6908 matching lines...) Expand 10 before | Expand all | Expand 10 after
6919 6919
6920 DEFINE_ERROR(RangeError) 6920 DEFINE_ERROR(RangeError)
6921 DEFINE_ERROR(ReferenceError) 6921 DEFINE_ERROR(ReferenceError)
6922 DEFINE_ERROR(SyntaxError) 6922 DEFINE_ERROR(SyntaxError)
6923 DEFINE_ERROR(TypeError) 6923 DEFINE_ERROR(TypeError)
6924 DEFINE_ERROR(Error) 6924 DEFINE_ERROR(Error)
6925 6925
6926 #undef DEFINE_ERROR 6926 #undef DEFINE_ERROR
6927 6927
6928 6928
6929 Local<StackTrace> Exception::GetStackTrace(Handle<Value> exception) {
6930 i::Handle<i::Object> obj = Utils::OpenHandle(*exception);
6931 if (!obj->IsJSObject()) return Local<StackTrace>();
6932 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj);
6933 i::Isolate* isolate = js_obj->GetIsolate();
6934 ENTER_V8(isolate);
6935 i::Handle<i::Name> key = isolate->factory()->detailed_stack_trace_symbol();
6936 i::Handle<i::Object> property = i::JSObject::GetDataProperty(js_obj, key);
6937 if (property->IsJSArray()) {
6938 return Utils::StackTraceToLocal(i::Handle<i::JSArray>::cast(property));
6939 }
6940 return Local<StackTrace>();
6941 }
6942
6943
6929 // --- D e b u g S u p p o r t --- 6944 // --- D e b u g S u p p o r t ---
6930 6945
6931 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) { 6946 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) {
6932 i::Isolate* isolate = i::Isolate::Current(); 6947 i::Isolate* isolate = i::Isolate::Current();
6933 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false); 6948 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false);
6934 ENTER_V8(isolate); 6949 ENTER_V8(isolate);
6935 i::HandleScope scope(isolate); 6950 i::HandleScope scope(isolate);
6936 i::Handle<i::Object> foreign = isolate->factory()->undefined_value(); 6951 i::Handle<i::Object> foreign = isolate->factory()->undefined_value();
6937 if (that != NULL) { 6952 if (that != NULL) {
6938 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that)); 6953 foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that));
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
7693 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7708 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7694 Address callback_address = 7709 Address callback_address =
7695 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7710 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7696 VMState<EXTERNAL> state(isolate); 7711 VMState<EXTERNAL> state(isolate);
7697 ExternalCallbackScope call_scope(isolate, callback_address); 7712 ExternalCallbackScope call_scope(isolate, callback_address);
7698 callback(info); 7713 callback(info);
7699 } 7714 }
7700 7715
7701 7716
7702 } } // namespace v8::internal 7717 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698