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

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

Issue 1178403003: Revert of Keep track of array buffers in new space separately (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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') | no next file » | 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/messages.h" 8 #include "src/messages.h"
9 #include "src/runtime/runtime.h" 9 #include "src/runtime/runtime.h"
10 #include "src/runtime/runtime-utils.h" 10 #include "src/runtime/runtime-utils.h"
(...skipping 16 matching lines...) Expand all
27 array_buffer->set_is_external(is_external); 27 array_buffer->set_is_external(is_external);
28 array_buffer->set_is_neuterable(shared == SharedFlag::kNotShared); 28 array_buffer->set_is_neuterable(shared == SharedFlag::kNotShared);
29 array_buffer->set_is_shared(shared == SharedFlag::kShared); 29 array_buffer->set_is_shared(shared == SharedFlag::kShared);
30 30
31 Handle<Object> byte_length = 31 Handle<Object> byte_length =
32 isolate->factory()->NewNumberFromSize(allocated_length); 32 isolate->factory()->NewNumberFromSize(allocated_length);
33 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); 33 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber());
34 array_buffer->set_byte_length(*byte_length); 34 array_buffer->set_byte_length(*byte_length);
35 35
36 if (data && !is_external) { 36 if (data && !is_external) {
37 isolate->heap()->RegisterNewArrayBuffer( 37 isolate->heap()->RegisterNewArrayBuffer(data, allocated_length);
38 isolate->heap()->InNewSpace(*array_buffer), data, allocated_length);
39 } 38 }
40 } 39 }
41 40
42 41
43 bool Runtime::SetupArrayBufferAllocatingData(Isolate* isolate, 42 bool Runtime::SetupArrayBufferAllocatingData(Isolate* isolate,
44 Handle<JSArrayBuffer> array_buffer, 43 Handle<JSArrayBuffer> array_buffer,
45 size_t allocated_length, 44 size_t allocated_length,
46 bool initialize, 45 bool initialize,
47 SharedFlag shared) { 46 SharedFlag shared) {
48 void* data; 47 void* data;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 CHECK(Smi::FromInt(0) == array_buffer->byte_length()); 143 CHECK(Smi::FromInt(0) == array_buffer->byte_length());
145 return isolate->heap()->undefined_value(); 144 return isolate->heap()->undefined_value();
146 } 145 }
147 // Shared array buffers should never be neutered. 146 // Shared array buffers should never be neutered.
148 RUNTIME_ASSERT(!array_buffer->is_shared()); 147 RUNTIME_ASSERT(!array_buffer->is_shared());
149 DCHECK(!array_buffer->is_external()); 148 DCHECK(!array_buffer->is_external());
150 void* backing_store = array_buffer->backing_store(); 149 void* backing_store = array_buffer->backing_store();
151 size_t byte_length = NumberToSize(isolate, array_buffer->byte_length()); 150 size_t byte_length = NumberToSize(isolate, array_buffer->byte_length());
152 array_buffer->set_is_external(true); 151 array_buffer->set_is_external(true);
153 Runtime::NeuterArrayBuffer(array_buffer); 152 Runtime::NeuterArrayBuffer(array_buffer);
154 isolate->heap()->UnregisterArrayBuffer( 153 isolate->heap()->UnregisterArrayBuffer(backing_store);
155 isolate->heap()->InNewSpace(*array_buffer), backing_store);
156 isolate->array_buffer_allocator()->Free(backing_store, byte_length); 154 isolate->array_buffer_allocator()->Free(backing_store, byte_length);
157 return isolate->heap()->undefined_value(); 155 return isolate->heap()->undefined_value();
158 } 156 }
159 157
160 158
161 void Runtime::ArrayIdToTypeAndSize(int arrayId, ExternalArrayType* array_type, 159 void Runtime::ArrayIdToTypeAndSize(int arrayId, ExternalArrayType* array_type,
162 ElementsKind* external_elements_kind, 160 ElementsKind* external_elements_kind,
163 ElementsKind* fixed_elements_kind, 161 ElementsKind* fixed_elements_kind,
164 size_t* element_size) { 162 size_t* element_size) {
165 switch (arrayId) { 163 switch (arrayId) {
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 DATA_VIEW_SETTER(Uint16, uint16_t) 747 DATA_VIEW_SETTER(Uint16, uint16_t)
750 DATA_VIEW_SETTER(Int16, int16_t) 748 DATA_VIEW_SETTER(Int16, int16_t)
751 DATA_VIEW_SETTER(Uint32, uint32_t) 749 DATA_VIEW_SETTER(Uint32, uint32_t)
752 DATA_VIEW_SETTER(Int32, int32_t) 750 DATA_VIEW_SETTER(Int32, int32_t)
753 DATA_VIEW_SETTER(Float32, float) 751 DATA_VIEW_SETTER(Float32, float)
754 DATA_VIEW_SETTER(Float64, double) 752 DATA_VIEW_SETTER(Float64, double)
755 753
756 #undef DATA_VIEW_SETTER 754 #undef DATA_VIEW_SETTER
757 } // namespace internal 755 } // namespace internal
758 } // namespace v8 756 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698