| 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 6448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6459 i::JSArrayBuffer::cast(typed_array->buffer())); | 6459 i::JSArrayBuffer::cast(typed_array->buffer())); |
| 6460 source = reinterpret_cast<char*>(buffer->backing_store()); | 6460 source = reinterpret_cast<char*>(buffer->backing_store()); |
| 6461 } | 6461 } |
| 6462 } | 6462 } |
| 6463 memcpy(dest, source + byte_offset, bytes_to_copy); | 6463 memcpy(dest, source + byte_offset, bytes_to_copy); |
| 6464 } | 6464 } |
| 6465 return bytes_to_copy; | 6465 return bytes_to_copy; |
| 6466 } | 6466 } |
| 6467 | 6467 |
| 6468 | 6468 |
| 6469 bool v8::ArrayBufferView::HasBuffer() const { |
| 6470 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); |
| 6471 if (obj->IsJSDataView()) return true; |
| 6472 DCHECK(obj->IsJSTypedArray()); |
| 6473 i::Handle<i::JSTypedArray> typed_array(i::JSTypedArray::cast(*obj)); |
| 6474 return !typed_array->buffer()->IsSmi(); |
| 6475 } |
| 6476 |
| 6477 |
| 6469 size_t v8::ArrayBufferView::ByteOffset() { | 6478 size_t v8::ArrayBufferView::ByteOffset() { |
| 6470 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); | 6479 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); |
| 6471 return static_cast<size_t>(obj->byte_offset()->Number()); | 6480 return static_cast<size_t>(obj->byte_offset()->Number()); |
| 6472 } | 6481 } |
| 6473 | 6482 |
| 6474 | 6483 |
| 6475 size_t v8::ArrayBufferView::ByteLength() { | 6484 size_t v8::ArrayBufferView::ByteLength() { |
| 6476 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); | 6485 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); |
| 6477 return static_cast<size_t>(obj->byte_length()->Number()); | 6486 return static_cast<size_t>(obj->byte_length()->Number()); |
| 6478 } | 6487 } |
| (...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8095 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8104 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8096 Address callback_address = | 8105 Address callback_address = |
| 8097 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8106 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8098 VMState<EXTERNAL> state(isolate); | 8107 VMState<EXTERNAL> state(isolate); |
| 8099 ExternalCallbackScope call_scope(isolate, callback_address); | 8108 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8100 callback(info); | 8109 callback(info); |
| 8101 } | 8110 } |
| 8102 | 8111 |
| 8103 | 8112 |
| 8104 } } // namespace v8::internal | 8113 } } // namespace v8::internal |
| OLD | NEW |