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 6943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6954 | 6954 |
6955 DEFINE_ERROR(RangeError) | 6955 DEFINE_ERROR(RangeError) |
6956 DEFINE_ERROR(ReferenceError) | 6956 DEFINE_ERROR(ReferenceError) |
6957 DEFINE_ERROR(SyntaxError) | 6957 DEFINE_ERROR(SyntaxError) |
6958 DEFINE_ERROR(TypeError) | 6958 DEFINE_ERROR(TypeError) |
6959 DEFINE_ERROR(Error) | 6959 DEFINE_ERROR(Error) |
6960 | 6960 |
6961 #undef DEFINE_ERROR | 6961 #undef DEFINE_ERROR |
6962 | 6962 |
6963 | 6963 |
| 6964 Local<Message> Exception::GetMessage(Handle<Value> exception) { |
| 6965 i::Handle<i::Object> obj = Utils::OpenHandle(*exception); |
| 6966 if (!obj->IsHeapObject()) return Local<Message>(); |
| 6967 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); |
| 6968 ENTER_V8(isolate); |
| 6969 i::HandleScope scope(isolate); |
| 6970 return Utils::MessageToLocal( |
| 6971 scope.CloseAndEscape(isolate->CreateMessage(obj, NULL))); |
| 6972 } |
| 6973 |
| 6974 |
6964 Local<StackTrace> Exception::GetStackTrace(Handle<Value> exception) { | 6975 Local<StackTrace> Exception::GetStackTrace(Handle<Value> exception) { |
6965 i::Handle<i::Object> obj = Utils::OpenHandle(*exception); | 6976 i::Handle<i::Object> obj = Utils::OpenHandle(*exception); |
6966 if (!obj->IsJSObject()) return Local<StackTrace>(); | 6977 if (!obj->IsJSObject()) return Local<StackTrace>(); |
6967 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj); | 6978 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj); |
6968 i::Isolate* isolate = js_obj->GetIsolate(); | 6979 i::Isolate* isolate = js_obj->GetIsolate(); |
6969 ENTER_V8(isolate); | 6980 ENTER_V8(isolate); |
6970 return Utils::StackTraceToLocal(isolate->GetDetailedStackTrace(js_obj)); | 6981 return Utils::StackTraceToLocal(isolate->GetDetailedStackTrace(js_obj)); |
6971 } | 6982 } |
6972 | 6983 |
6973 | 6984 |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7738 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7749 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7739 Address callback_address = | 7750 Address callback_address = |
7740 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7751 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7741 VMState<EXTERNAL> state(isolate); | 7752 VMState<EXTERNAL> state(isolate); |
7742 ExternalCallbackScope call_scope(isolate, callback_address); | 7753 ExternalCallbackScope call_scope(isolate, callback_address); |
7743 callback(info); | 7754 callback(info); |
7744 } | 7755 } |
7745 | 7756 |
7746 | 7757 |
7747 } } // namespace v8::internal | 7758 } } // namespace v8::internal |
OLD | NEW |