| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 5787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5798 | 5798 |
| 5799 | 5799 |
| 5800 void v8::ArrayBuffer::Neuter() { | 5800 void v8::ArrayBuffer::Neuter() { |
| 5801 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); | 5801 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); |
| 5802 i::Isolate* isolate = obj->GetIsolate(); | 5802 i::Isolate* isolate = obj->GetIsolate(); |
| 5803 Utils::ApiCheck(obj->is_external(), | 5803 Utils::ApiCheck(obj->is_external(), |
| 5804 "v8::ArrayBuffer::Neuter", | 5804 "v8::ArrayBuffer::Neuter", |
| 5805 "Only externalized ArrayBuffers can be neutered"); | 5805 "Only externalized ArrayBuffers can be neutered"); |
| 5806 LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()"); | 5806 LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()"); |
| 5807 ENTER_V8(isolate); | 5807 ENTER_V8(isolate); |
| 5808 | 5808 i::Runtime::NeuterArrayBuffer(obj); |
| 5809 for (i::Handle<i::Object> view_obj(obj->weak_first_view(), isolate); | |
| 5810 !view_obj->IsUndefined();) { | |
| 5811 i::Handle<i::JSArrayBufferView> view(i::JSArrayBufferView::cast(*view_obj)); | |
| 5812 if (view->IsJSTypedArray()) { | |
| 5813 i::JSTypedArray::cast(*view)->Neuter(); | |
| 5814 } else if (view->IsJSDataView()) { | |
| 5815 i::JSDataView::cast(*view)->Neuter(); | |
| 5816 } else { | |
| 5817 UNREACHABLE(); | |
| 5818 } | |
| 5819 view_obj = i::handle(view->weak_next(), isolate); | |
| 5820 } | |
| 5821 obj->Neuter(); | |
| 5822 } | 5809 } |
| 5823 | 5810 |
| 5824 | 5811 |
| 5825 size_t v8::ArrayBuffer::ByteLength() const { | 5812 size_t v8::ArrayBuffer::ByteLength() const { |
| 5826 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); | 5813 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); |
| 5827 return static_cast<size_t>(obj->byte_length()->Number()); | 5814 return static_cast<size_t>(obj->byte_length()->Number()); |
| 5828 } | 5815 } |
| 5829 | 5816 |
| 5830 | 5817 |
| 5831 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) { | 5818 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) { |
| (...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7351 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7338 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7352 Address callback_address = | 7339 Address callback_address = |
| 7353 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7340 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7354 VMState<EXTERNAL> state(isolate); | 7341 VMState<EXTERNAL> state(isolate); |
| 7355 ExternalCallbackScope call_scope(isolate, callback_address); | 7342 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7356 callback(info); | 7343 callback(info); |
| 7357 } | 7344 } |
| 7358 | 7345 |
| 7359 | 7346 |
| 7360 } } // namespace v8::internal | 7347 } } // namespace v8::internal |
| OLD | NEW |