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

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

Issue 2778623003: [typedarrays] Check detached buffer at start of typed array methods (Closed)
Patch Set: Created 3 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
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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 return Smi::FromInt(FLAG_typed_array_max_size_in_heap); 353 return Smi::FromInt(FLAG_typed_array_max_size_in_heap);
354 } 354 }
355 355
356 356
357 RUNTIME_FUNCTION(Runtime_IsTypedArray) { 357 RUNTIME_FUNCTION(Runtime_IsTypedArray) {
358 HandleScope scope(isolate); 358 HandleScope scope(isolate);
359 DCHECK_EQ(1, args.length()); 359 DCHECK_EQ(1, args.length());
360 return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray()); 360 return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray());
361 } 361 }
362 362
363 RUNTIME_FUNCTION(Runtime_ValidateTypedArray) {
364 HandleScope scope(isolate);
365 DCHECK_EQ(2, args.length());
366 CONVERT_ARG_HANDLE_CHECKED(Object, target_obj, 0);
367 CONVERT_ARG_HANDLE_CHECKED(String, method, 1);
368 RETURN_RESULT_OR_FAILURE(
369 isolate,
370 JSTypedArray::Validate(isolate, target_obj, method->ToCString().get()));
371 }
363 372
364 RUNTIME_FUNCTION(Runtime_IsSharedTypedArray) { 373 RUNTIME_FUNCTION(Runtime_IsSharedTypedArray) {
365 HandleScope scope(isolate); 374 HandleScope scope(isolate);
366 DCHECK_EQ(1, args.length()); 375 DCHECK_EQ(1, args.length());
367 return isolate->heap()->ToBoolean( 376 return isolate->heap()->ToBoolean(
368 args[0]->IsJSTypedArray() && 377 args[0]->IsJSTypedArray() &&
369 JSTypedArray::cast(args[0])->GetBuffer()->is_shared()); 378 JSTypedArray::cast(args[0])->GetBuffer()->is_shared());
370 } 379 }
371 380
372 381
(...skipping 19 matching lines...) Expand all
392 return isolate->heap()->false_value(); 401 return isolate->heap()->false_value();
393 } 402 }
394 403
395 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); 404 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0]));
396 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && 405 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() &&
397 obj->type() == kExternalInt32Array); 406 obj->type() == kExternalInt32Array);
398 } 407 }
399 408
400 } // namespace internal 409 } // namespace internal
401 } // namespace v8 410 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698