Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: src/runtime/runtime-typedarray.cc

Issue 1324023007: [heap] introduce ArrayBufferTracker (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: destructor Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/messages.h" 9 #include "src/messages.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (array_buffer->backing_store() == NULL) { 85 if (array_buffer->backing_store() == NULL) {
86 CHECK(Smi::FromInt(0) == array_buffer->byte_length()); 86 CHECK(Smi::FromInt(0) == array_buffer->byte_length());
87 return isolate->heap()->undefined_value(); 87 return isolate->heap()->undefined_value();
88 } 88 }
89 // Shared array buffers should never be neutered. 89 // Shared array buffers should never be neutered.
90 RUNTIME_ASSERT(!array_buffer->is_shared()); 90 RUNTIME_ASSERT(!array_buffer->is_shared());
91 DCHECK(!array_buffer->is_external()); 91 DCHECK(!array_buffer->is_external());
92 void* backing_store = array_buffer->backing_store(); 92 void* backing_store = array_buffer->backing_store();
93 size_t byte_length = NumberToSize(isolate, array_buffer->byte_length()); 93 size_t byte_length = NumberToSize(isolate, array_buffer->byte_length());
94 array_buffer->set_is_external(true); 94 array_buffer->set_is_external(true);
95 isolate->heap()->UnregisterArrayBuffer(*array_buffer);
95 array_buffer->Neuter(); 96 array_buffer->Neuter();
96 isolate->heap()->UnregisterArrayBuffer(
97 isolate->heap()->InNewSpace(*array_buffer), backing_store);
98 isolate->array_buffer_allocator()->Free(backing_store, byte_length); 97 isolate->array_buffer_allocator()->Free(backing_store, byte_length);
99 return isolate->heap()->undefined_value(); 98 return isolate->heap()->undefined_value();
100 } 99 }
101 100
102 101
103 void Runtime::ArrayIdToTypeAndSize(int arrayId, ExternalArrayType* array_type, 102 void Runtime::ArrayIdToTypeAndSize(int arrayId, ExternalArrayType* array_type,
104 ElementsKind* fixed_elements_kind, 103 ElementsKind* fixed_elements_kind,
105 size_t* element_size) { 104 size_t* element_size) {
106 switch (arrayId) { 105 switch (arrayId) {
107 #define ARRAY_ID_CASE(Type, type, TYPE, ctype, size) \ 106 #define ARRAY_ID_CASE(Type, type, TYPE, ctype, size) \
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 DATA_VIEW_SETTER(Uint16, uint16_t) 681 DATA_VIEW_SETTER(Uint16, uint16_t)
683 DATA_VIEW_SETTER(Int16, int16_t) 682 DATA_VIEW_SETTER(Int16, int16_t)
684 DATA_VIEW_SETTER(Uint32, uint32_t) 683 DATA_VIEW_SETTER(Uint32, uint32_t)
685 DATA_VIEW_SETTER(Int32, int32_t) 684 DATA_VIEW_SETTER(Int32, int32_t)
686 DATA_VIEW_SETTER(Float32, float) 685 DATA_VIEW_SETTER(Float32, float)
687 DATA_VIEW_SETTER(Float64, double) 686 DATA_VIEW_SETTER(Float64, double)
688 687
689 #undef DATA_VIEW_SETTER 688 #undef DATA_VIEW_SETTER
690 } // namespace internal 689 } // namespace internal
691 } // namespace v8 690 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698