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

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: split out 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
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/heap/array-buffer-tracker.h"
Michael Lippautz 2015/09/04 08:24:15 Only include src/heap/heap.h
fedor.indutny 2015/09/04 08:58:05 Acknowledged, doesn't look like it is needed.
9 #include "src/messages.h" 10 #include "src/messages.h"
10 #include "src/objects-inl.h" 11 #include "src/objects-inl.h"
11 #include "src/runtime/runtime.h" 12 #include "src/runtime/runtime.h"
12 13
13 namespace v8 { 14 namespace v8 {
14 namespace internal { 15 namespace internal {
15 16
16 17
17 RUNTIME_FUNCTION(Runtime_ArrayBufferInitialize) { 18 RUNTIME_FUNCTION(Runtime_ArrayBufferInitialize) {
18 HandleScope scope(isolate); 19 HandleScope scope(isolate);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (array_buffer->backing_store() == NULL) { 86 if (array_buffer->backing_store() == NULL) {
86 CHECK(Smi::FromInt(0) == array_buffer->byte_length()); 87 CHECK(Smi::FromInt(0) == array_buffer->byte_length());
87 return isolate->heap()->undefined_value(); 88 return isolate->heap()->undefined_value();
88 } 89 }
89 // Shared array buffers should never be neutered. 90 // Shared array buffers should never be neutered.
90 RUNTIME_ASSERT(!array_buffer->is_shared()); 91 RUNTIME_ASSERT(!array_buffer->is_shared());
91 DCHECK(!array_buffer->is_external()); 92 DCHECK(!array_buffer->is_external());
92 void* backing_store = array_buffer->backing_store(); 93 void* backing_store = array_buffer->backing_store();
93 size_t byte_length = NumberToSize(isolate, array_buffer->byte_length()); 94 size_t byte_length = NumberToSize(isolate, array_buffer->byte_length());
94 array_buffer->set_is_external(true); 95 array_buffer->set_is_external(true);
96 isolate->heap()->array_buffer_tracker()->Unregister(*array_buffer);
Michael Lippautz 2015/09/04 08:24:16 Use the wrapper call for Unregister.
fedor.indutny 2015/09/04 08:58:05 Acknowledged.
95 array_buffer->Neuter(); 97 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); 98 isolate->array_buffer_allocator()->Free(backing_store, byte_length);
99 return isolate->heap()->undefined_value(); 99 return isolate->heap()->undefined_value();
100 } 100 }
101 101
102 102
103 void Runtime::ArrayIdToTypeAndSize(int arrayId, ExternalArrayType* array_type, 103 void Runtime::ArrayIdToTypeAndSize(int arrayId, ExternalArrayType* array_type,
104 ElementsKind* fixed_elements_kind, 104 ElementsKind* fixed_elements_kind,
105 size_t* element_size) { 105 size_t* element_size) {
106 switch (arrayId) { 106 switch (arrayId) {
107 #define ARRAY_ID_CASE(Type, type, TYPE, ctype, size) \ 107 #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) 682 DATA_VIEW_SETTER(Uint16, uint16_t)
683 DATA_VIEW_SETTER(Int16, int16_t) 683 DATA_VIEW_SETTER(Int16, int16_t)
684 DATA_VIEW_SETTER(Uint32, uint32_t) 684 DATA_VIEW_SETTER(Uint32, uint32_t)
685 DATA_VIEW_SETTER(Int32, int32_t) 685 DATA_VIEW_SETTER(Int32, int32_t)
686 DATA_VIEW_SETTER(Float32, float) 686 DATA_VIEW_SETTER(Float32, float)
687 DATA_VIEW_SETTER(Float64, double) 687 DATA_VIEW_SETTER(Float64, double)
688 688
689 #undef DATA_VIEW_SETTER 689 #undef DATA_VIEW_SETTER
690 } // namespace internal 690 } // namespace internal
691 } // namespace v8 691 } // namespace v8
OLDNEW
« src/objects.cc ('K') | « src/objects.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698