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 5905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5916 | 5916 |
5917 | 5917 |
5918 void v8::ArrayBuffer::Neuter() { | 5918 void v8::ArrayBuffer::Neuter() { |
5919 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); | 5919 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); |
5920 i::Isolate* isolate = obj->GetIsolate(); | 5920 i::Isolate* isolate = obj->GetIsolate(); |
5921 Utils::ApiCheck(obj->is_external(), | 5921 Utils::ApiCheck(obj->is_external(), |
5922 "v8::ArrayBuffer::Neuter", | 5922 "v8::ArrayBuffer::Neuter", |
5923 "Only externalized ArrayBuffers can be neutered"); | 5923 "Only externalized ArrayBuffers can be neutered"); |
5924 LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()"); | 5924 LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()"); |
5925 ENTER_V8(isolate); | 5925 ENTER_V8(isolate); |
5926 | 5926 i::Runtime::NeuterArrayBuffer(obj); |
5927 for (i::Handle<i::Object> view_obj(obj->weak_first_view(), isolate); | |
5928 !view_obj->IsUndefined();) { | |
5929 i::Handle<i::JSArrayBufferView> view(i::JSArrayBufferView::cast(*view_obj)); | |
5930 if (view->IsJSTypedArray()) { | |
5931 i::JSTypedArray::cast(*view)->Neuter(); | |
5932 } else if (view->IsJSDataView()) { | |
5933 i::JSDataView::cast(*view)->Neuter(); | |
5934 } else { | |
5935 UNREACHABLE(); | |
5936 } | |
5937 view_obj = i::handle(view->weak_next(), isolate); | |
5938 } | |
5939 obj->Neuter(); | |
5940 } | 5927 } |
5941 | 5928 |
5942 | 5929 |
5943 size_t v8::ArrayBuffer::ByteLength() const { | 5930 size_t v8::ArrayBuffer::ByteLength() const { |
5944 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); | 5931 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); |
5945 return static_cast<size_t>(obj->byte_length()->Number()); | 5932 return static_cast<size_t>(obj->byte_length()->Number()); |
5946 } | 5933 } |
5947 | 5934 |
5948 | 5935 |
5949 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) { | 5936 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) { |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7505 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7492 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7506 Address callback_address = | 7493 Address callback_address = |
7507 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7494 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7508 VMState<EXTERNAL> state(isolate); | 7495 VMState<EXTERNAL> state(isolate); |
7509 ExternalCallbackScope call_scope(isolate, callback_address); | 7496 ExternalCallbackScope call_scope(isolate, callback_address); |
7510 callback(info); | 7497 callback(info); |
7511 } | 7498 } |
7512 | 7499 |
7513 | 7500 |
7514 } } // namespace v8::internal | 7501 } } // namespace v8::internal |
OLD | NEW |