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

Side by Side Diff: src/api.cc

Issue 687253002: Introduce v8::Exception::GetMessage to find location of an error object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: relanding Created 6 years, 1 month 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/isolate.h » ('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 6953 matching lines...) Expand 10 before | Expand all | Expand 10 after
6964 6964
6965 DEFINE_ERROR(RangeError) 6965 DEFINE_ERROR(RangeError)
6966 DEFINE_ERROR(ReferenceError) 6966 DEFINE_ERROR(ReferenceError)
6967 DEFINE_ERROR(SyntaxError) 6967 DEFINE_ERROR(SyntaxError)
6968 DEFINE_ERROR(TypeError) 6968 DEFINE_ERROR(TypeError)
6969 DEFINE_ERROR(Error) 6969 DEFINE_ERROR(Error)
6970 6970
6971 #undef DEFINE_ERROR 6971 #undef DEFINE_ERROR
6972 6972
6973 6973
6974 Local<Message> Exception::GetMessage(Handle<Value> exception) {
6975 i::Handle<i::Object> obj = Utils::OpenHandle(*exception);
6976 if (!obj->IsHeapObject()) return Local<Message>();
6977 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
6978 ENTER_V8(isolate);
6979 i::HandleScope scope(isolate);
6980 return Utils::MessageToLocal(
6981 scope.CloseAndEscape(isolate->CreateMessage(obj, NULL)));
6982 }
6983
6984
6974 Local<StackTrace> Exception::GetStackTrace(Handle<Value> exception) { 6985 Local<StackTrace> Exception::GetStackTrace(Handle<Value> exception) {
6975 i::Handle<i::Object> obj = Utils::OpenHandle(*exception); 6986 i::Handle<i::Object> obj = Utils::OpenHandle(*exception);
6976 if (!obj->IsJSObject()) return Local<StackTrace>(); 6987 if (!obj->IsJSObject()) return Local<StackTrace>();
6977 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj); 6988 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj);
6978 i::Isolate* isolate = js_obj->GetIsolate(); 6989 i::Isolate* isolate = js_obj->GetIsolate();
6979 ENTER_V8(isolate); 6990 ENTER_V8(isolate);
6980 return Utils::StackTraceToLocal(isolate->GetDetailedStackTrace(js_obj)); 6991 return Utils::StackTraceToLocal(isolate->GetDetailedStackTrace(js_obj));
6981 } 6992 }
6982 6993
6983 6994
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
7748 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7759 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7749 Address callback_address = 7760 Address callback_address =
7750 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7761 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7751 VMState<EXTERNAL> state(isolate); 7762 VMState<EXTERNAL> state(isolate);
7752 ExternalCallbackScope call_scope(isolate, callback_address); 7763 ExternalCallbackScope call_scope(isolate, callback_address);
7753 callback(info); 7764 callback(info);
7754 } 7765 }
7755 7766
7756 7767
7757 } } // namespace v8::internal 7768 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698