| 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 6936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6947 #define DEFINE_ERROR(NAME) \ | 6947 #define DEFINE_ERROR(NAME) \ |
| 6948 Local<Value> Exception::NAME(v8::Handle<v8::String> raw_message) { \ | 6948 Local<Value> Exception::NAME(v8::Handle<v8::String> raw_message) { \ |
| 6949 i::Isolate* isolate = i::Isolate::Current(); \ | 6949 i::Isolate* isolate = i::Isolate::Current(); \ |
| 6950 LOG_API(isolate, #NAME); \ | 6950 LOG_API(isolate, #NAME); \ |
| 6951 ON_BAILOUT(isolate, "v8::Exception::" #NAME "()", return Local<Value>()); \ | 6951 ON_BAILOUT(isolate, "v8::Exception::" #NAME "()", return Local<Value>()); \ |
| 6952 ENTER_V8(isolate); \ | 6952 ENTER_V8(isolate); \ |
| 6953 i::Object* error; \ | 6953 i::Object* error; \ |
| 6954 { \ | 6954 { \ |
| 6955 i::HandleScope scope(isolate); \ | 6955 i::HandleScope scope(isolate); \ |
| 6956 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); \ | 6956 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); \ |
| 6957 i::Handle<i::Object> result; \ | 6957 error = *isolate->factory()->New##NAME(message); \ |
| 6958 EXCEPTION_PREAMBLE(isolate); \ | |
| 6959 i::MaybeHandle<i::Object> maybe_result = \ | |
| 6960 isolate->factory()->New##NAME(message); \ | |
| 6961 has_pending_exception = !maybe_result.ToHandle(&result); \ | |
| 6962 /* TODO(yangguo): crbug/403509. Return empty handle instead. */ \ | |
| 6963 EXCEPTION_BAILOUT_CHECK( \ | |
| 6964 isolate, v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate))); \ | |
| 6965 error = *result; \ | |
| 6966 } \ | 6958 } \ |
| 6967 i::Handle<i::Object> result(error, isolate); \ | 6959 i::Handle<i::Object> result(error, isolate); \ |
| 6968 return Utils::ToLocal(result); \ | 6960 return Utils::ToLocal(result); \ |
| 6969 } | 6961 } |
| 6970 | 6962 |
| 6971 DEFINE_ERROR(RangeError) | 6963 DEFINE_ERROR(RangeError) |
| 6972 DEFINE_ERROR(ReferenceError) | 6964 DEFINE_ERROR(ReferenceError) |
| 6973 DEFINE_ERROR(SyntaxError) | 6965 DEFINE_ERROR(SyntaxError) |
| 6974 DEFINE_ERROR(TypeError) | 6966 DEFINE_ERROR(TypeError) |
| 6975 DEFINE_ERROR(Error) | 6967 DEFINE_ERROR(Error) |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7783 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7775 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7784 Address callback_address = | 7776 Address callback_address = |
| 7785 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7777 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7786 VMState<EXTERNAL> state(isolate); | 7778 VMState<EXTERNAL> state(isolate); |
| 7787 ExternalCallbackScope call_scope(isolate, callback_address); | 7779 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7788 callback(info); | 7780 callback(info); |
| 7789 } | 7781 } |
| 7790 | 7782 |
| 7791 | 7783 |
| 7792 } } // namespace v8::internal | 7784 } } // namespace v8::internal |
| OLD | NEW |