| 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 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2734 TYPED_ARRAYS(VALUE_IS_TYPED_ARRAY) | 2734 TYPED_ARRAYS(VALUE_IS_TYPED_ARRAY) |
| 2735 | 2735 |
| 2736 #undef VALUE_IS_TYPED_ARRAY | 2736 #undef VALUE_IS_TYPED_ARRAY |
| 2737 | 2737 |
| 2738 | 2738 |
| 2739 bool Value::IsDataView() const { | 2739 bool Value::IsDataView() const { |
| 2740 return Utils::OpenHandle(this)->IsJSDataView(); | 2740 return Utils::OpenHandle(this)->IsJSDataView(); |
| 2741 } | 2741 } |
| 2742 | 2742 |
| 2743 | 2743 |
| 2744 bool Value::IsFloat32x4() const { |
| 2745 return Utils::OpenHandle(this)->IsFloat32x4(); |
| 2746 } |
| 2747 |
| 2748 |
| 2744 bool Value::IsSharedArrayBuffer() const { | 2749 bool Value::IsSharedArrayBuffer() const { |
| 2745 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2750 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2746 return obj->IsJSArrayBuffer() && i::JSArrayBuffer::cast(*obj)->is_shared(); | 2751 return obj->IsJSArrayBuffer() && i::JSArrayBuffer::cast(*obj)->is_shared(); |
| 2747 } | 2752 } |
| 2748 | 2753 |
| 2749 | 2754 |
| 2750 bool Value::IsObject() const { | 2755 bool Value::IsObject() const { |
| 2751 return Utils::OpenHandle(this)->IsJSObject(); | 2756 return Utils::OpenHandle(this)->IsJSObject(); |
| 2752 } | 2757 } |
| 2753 | 2758 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3092 "Could not convert to 32-bit signed integer"); | 3097 "Could not convert to 32-bit signed integer"); |
| 3093 } | 3098 } |
| 3094 | 3099 |
| 3095 | 3100 |
| 3096 void v8::Uint32::CheckCast(v8::Value* that) { | 3101 void v8::Uint32::CheckCast(v8::Value* that) { |
| 3097 Utils::ApiCheck(that->IsUint32(), "v8::Uint32::Cast()", | 3102 Utils::ApiCheck(that->IsUint32(), "v8::Uint32::Cast()", |
| 3098 "Could not convert to 32-bit unsigned integer"); | 3103 "Could not convert to 32-bit unsigned integer"); |
| 3099 } | 3104 } |
| 3100 | 3105 |
| 3101 | 3106 |
| 3107 void v8::Float32x4::CheckCast(v8::Value* that) { |
| 3108 i::Handle<i::Object> obj = Utils::OpenHandle(that); |
| 3109 Utils::ApiCheck(obj->IsFloat32x4(), "v8::Float32x4::Cast()", |
| 3110 "Could not convert to float32x4"); |
| 3111 } |
| 3112 |
| 3113 |
| 3102 void v8::Array::CheckCast(Value* that) { | 3114 void v8::Array::CheckCast(Value* that) { |
| 3103 i::Handle<i::Object> obj = Utils::OpenHandle(that); | 3115 i::Handle<i::Object> obj = Utils::OpenHandle(that); |
| 3104 Utils::ApiCheck(obj->IsJSArray(), | 3116 Utils::ApiCheck(obj->IsJSArray(), |
| 3105 "v8::Array::Cast()", | 3117 "v8::Array::Cast()", |
| 3106 "Could not convert to array"); | 3118 "Could not convert to array"); |
| 3107 } | 3119 } |
| 3108 | 3120 |
| 3109 | 3121 |
| 3110 void v8::Map::CheckCast(Value* that) { | 3122 void v8::Map::CheckCast(Value* that) { |
| 3111 i::Handle<i::Object> obj = Utils::OpenHandle(that); | 3123 i::Handle<i::Object> obj = Utils::OpenHandle(that); |
| (...skipping 3663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6775 LOG_API(i_isolate, "v8::SharedArrayBuffer::New(size_t)"); | 6787 LOG_API(i_isolate, "v8::SharedArrayBuffer::New(size_t)"); |
| 6776 ENTER_V8(i_isolate); | 6788 ENTER_V8(i_isolate); |
| 6777 i::Handle<i::JSArrayBuffer> obj = | 6789 i::Handle<i::JSArrayBuffer> obj = |
| 6778 i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kShared); | 6790 i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kShared); |
| 6779 i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length, true, | 6791 i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length, true, |
| 6780 i::SharedFlag::kShared); | 6792 i::SharedFlag::kShared); |
| 6781 return Utils::ToLocalShared(obj); | 6793 return Utils::ToLocalShared(obj); |
| 6782 } | 6794 } |
| 6783 | 6795 |
| 6784 | 6796 |
| 6797 Local<Float32x4> v8::Float32x4::New(Isolate* isolate, float w, float x, float y, |
| 6798 float z) { |
| 6799 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6800 LOG_API(i_isolate, "Float32x4::New()"); |
| 6801 ENTER_V8(i_isolate); |
| 6802 i::Handle<i::Float32x4> result = |
| 6803 i_isolate->factory()->NewFloat32x4(w, x, y, z); |
| 6804 return Utils::ToLocal(result); |
| 6805 } |
| 6806 |
| 6807 |
| 6785 Local<SharedArrayBuffer> v8::SharedArrayBuffer::New( | 6808 Local<SharedArrayBuffer> v8::SharedArrayBuffer::New( |
| 6786 Isolate* isolate, void* data, size_t byte_length, | 6809 Isolate* isolate, void* data, size_t byte_length, |
| 6787 ArrayBufferCreationMode mode) { | 6810 ArrayBufferCreationMode mode) { |
| 6788 CHECK(i::FLAG_harmony_sharedarraybuffer); | 6811 CHECK(i::FLAG_harmony_sharedarraybuffer); |
| 6789 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6812 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6790 LOG_API(i_isolate, "v8::SharedArrayBuffer::New(void*, size_t)"); | 6813 LOG_API(i_isolate, "v8::SharedArrayBuffer::New(void*, size_t)"); |
| 6791 ENTER_V8(i_isolate); | 6814 ENTER_V8(i_isolate); |
| 6792 i::Handle<i::JSArrayBuffer> obj = | 6815 i::Handle<i::JSArrayBuffer> obj = |
| 6793 i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kShared); | 6816 i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kShared); |
| 6794 i::Runtime::SetupArrayBuffer(i_isolate, obj, | 6817 i::Runtime::SetupArrayBuffer(i_isolate, obj, |
| (...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8428 Address callback_address = | 8451 Address callback_address = |
| 8429 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8452 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8430 VMState<EXTERNAL> state(isolate); | 8453 VMState<EXTERNAL> state(isolate); |
| 8431 ExternalCallbackScope call_scope(isolate, callback_address); | 8454 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8432 callback(info); | 8455 callback(info); |
| 8433 } | 8456 } |
| 8434 | 8457 |
| 8435 | 8458 |
| 8436 } // namespace internal | 8459 } // namespace internal |
| 8437 } // namespace v8 | 8460 } // namespace v8 |
| OLD | NEW |