OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/runtime/runtime.h" | 8 #include "src/runtime/runtime.h" |
9 #include "src/runtime/runtime-utils.h" | 9 #include "src/runtime/runtime-utils.h" |
10 | 10 |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 void Runtime::FreeArrayBuffer(Isolate* isolate, | 15 void Runtime::FreeArrayBuffer(Isolate* isolate, |
16 JSArrayBuffer* phantom_array_buffer) { | 16 JSArrayBuffer* phantom_array_buffer) { |
17 if (phantom_array_buffer->should_be_freed()) { | |
18 DCHECK(phantom_array_buffer->is_external()); | |
19 free(phantom_array_buffer->backing_store()); | |
20 } | |
21 if (phantom_array_buffer->is_external()) return; | 17 if (phantom_array_buffer->is_external()) return; |
22 | 18 |
23 size_t allocated_length = | 19 size_t allocated_length = |
24 NumberToSize(isolate, phantom_array_buffer->byte_length()); | 20 NumberToSize(isolate, phantom_array_buffer->byte_length()); |
25 | 21 |
26 reinterpret_cast<v8::Isolate*>(isolate) | 22 reinterpret_cast<v8::Isolate*>(isolate) |
27 ->AdjustAmountOfExternalAllocatedMemory( | 23 ->AdjustAmountOfExternalAllocatedMemory( |
28 -static_cast<int64_t>(allocated_length)); | 24 -static_cast<int64_t>(allocated_length)); |
29 CHECK(V8::ArrayBufferAllocator() != NULL); | 25 CHECK(V8::ArrayBufferAllocator() != NULL); |
30 V8::ArrayBufferAllocator()->Free(phantom_array_buffer->backing_store(), | 26 V8::ArrayBufferAllocator()->Free(phantom_array_buffer->backing_store(), |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 DATA_VIEW_SETTER(Uint16, uint16_t) | 745 DATA_VIEW_SETTER(Uint16, uint16_t) |
750 DATA_VIEW_SETTER(Int16, int16_t) | 746 DATA_VIEW_SETTER(Int16, int16_t) |
751 DATA_VIEW_SETTER(Uint32, uint32_t) | 747 DATA_VIEW_SETTER(Uint32, uint32_t) |
752 DATA_VIEW_SETTER(Int32, int32_t) | 748 DATA_VIEW_SETTER(Int32, int32_t) |
753 DATA_VIEW_SETTER(Float32, float) | 749 DATA_VIEW_SETTER(Float32, float) |
754 DATA_VIEW_SETTER(Float64, double) | 750 DATA_VIEW_SETTER(Float64, double) |
755 | 751 |
756 #undef DATA_VIEW_SETTER | 752 #undef DATA_VIEW_SETTER |
757 } | 753 } |
758 } // namespace v8::internal | 754 } // namespace v8::internal |
OLD | NEW |