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

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

Issue 1112503002: Turn JSArrayBuffer::flags into a bit field (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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-inl.h ('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/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 24 matching lines...) Expand all
35 void Runtime::SetupArrayBuffer(Isolate* isolate, 35 void Runtime::SetupArrayBuffer(Isolate* isolate,
36 Handle<JSArrayBuffer> array_buffer, 36 Handle<JSArrayBuffer> array_buffer,
37 bool is_external, void* data, 37 bool is_external, void* data,
38 size_t allocated_length) { 38 size_t allocated_length) {
39 DCHECK(array_buffer->GetInternalFieldCount() == 39 DCHECK(array_buffer->GetInternalFieldCount() ==
40 v8::ArrayBuffer::kInternalFieldCount); 40 v8::ArrayBuffer::kInternalFieldCount);
41 for (int i = 0; i < v8::ArrayBuffer::kInternalFieldCount; i++) { 41 for (int i = 0; i < v8::ArrayBuffer::kInternalFieldCount; i++) {
42 array_buffer->SetInternalField(i, Smi::FromInt(0)); 42 array_buffer->SetInternalField(i, Smi::FromInt(0));
43 } 43 }
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_bit_field(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 if (isolate->heap()->InNewSpace(*array_buffer) || 54 if (isolate->heap()->InNewSpace(*array_buffer) ||
55 isolate->heap()->array_buffers_list()->IsUndefined()) { 55 isolate->heap()->array_buffers_list()->IsUndefined()) {
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 DATA_VIEW_SETTER(Uint16, uint16_t) 749 DATA_VIEW_SETTER(Uint16, uint16_t)
750 DATA_VIEW_SETTER(Int16, int16_t) 750 DATA_VIEW_SETTER(Int16, int16_t)
751 DATA_VIEW_SETTER(Uint32, uint32_t) 751 DATA_VIEW_SETTER(Uint32, uint32_t)
752 DATA_VIEW_SETTER(Int32, int32_t) 752 DATA_VIEW_SETTER(Int32, int32_t)
753 DATA_VIEW_SETTER(Float32, float) 753 DATA_VIEW_SETTER(Float32, float)
754 DATA_VIEW_SETTER(Float64, double) 754 DATA_VIEW_SETTER(Float64, double)
755 755
756 #undef DATA_VIEW_SETTER 756 #undef DATA_VIEW_SETTER
757 } 757 }
758 } // namespace v8::internal 758 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698