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 5918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5929 | 5929 |
5930 | 5930 |
5931 void v8::ArrayBuffer::Neuter() { | 5931 void v8::ArrayBuffer::Neuter() { |
5932 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); | 5932 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); |
5933 i::Isolate* isolate = obj->GetIsolate(); | 5933 i::Isolate* isolate = obj->GetIsolate(); |
5934 Utils::ApiCheck(obj->is_external(), | 5934 Utils::ApiCheck(obj->is_external(), |
5935 "v8::ArrayBuffer::Neuter", | 5935 "v8::ArrayBuffer::Neuter", |
5936 "Only externalized ArrayBuffers can be neutered"); | 5936 "Only externalized ArrayBuffers can be neutered"); |
5937 LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()"); | 5937 LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()"); |
5938 ENTER_V8(isolate); | 5938 ENTER_V8(isolate); |
5939 | 5939 i::Runtime::NeuterArrayBuffer(obj); |
5940 for (i::Handle<i::Object> view_obj(obj->weak_first_view(), isolate); | |
5941 !view_obj->IsUndefined();) { | |
5942 i::Handle<i::JSArrayBufferView> view(i::JSArrayBufferView::cast(*view_obj)); | |
5943 if (view->IsJSTypedArray()) { | |
5944 i::JSTypedArray::cast(*view)->Neuter(); | |
5945 } else if (view->IsJSDataView()) { | |
5946 i::JSDataView::cast(*view)->Neuter(); | |
5947 } else { | |
5948 UNREACHABLE(); | |
5949 } | |
5950 view_obj = i::handle(view->weak_next(), isolate); | |
5951 } | |
5952 obj->Neuter(); | |
5953 } | 5940 } |
5954 | 5941 |
5955 | 5942 |
5956 size_t v8::ArrayBuffer::ByteLength() const { | 5943 size_t v8::ArrayBuffer::ByteLength() const { |
5957 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); | 5944 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); |
5958 return static_cast<size_t>(obj->byte_length()->Number()); | 5945 return static_cast<size_t>(obj->byte_length()->Number()); |
5959 } | 5946 } |
5960 | 5947 |
5961 | 5948 |
5962 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) { | 5949 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) { |
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7515 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7502 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7516 Address callback_address = | 7503 Address callback_address = |
7517 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7504 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7518 VMState<EXTERNAL> state(isolate); | 7505 VMState<EXTERNAL> state(isolate); |
7519 ExternalCallbackScope call_scope(isolate, callback_address); | 7506 ExternalCallbackScope call_scope(isolate, callback_address); |
7520 callback(info); | 7507 callback(info); |
7521 } | 7508 } |
7522 | 7509 |
7523 | 7510 |
7524 } } // namespace v8::internal | 7511 } } // namespace v8::internal |
OLD | NEW |