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

Unified Diff: src/runtime/runtime-typedarray.cc

Issue 1574903004: TypedArray and ArrayBuffer support for @@species (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Upload tests and make some code more clear Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/es6/legacy-subclassing.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-typedarray.cc
diff --git a/src/runtime/runtime-typedarray.cc b/src/runtime/runtime-typedarray.cc
index 14368e58c6e796cae3e100c392037cd4869ca665..a82b71ddf283748d2136a17660d98e1a5bf341f6 100644
--- a/src/runtime/runtime-typedarray.cc
+++ b/src/runtime/runtime-typedarray.cc
@@ -23,14 +23,16 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferGetByteLength) {
RUNTIME_FUNCTION(Runtime_ArrayBufferSliceImpl) {
HandleScope scope(isolate);
- DCHECK(args.length() == 3);
+ DCHECK(args.length() == 4);
CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, source, 0);
CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, target, 1);
CONVERT_NUMBER_ARG_HANDLE_CHECKED(first, 2);
+ CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3);
RUNTIME_ASSERT(!source.is_identical_to(target));
- size_t start = 0;
+ size_t start = 0, target_length = 0;
RUNTIME_ASSERT(TryNumberToSize(isolate, *first, &start));
- size_t target_length = NumberToSize(isolate, target->byte_length());
+ RUNTIME_ASSERT(TryNumberToSize(isolate, *new_length, &target_length));
+ RUNTIME_ASSERT(NumberToSize(isolate, target->byte_length()) >= target_length);
if (target_length == 0) return isolate->heap()->undefined_value();
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/es6/legacy-subclassing.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698