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

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

Issue 2761453002: [typedarrays] Implement %TypedArray%.prototype.reverse in C++ (Closed)
Patch Set: rebase Created 3 years, 9 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/builtins/builtins.h ('k') | src/elements.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-typedarray.cc
diff --git a/src/builtins/builtins-typedarray.cc b/src/builtins/builtins-typedarray.cc
index ceed1730ef5947c9744ef8cd3e9395510a7bff3d..030289ca85db2044dc768bfad055bdb2989192d7 100644
--- a/src/builtins/builtins-typedarray.cc
+++ b/src/builtins/builtins-typedarray.cc
@@ -255,5 +255,20 @@ BUILTIN(TypedArrayPrototypeLastIndexOf) {
return *isolate->factory()->NewNumberFromInt64(result.FromJust());
}
+BUILTIN(TypedArrayPrototypeReverse) {
+ HandleScope scope(isolate);
+
+ Handle<JSTypedArray> array;
+ const char* method = "%TypedArray%.prototype.reverse";
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method));
+
+ if (V8_UNLIKELY(array->WasNeutered())) return *array;
+
+ ElementsAccessor* elements = array->GetElementsAccessor();
+ elements->Reverse(*array);
+ return *array;
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/builtins/builtins.h ('k') | src/elements.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698