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 2827443002: Reland [typedarrays] Check detached buffer at start of typed array methods (Closed)
Patch Set: rebase Created 3 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/runtime/runtime.h ('k') | test/mjsunit/es6/typedarray-copywithin.js » ('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/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/elements.h" 8 #include "src/elements.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 CONVERT_ARG_HANDLE_CHECKED(JS##Type, holder, 0); \ 73 CONVERT_ARG_HANDLE_CHECKED(JS##Type, holder, 0); \
74 return holder->accessor(); \ 74 return holder->accessor(); \
75 } 75 }
76 76
77 BUFFER_VIEW_GETTER(ArrayBufferView, ByteLength, byte_length) 77 BUFFER_VIEW_GETTER(ArrayBufferView, ByteLength, byte_length)
78 BUFFER_VIEW_GETTER(ArrayBufferView, ByteOffset, byte_offset) 78 BUFFER_VIEW_GETTER(ArrayBufferView, ByteOffset, byte_offset)
79 BUFFER_VIEW_GETTER(TypedArray, Length, length) 79 BUFFER_VIEW_GETTER(TypedArray, Length, length)
80 80
81 #undef BUFFER_VIEW_GETTER 81 #undef BUFFER_VIEW_GETTER
82 82
83 RUNTIME_FUNCTION(Runtime_ArrayBufferViewWasNeutered) {
84 HandleScope scope(isolate);
85 DCHECK_EQ(1, args.length());
86 return isolate->heap()->ToBoolean(JSTypedArray::cast(args[0])->WasNeutered());
87 }
88
83 RUNTIME_FUNCTION(Runtime_TypedArrayGetBuffer) { 89 RUNTIME_FUNCTION(Runtime_TypedArrayGetBuffer) {
84 HandleScope scope(isolate); 90 HandleScope scope(isolate);
85 DCHECK_EQ(1, args.length()); 91 DCHECK_EQ(1, args.length());
86 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); 92 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0);
87 return *holder->GetBuffer(); 93 return *holder->GetBuffer();
88 } 94 }
89 95
90 96
91 // Return codes for Runtime_TypedArraySetFastCases. 97 // Return codes for Runtime_TypedArraySetFastCases.
92 // Should be synchronized with typedarray.js natives. 98 // Should be synchronized with typedarray.js natives.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 return Smi::FromInt(FLAG_typed_array_max_size_in_heap); 238 return Smi::FromInt(FLAG_typed_array_max_size_in_heap);
233 } 239 }
234 240
235 241
236 RUNTIME_FUNCTION(Runtime_IsTypedArray) { 242 RUNTIME_FUNCTION(Runtime_IsTypedArray) {
237 HandleScope scope(isolate); 243 HandleScope scope(isolate);
238 DCHECK_EQ(1, args.length()); 244 DCHECK_EQ(1, args.length());
239 return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray()); 245 return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray());
240 } 246 }
241 247
242
243 RUNTIME_FUNCTION(Runtime_IsSharedTypedArray) { 248 RUNTIME_FUNCTION(Runtime_IsSharedTypedArray) {
244 HandleScope scope(isolate); 249 HandleScope scope(isolate);
245 DCHECK_EQ(1, args.length()); 250 DCHECK_EQ(1, args.length());
246 return isolate->heap()->ToBoolean( 251 return isolate->heap()->ToBoolean(
247 args[0]->IsJSTypedArray() && 252 args[0]->IsJSTypedArray() &&
248 JSTypedArray::cast(args[0])->GetBuffer()->is_shared()); 253 JSTypedArray::cast(args[0])->GetBuffer()->is_shared());
249 } 254 }
250 255
251 256
252 RUNTIME_FUNCTION(Runtime_IsSharedIntegerTypedArray) { 257 RUNTIME_FUNCTION(Runtime_IsSharedIntegerTypedArray) {
(...skipping 18 matching lines...) Expand all
271 return isolate->heap()->false_value(); 276 return isolate->heap()->false_value();
272 } 277 }
273 278
274 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); 279 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0]));
275 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && 280 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() &&
276 obj->type() == kExternalInt32Array); 281 obj->type() == kExternalInt32Array);
277 } 282 }
278 283
279 } // namespace internal 284 } // namespace internal
280 } // namespace v8 285 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/es6/typedarray-copywithin.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698