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