OLD | NEW |
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 Loading... |
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 | |
6985 Local<StackTrace> Exception::GetStackTrace(Handle<Value> exception) { | 6974 Local<StackTrace> Exception::GetStackTrace(Handle<Value> exception) { |
6986 i::Handle<i::Object> obj = Utils::OpenHandle(*exception); | 6975 i::Handle<i::Object> obj = Utils::OpenHandle(*exception); |
6987 if (!obj->IsJSObject()) return Local<StackTrace>(); | 6976 if (!obj->IsJSObject()) return Local<StackTrace>(); |
6988 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj); | 6977 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj); |
6989 i::Isolate* isolate = js_obj->GetIsolate(); | 6978 i::Isolate* isolate = js_obj->GetIsolate(); |
6990 ENTER_V8(isolate); | 6979 ENTER_V8(isolate); |
6991 return Utils::StackTraceToLocal(isolate->GetDetailedStackTrace(js_obj)); | 6980 return Utils::StackTraceToLocal(isolate->GetDetailedStackTrace(js_obj)); |
6992 } | 6981 } |
6993 | 6982 |
6994 | 6983 |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7759 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7748 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7760 Address callback_address = | 7749 Address callback_address = |
7761 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7750 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7762 VMState<EXTERNAL> state(isolate); | 7751 VMState<EXTERNAL> state(isolate); |
7763 ExternalCallbackScope call_scope(isolate, callback_address); | 7752 ExternalCallbackScope call_scope(isolate, callback_address); |
7764 callback(info); | 7753 callback(info); |
7765 } | 7754 } |
7766 | 7755 |
7767 | 7756 |
7768 } } // namespace v8::internal | 7757 } } // namespace v8::internal |
OLD | NEW |