OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/value-serializer.h" | 5 #include "src/value-serializer.h" |
6 | 6 |
7 #include <type_traits> | 7 #include <type_traits> |
8 | 8 |
9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 } | 1134 } |
1135 Handle<JSArrayBuffer> array_buffer( | 1135 Handle<JSArrayBuffer> array_buffer( |
1136 JSArrayBuffer::cast(transfer_map->ValueAt(index)), isolate_); | 1136 JSArrayBuffer::cast(transfer_map->ValueAt(index)), isolate_); |
1137 AddObjectWithID(id, array_buffer); | 1137 AddObjectWithID(id, array_buffer); |
1138 return array_buffer; | 1138 return array_buffer; |
1139 } | 1139 } |
1140 | 1140 |
1141 MaybeHandle<JSArrayBufferView> ValueDeserializer::ReadJSArrayBufferView( | 1141 MaybeHandle<JSArrayBufferView> ValueDeserializer::ReadJSArrayBufferView( |
1142 Handle<JSArrayBuffer> buffer) { | 1142 Handle<JSArrayBuffer> buffer) { |
1143 uint32_t buffer_byte_length = NumberToUint32(buffer->byte_length()); | 1143 uint32_t buffer_byte_length = NumberToUint32(buffer->byte_length()); |
1144 uint8_t tag; | 1144 uint8_t tag = 0; |
1145 uint32_t byte_offset; | 1145 uint32_t byte_offset = 0; |
1146 uint32_t byte_length; | 1146 uint32_t byte_length = 0; |
1147 if (!ReadVarint<uint8_t>().To(&tag) || | 1147 if (!ReadVarint<uint8_t>().To(&tag) || |
1148 !ReadVarint<uint32_t>().To(&byte_offset) || | 1148 !ReadVarint<uint32_t>().To(&byte_offset) || |
1149 !ReadVarint<uint32_t>().To(&byte_length) || | 1149 !ReadVarint<uint32_t>().To(&byte_length) || |
1150 byte_offset > buffer_byte_length || | 1150 byte_offset > buffer_byte_length || |
1151 byte_length > buffer_byte_length - byte_offset) { | 1151 byte_length > buffer_byte_length - byte_offset) { |
1152 return MaybeHandle<JSArrayBufferView>(); | 1152 return MaybeHandle<JSArrayBufferView>(); |
1153 } | 1153 } |
1154 uint32_t id = next_id_++; | 1154 uint32_t id = next_id_++; |
1155 ExternalArrayType external_array_type = kExternalInt8Array; | 1155 ExternalArrayType external_array_type = kExternalInt8Array; |
1156 unsigned element_size = 0; | 1156 unsigned element_size = 0; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 } | 1335 } |
1336 #endif | 1336 #endif |
1337 position_ = end_; | 1337 position_ = end_; |
1338 | 1338 |
1339 if (stack.size() != 1) return MaybeHandle<Object>(); | 1339 if (stack.size() != 1) return MaybeHandle<Object>(); |
1340 return scope.CloseAndEscape(stack[0]); | 1340 return scope.CloseAndEscape(stack[0]); |
1341 } | 1341 } |
1342 | 1342 |
1343 } // namespace internal | 1343 } // namespace internal |
1344 } // namespace v8 | 1344 } // namespace v8 |
OLD | NEW |