| 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 6241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6252 return Utils::OpenHandle(this)->is_neuterable(); | 6252 return Utils::OpenHandle(this)->is_neuterable(); |
| 6253 } | 6253 } |
| 6254 | 6254 |
| 6255 | 6255 |
| 6256 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() { | 6256 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() { |
| 6257 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); | 6257 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); |
| 6258 i::Isolate* isolate = self->GetIsolate(); | 6258 i::Isolate* isolate = self->GetIsolate(); |
| 6259 Utils::ApiCheck(!self->is_external(), "v8::ArrayBuffer::Externalize", | 6259 Utils::ApiCheck(!self->is_external(), "v8::ArrayBuffer::Externalize", |
| 6260 "ArrayBuffer already externalized"); | 6260 "ArrayBuffer already externalized"); |
| 6261 self->set_is_external(true); | 6261 self->set_is_external(true); |
| 6262 isolate->heap()->UnregisterArrayBuffer(self->backing_store()); | 6262 isolate->heap()->UnregisterArrayBuffer(isolate->heap()->InNewSpace(*self), |
| 6263 self->backing_store()); |
| 6263 | 6264 |
| 6264 return GetContents(); | 6265 return GetContents(); |
| 6265 } | 6266 } |
| 6266 | 6267 |
| 6267 | 6268 |
| 6268 v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() { | 6269 v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() { |
| 6269 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); | 6270 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); |
| 6270 size_t byte_length = static_cast<size_t>(self->byte_length()->Number()); | 6271 size_t byte_length = static_cast<size_t>(self->byte_length()->Number()); |
| 6271 Contents contents; | 6272 Contents contents; |
| 6272 contents.data_ = self->backing_store(); | 6273 contents.data_ = self->backing_store(); |
| (...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8032 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8033 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8033 Address callback_address = | 8034 Address callback_address = |
| 8034 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8035 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8035 VMState<EXTERNAL> state(isolate); | 8036 VMState<EXTERNAL> state(isolate); |
| 8036 ExternalCallbackScope call_scope(isolate, callback_address); | 8037 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8037 callback(info); | 8038 callback(info); |
| 8038 } | 8039 } |
| 8039 | 8040 |
| 8040 | 8041 |
| 8041 } } // namespace v8::internal | 8042 } } // namespace v8::internal |
| OLD | NEW |