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

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

Issue 1079923003: Put newly allocated buffers at the right end of the buffers list (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/heap/objects-visiting.cc ('k') | src/snapshot/serialize.cc » ('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/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
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 array_buffer->set_backing_store(data); 44 array_buffer->set_backing_store(data);
45 array_buffer->set_flag(Smi::FromInt(0)); 45 array_buffer->set_flag(Smi::FromInt(0));
46 array_buffer->set_is_external(is_external); 46 array_buffer->set_is_external(is_external);
47 array_buffer->set_is_neuterable(true); 47 array_buffer->set_is_neuterable(true);
48 48
49 Handle<Object> byte_length = 49 Handle<Object> byte_length =
50 isolate->factory()->NewNumberFromSize(allocated_length); 50 isolate->factory()->NewNumberFromSize(allocated_length);
51 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); 51 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber());
52 array_buffer->set_byte_length(*byte_length); 52 array_buffer->set_byte_length(*byte_length);
53 53
54 array_buffer->set_weak_next(isolate->heap()->array_buffers_list()); 54 if (isolate->heap()->InNewSpace(*array_buffer) ||
55 CHECK(isolate->heap()->InNewSpace(*array_buffer)); 55 isolate->heap()->array_buffers_list()->IsUndefined()) {
56 isolate->heap()->set_array_buffers_list(*array_buffer); 56 array_buffer->set_weak_next(isolate->heap()->array_buffers_list());
57 isolate->heap()->set_array_buffers_list(*array_buffer);
58 if (isolate->heap()->last_array_buffer_in_list()->IsUndefined()) {
59 isolate->heap()->set_last_array_buffer_in_list(*array_buffer);
60 }
61 } else {
62 JSArrayBuffer::cast(isolate->heap()->last_array_buffer_in_list())
63 ->set_weak_next(*array_buffer);
64 isolate->heap()->set_last_array_buffer_in_list(*array_buffer);
65 }
57 array_buffer->set_weak_first_view(isolate->heap()->undefined_value()); 66 array_buffer->set_weak_first_view(isolate->heap()->undefined_value());
58 } 67 }
59 68
60 69
61 bool Runtime::SetupArrayBufferAllocatingData(Isolate* isolate, 70 bool Runtime::SetupArrayBufferAllocatingData(Isolate* isolate,
62 Handle<JSArrayBuffer> array_buffer, 71 Handle<JSArrayBuffer> array_buffer,
63 size_t allocated_length, 72 size_t allocated_length,
64 bool initialize) { 73 bool initialize) {
65 void* data; 74 void* data;
66 CHECK(V8::ArrayBufferAllocator() != NULL); 75 CHECK(V8::ArrayBufferAllocator() != NULL);
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 DATA_VIEW_SETTER(Uint16, uint16_t) 811 DATA_VIEW_SETTER(Uint16, uint16_t)
803 DATA_VIEW_SETTER(Int16, int16_t) 812 DATA_VIEW_SETTER(Int16, int16_t)
804 DATA_VIEW_SETTER(Uint32, uint32_t) 813 DATA_VIEW_SETTER(Uint32, uint32_t)
805 DATA_VIEW_SETTER(Int32, int32_t) 814 DATA_VIEW_SETTER(Int32, int32_t)
806 DATA_VIEW_SETTER(Float32, float) 815 DATA_VIEW_SETTER(Float32, float)
807 DATA_VIEW_SETTER(Float64, double) 816 DATA_VIEW_SETTER(Float64, double)
808 817
809 #undef DATA_VIEW_SETTER 818 #undef DATA_VIEW_SETTER
810 } 819 }
811 } // namespace v8::internal 820 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/snapshot/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698