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

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

Issue 684103002: allow disabling of ArrayBuffer neutering (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-api.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 26 matching lines...) Expand all
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_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 48
48 Handle<Object> byte_length = 49 Handle<Object> byte_length =
49 isolate->factory()->NewNumberFromSize(allocated_length); 50 isolate->factory()->NewNumberFromSize(allocated_length);
50 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); 51 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber());
51 array_buffer->set_byte_length(*byte_length); 52 array_buffer->set_byte_length(*byte_length);
52 53
53 array_buffer->set_weak_next(isolate->heap()->array_buffers_list()); 54 array_buffer->set_weak_next(isolate->heap()->array_buffers_list());
54 isolate->heap()->set_array_buffers_list(*array_buffer); 55 isolate->heap()->set_array_buffers_list(*array_buffer);
55 array_buffer->set_weak_first_view(isolate->heap()->undefined_value()); 56 array_buffer->set_weak_first_view(isolate->heap()->undefined_value());
56 } 57 }
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 DATA_VIEW_SETTER(Uint16, uint16_t) 759 DATA_VIEW_SETTER(Uint16, uint16_t)
759 DATA_VIEW_SETTER(Int16, int16_t) 760 DATA_VIEW_SETTER(Int16, int16_t)
760 DATA_VIEW_SETTER(Uint32, uint32_t) 761 DATA_VIEW_SETTER(Uint32, uint32_t)
761 DATA_VIEW_SETTER(Int32, int32_t) 762 DATA_VIEW_SETTER(Int32, int32_t)
762 DATA_VIEW_SETTER(Float32, float) 763 DATA_VIEW_SETTER(Float32, float)
763 DATA_VIEW_SETTER(Float64, double) 764 DATA_VIEW_SETTER(Float64, double)
764 765
765 #undef DATA_VIEW_SETTER 766 #undef DATA_VIEW_SETTER
766 } 767 }
767 } // namespace v8::internal 768 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698