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 2847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2858 has_pending_exception = private_->isolate->has_pending_exception(); | 2858 has_pending_exception = private_->isolate->has_pending_exception(); |
2859 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 2859 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
2860 } | 2860 } |
2861 return result; | 2861 return result; |
2862 } | 2862 } |
2863 | 2863 |
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, |
| 2869 Local<ArrayBuffer> array_buffer) { |
| 2870 private_->serializer.TransferArrayBuffer(transfer_id, |
| 2871 Utils::OpenHandle(*array_buffer)); |
| 2872 } |
| 2873 |
2868 struct ValueDeserializer::PrivateData { | 2874 struct ValueDeserializer::PrivateData { |
2869 PrivateData(i::Isolate* i, i::Vector<const uint8_t> data) | 2875 PrivateData(i::Isolate* i, i::Vector<const uint8_t> data) |
2870 : isolate(i), deserializer(i, data) {} | 2876 : isolate(i), deserializer(i, data) {} |
2871 i::Isolate* isolate; | 2877 i::Isolate* isolate; |
2872 i::ValueDeserializer deserializer; | 2878 i::ValueDeserializer deserializer; |
2873 bool supports_legacy_wire_format = false; | 2879 bool supports_legacy_wire_format = false; |
2874 }; | 2880 }; |
2875 | 2881 |
2876 ValueDeserializer::ValueDeserializer(Isolate* isolate, const uint8_t* data, | 2882 ValueDeserializer::ValueDeserializer(Isolate* isolate, const uint8_t* data, |
2877 size_t size) { | 2883 size_t size) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2922 } | 2928 } |
2923 Local<Value> value; | 2929 Local<Value> value; |
2924 if (!ToLocal(result, &value)) { | 2930 if (!ToLocal(result, &value)) { |
2925 has_pending_exception = private_->isolate->has_pending_exception(); | 2931 has_pending_exception = private_->isolate->has_pending_exception(); |
2926 RETURN_ON_FAILED_EXECUTION(Value); | 2932 RETURN_ON_FAILED_EXECUTION(Value); |
2927 return MaybeLocal<Value>(); | 2933 return MaybeLocal<Value>(); |
2928 } | 2934 } |
2929 RETURN_ESCAPED(value); | 2935 RETURN_ESCAPED(value); |
2930 } | 2936 } |
2931 | 2937 |
| 2938 void ValueDeserializer::TransferArrayBuffer(uint32_t transfer_id, |
| 2939 Local<ArrayBuffer> array_buffer) { |
| 2940 private_->deserializer.TransferArrayBuffer(transfer_id, |
| 2941 Utils::OpenHandle(*array_buffer)); |
| 2942 } |
| 2943 |
2932 // --- D a t a --- | 2944 // --- D a t a --- |
2933 | 2945 |
2934 bool Value::FullIsUndefined() const { | 2946 bool Value::FullIsUndefined() const { |
2935 i::Handle<i::Object> object = Utils::OpenHandle(this); | 2947 i::Handle<i::Object> object = Utils::OpenHandle(this); |
2936 bool result = false; | 2948 bool result = false; |
2937 if (!object->IsSmi()) { | 2949 if (!object->IsSmi()) { |
2938 result = object->IsUndefined(i::HeapObject::cast(*object)->GetIsolate()); | 2950 result = object->IsUndefined(i::HeapObject::cast(*object)->GetIsolate()); |
2939 } | 2951 } |
2940 DCHECK_EQ(result, QuickIsUndefined()); | 2952 DCHECK_EQ(result, QuickIsUndefined()); |
2941 return result; | 2953 return result; |
(...skipping 6143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9085 Address callback_address = | 9097 Address callback_address = |
9086 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9098 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9087 VMState<EXTERNAL> state(isolate); | 9099 VMState<EXTERNAL> state(isolate); |
9088 ExternalCallbackScope call_scope(isolate, callback_address); | 9100 ExternalCallbackScope call_scope(isolate, callback_address); |
9089 callback(info); | 9101 callback(info); |
9090 } | 9102 } |
9091 | 9103 |
9092 | 9104 |
9093 } // namespace internal | 9105 } // namespace internal |
9094 } // namespace v8 | 9106 } // namespace v8 |
OLD | NEW |