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