| 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 if (typed_array->buffer()->IsSmi()) { | 6459 if (typed_array->buffer()->IsSmi()) { |
| 6460 i::Handle<i::FixedTypedArrayBase> fixed_array( | 6460 i::Handle<i::FixedTypedArrayBase> fixed_array( |
| 6461 i::FixedTypedArrayBase::cast(typed_array->elements())); | 6461 i::FixedTypedArrayBase::cast(typed_array->elements())); |
| 6462 source = reinterpret_cast<char*>(fixed_array->DataPtr()); | 6462 source = reinterpret_cast<char*>(fixed_array->DataPtr()); |
| 6463 } else { | 6463 } else { |
| 6464 i::Handle<i::JSArrayBuffer> buffer( | 6464 i::Handle<i::JSArrayBuffer> buffer( |
| 6465 i::JSArrayBuffer::cast(typed_array->buffer())); | 6465 i::JSArrayBuffer::cast(typed_array->buffer())); |
| 6466 source = reinterpret_cast<char*>(buffer->backing_store()); | 6466 source = reinterpret_cast<char*>(buffer->backing_store()); |
| 6467 } | 6467 } |
| 6468 } | 6468 } |
| 6469 if (!source) return 0; |
| 6469 memcpy(dest, source + byte_offset, bytes_to_copy); | 6470 memcpy(dest, source + byte_offset, bytes_to_copy); |
| 6470 } | 6471 } |
| 6471 return bytes_to_copy; | 6472 return bytes_to_copy; |
| 6472 } | 6473 } |
| 6473 | 6474 |
| 6474 | 6475 |
| 6475 bool v8::ArrayBufferView::HasBuffer() const { | 6476 bool v8::ArrayBufferView::HasBuffer() const { |
| 6476 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); | 6477 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); |
| 6477 if (obj->IsJSDataView()) return true; | 6478 if (obj->IsJSDataView()) return true; |
| 6478 DCHECK(obj->IsJSTypedArray()); | 6479 DCHECK(obj->IsJSTypedArray()); |
| (...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8110 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8111 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8111 Address callback_address = | 8112 Address callback_address = |
| 8112 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8113 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8113 VMState<EXTERNAL> state(isolate); | 8114 VMState<EXTERNAL> state(isolate); |
| 8114 ExternalCallbackScope call_scope(isolate, callback_address); | 8115 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8115 callback(info); | 8116 callback(info); |
| 8116 } | 8117 } |
| 8117 | 8118 |
| 8118 | 8119 |
| 8119 } } // namespace v8::internal | 8120 } } // namespace v8::internal |
| OLD | NEW |