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 2853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2864 std::vector<uint8_t> ValueSerializer::ReleaseBuffer() { | 2864 std::vector<uint8_t> ValueSerializer::ReleaseBuffer() { |
2865 return private_->serializer.ReleaseBuffer(); | 2865 return private_->serializer.ReleaseBuffer(); |
2866 } | 2866 } |
2867 | 2867 |
2868 void ValueSerializer::TransferArrayBuffer(uint32_t transfer_id, | 2868 void ValueSerializer::TransferArrayBuffer(uint32_t transfer_id, |
2869 Local<ArrayBuffer> array_buffer) { | 2869 Local<ArrayBuffer> array_buffer) { |
2870 private_->serializer.TransferArrayBuffer(transfer_id, | 2870 private_->serializer.TransferArrayBuffer(transfer_id, |
2871 Utils::OpenHandle(*array_buffer)); | 2871 Utils::OpenHandle(*array_buffer)); |
2872 } | 2872 } |
2873 | 2873 |
| 2874 void ValueSerializer::TransferSharedArrayBuffer( |
| 2875 uint32_t transfer_id, Local<SharedArrayBuffer> shared_array_buffer) { |
| 2876 private_->serializer.TransferArrayBuffer( |
| 2877 transfer_id, Utils::OpenHandle(*shared_array_buffer)); |
| 2878 } |
| 2879 |
2874 struct ValueDeserializer::PrivateData { | 2880 struct ValueDeserializer::PrivateData { |
2875 PrivateData(i::Isolate* i, i::Vector<const uint8_t> data) | 2881 PrivateData(i::Isolate* i, i::Vector<const uint8_t> data) |
2876 : isolate(i), deserializer(i, data) {} | 2882 : isolate(i), deserializer(i, data) {} |
2877 i::Isolate* isolate; | 2883 i::Isolate* isolate; |
2878 i::ValueDeserializer deserializer; | 2884 i::ValueDeserializer deserializer; |
2879 bool supports_legacy_wire_format = false; | 2885 bool supports_legacy_wire_format = false; |
2880 }; | 2886 }; |
2881 | 2887 |
2882 ValueDeserializer::ValueDeserializer(Isolate* isolate, const uint8_t* data, | 2888 ValueDeserializer::ValueDeserializer(Isolate* isolate, const uint8_t* data, |
2883 size_t size) { | 2889 size_t size) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2934 } | 2940 } |
2935 RETURN_ESCAPED(value); | 2941 RETURN_ESCAPED(value); |
2936 } | 2942 } |
2937 | 2943 |
2938 void ValueDeserializer::TransferArrayBuffer(uint32_t transfer_id, | 2944 void ValueDeserializer::TransferArrayBuffer(uint32_t transfer_id, |
2939 Local<ArrayBuffer> array_buffer) { | 2945 Local<ArrayBuffer> array_buffer) { |
2940 private_->deserializer.TransferArrayBuffer(transfer_id, | 2946 private_->deserializer.TransferArrayBuffer(transfer_id, |
2941 Utils::OpenHandle(*array_buffer)); | 2947 Utils::OpenHandle(*array_buffer)); |
2942 } | 2948 } |
2943 | 2949 |
| 2950 void ValueDeserializer::TransferSharedArrayBuffer( |
| 2951 uint32_t transfer_id, Local<SharedArrayBuffer> shared_array_buffer) { |
| 2952 private_->deserializer.TransferArrayBuffer( |
| 2953 transfer_id, Utils::OpenHandle(*shared_array_buffer)); |
| 2954 } |
| 2955 |
2944 // --- D a t a --- | 2956 // --- D a t a --- |
2945 | 2957 |
2946 bool Value::FullIsUndefined() const { | 2958 bool Value::FullIsUndefined() const { |
2947 i::Handle<i::Object> object = Utils::OpenHandle(this); | 2959 i::Handle<i::Object> object = Utils::OpenHandle(this); |
2948 bool result = false; | 2960 bool result = false; |
2949 if (!object->IsSmi()) { | 2961 if (!object->IsSmi()) { |
2950 result = object->IsUndefined(i::HeapObject::cast(*object)->GetIsolate()); | 2962 result = object->IsUndefined(i::HeapObject::cast(*object)->GetIsolate()); |
2951 } | 2963 } |
2952 DCHECK_EQ(result, QuickIsUndefined()); | 2964 DCHECK_EQ(result, QuickIsUndefined()); |
2953 return result; | 2965 return result; |
(...skipping 6140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9094 Address callback_address = | 9106 Address callback_address = |
9095 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9107 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9096 VMState<EXTERNAL> state(isolate); | 9108 VMState<EXTERNAL> state(isolate); |
9097 ExternalCallbackScope call_scope(isolate, callback_address); | 9109 ExternalCallbackScope call_scope(isolate, callback_address); |
9098 callback(info); | 9110 callback(info); |
9099 } | 9111 } |
9100 | 9112 |
9101 | 9113 |
9102 } // namespace internal | 9114 } // namespace internal |
9103 } // namespace v8 | 9115 } // namespace v8 |
OLD | NEW |