| 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 6236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6247 } | 6247 } |
| 6248 | 6248 |
| 6249 | 6249 |
| 6250 bool v8::ArrayBuffer::IsNeuterable() const { | 6250 bool v8::ArrayBuffer::IsNeuterable() const { |
| 6251 return Utils::OpenHandle(this)->is_neuterable(); | 6251 return Utils::OpenHandle(this)->is_neuterable(); |
| 6252 } | 6252 } |
| 6253 | 6253 |
| 6254 | 6254 |
| 6255 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() { | 6255 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() { |
| 6256 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); | 6256 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); |
| 6257 i::Isolate* isolate = self->GetIsolate(); |
| 6257 Utils::ApiCheck(!self->is_external(), "v8::ArrayBuffer::Externalize", | 6258 Utils::ApiCheck(!self->is_external(), "v8::ArrayBuffer::Externalize", |
| 6258 "ArrayBuffer already externalized"); | 6259 "ArrayBuffer already externalized"); |
| 6259 self->set_is_external(true); | 6260 self->set_is_external(true); |
| 6261 isolate->heap()->UnregisterArrayBuffer(self->backing_store()); |
| 6262 |
| 6260 return GetContents(); | 6263 return GetContents(); |
| 6261 } | 6264 } |
| 6262 | 6265 |
| 6263 | 6266 |
| 6264 v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() { | 6267 v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() { |
| 6265 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); | 6268 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); |
| 6266 size_t byte_length = static_cast<size_t>(self->byte_length()->Number()); | 6269 size_t byte_length = static_cast<size_t>(self->byte_length()->Number()); |
| 6267 Contents contents; | 6270 Contents contents; |
| 6268 contents.data_ = self->backing_store(); | 6271 contents.data_ = self->backing_store(); |
| 6269 contents.byte_length_ = byte_length; | 6272 contents.byte_length_ = byte_length; |
| (...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8040 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8043 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8041 Address callback_address = | 8044 Address callback_address = |
| 8042 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8045 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8043 VMState<EXTERNAL> state(isolate); | 8046 VMState<EXTERNAL> state(isolate); |
| 8044 ExternalCallbackScope call_scope(isolate, callback_address); | 8047 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8045 callback(info); | 8048 callback(info); |
| 8046 } | 8049 } |
| 8047 | 8050 |
| 8048 | 8051 |
| 8049 } } // namespace v8::internal | 8052 } } // namespace v8::internal |
| OLD | NEW |