| 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 5978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5989 } | 5989 } |
| 5990 | 5990 |
| 5991 | 5991 |
| 5992 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, void* data, | 5992 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, void* data, |
| 5993 size_t byte_length) { | 5993 size_t byte_length) { |
| 5994 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5994 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 5995 LOG_API(i_isolate, "v8::ArrayBuffer::New(void*, size_t)"); | 5995 LOG_API(i_isolate, "v8::ArrayBuffer::New(void*, size_t)"); |
| 5996 ENTER_V8(i_isolate); | 5996 ENTER_V8(i_isolate); |
| 5997 i::Handle<i::JSArrayBuffer> obj = | 5997 i::Handle<i::JSArrayBuffer> obj = |
| 5998 i_isolate->factory()->NewJSArrayBuffer(); | 5998 i_isolate->factory()->NewJSArrayBuffer(); |
| 5999 i::Runtime::SetupArrayBuffer(i_isolate, obj, true, data, byte_length); | 5999 i::Runtime::SetupArrayBuffer(i_isolate, obj, true, false, data, byte_length); |
| 6000 return Utils::ToLocal(obj); | 6000 return Utils::ToLocal(obj); |
| 6001 } | 6001 } |
| 6002 | 6002 |
| 6003 | 6003 |
| 6004 Local<ArrayBuffer> v8::ArrayBufferView::Buffer() { | 6004 Local<ArrayBuffer> v8::ArrayBufferView::Buffer() { |
| 6005 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); | 6005 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); |
| 6006 i::Handle<i::JSArrayBuffer> buffer; | 6006 i::Handle<i::JSArrayBuffer> buffer; |
| 6007 if (obj->IsJSDataView()) { | 6007 if (obj->IsJSDataView()) { |
| 6008 i::Handle<i::JSDataView> data_view(i::JSDataView::cast(*obj)); | 6008 i::Handle<i::JSDataView> data_view(i::JSDataView::cast(*obj)); |
| 6009 DCHECK(data_view->buffer()->IsJSArrayBuffer()); | 6009 DCHECK(data_view->buffer()->IsJSArrayBuffer()); |
| (...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7657 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7657 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7658 Address callback_address = | 7658 Address callback_address = |
| 7659 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7659 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7660 VMState<EXTERNAL> state(isolate); | 7660 VMState<EXTERNAL> state(isolate); |
| 7661 ExternalCallbackScope call_scope(isolate, callback_address); | 7661 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7662 callback(info); | 7662 callback(info); |
| 7663 } | 7663 } |
| 7664 | 7664 |
| 7665 | 7665 |
| 7666 } } // namespace v8::internal | 7666 } } // namespace v8::internal |
| OLD | NEW |