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 2987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2998 return !i::IsMinusZero(value) && | 2998 return !i::IsMinusZero(value) && |
2999 value >= 0 && | 2999 value >= 0 && |
3000 value <= i::kMaxUInt32 && | 3000 value <= i::kMaxUInt32 && |
3001 value == i::FastUI2D(i::FastD2UI(value)); | 3001 value == i::FastUI2D(i::FastD2UI(value)); |
3002 } | 3002 } |
3003 return false; | 3003 return false; |
3004 } | 3004 } |
3005 | 3005 |
3006 | 3006 |
3007 bool Value::IsNativeError() const { | 3007 bool Value::IsNativeError() const { |
3008 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 3008 return Utils::OpenHandle(this)->IsJSError(); |
3009 if (!obj->IsJSObject()) return false; | |
3010 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj); | |
3011 i::Isolate* isolate = js_obj->GetIsolate(); | |
3012 i::Handle<i::Object> constructor(js_obj->map()->GetConstructor(), isolate); | |
3013 if (!constructor->IsJSFunction()) return false; | |
3014 i::Handle<i::JSFunction> function = | |
3015 i::Handle<i::JSFunction>::cast(constructor); | |
3016 if (!function->shared()->native()) return false; | |
3017 return function.is_identical_to(isolate->error_function()) || | |
3018 function.is_identical_to(isolate->eval_error_function()) || | |
3019 function.is_identical_to(isolate->range_error_function()) || | |
3020 function.is_identical_to(isolate->reference_error_function()) || | |
3021 function.is_identical_to(isolate->syntax_error_function()) || | |
3022 function.is_identical_to(isolate->type_error_function()) || | |
3023 function.is_identical_to(isolate->uri_error_function()); | |
3024 } | 3009 } |
3025 | 3010 |
3026 | 3011 |
3027 bool Value::IsRegExp() const { | 3012 bool Value::IsRegExp() const { |
3028 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 3013 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
3029 return obj->IsJSRegExp(); | 3014 return obj->IsJSRegExp(); |
3030 } | 3015 } |
3031 | 3016 |
3032 | 3017 |
3033 bool Value::IsGeneratorFunction() const { | 3018 bool Value::IsGeneratorFunction() const { |
(...skipping 5851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8885 Address callback_address = | 8870 Address callback_address = |
8886 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8871 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8887 VMState<EXTERNAL> state(isolate); | 8872 VMState<EXTERNAL> state(isolate); |
8888 ExternalCallbackScope call_scope(isolate, callback_address); | 8873 ExternalCallbackScope call_scope(isolate, callback_address); |
8889 callback(info); | 8874 callback(info); |
8890 } | 8875 } |
8891 | 8876 |
8892 | 8877 |
8893 } // namespace internal | 8878 } // namespace internal |
8894 } // namespace v8 | 8879 } // namespace v8 |
OLD | NEW |