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

Unified Diff: src/js/runtime.js

Issue 2090353003: Amend DataView, ArrayBuffer, and TypedArray methods to use ToIndex. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comment Created 4 years, 6 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.cc ('k') | src/js/typedarray.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/runtime.js
diff --git a/src/js/runtime.js b/src/js/runtime.js
index 216685fe4f2692eba560e0be9aedd03a919b6c01..4983d81df738f3a9754dd55efad580b2ae454d42 100644
--- a/src/js/runtime.js
+++ b/src/js/runtime.js
@@ -45,6 +45,13 @@ function ToPositiveInteger(x, rangeErrorIndex) {
}
+function ToIndex(x, rangeErrorIndex) {
+ var i = TO_INTEGER(x) + 0;
+ if (i < 0 || i > kMaxSafeInteger) throw MakeRangeError(rangeErrorIndex);
+ return i;
+}
+
+
function MaxSimple(a, b) {
return a > b ? a : b;
}
@@ -94,6 +101,7 @@ utils.Export(function(to) {
to.MaxSimple = MaxSimple;
to.MinSimple = MinSimple;
to.ToPositiveInteger = ToPositiveInteger;
+ to.ToIndex = ToIndex;
to.SpeciesConstructor = SpeciesConstructor;
});
« no previous file with comments | « src/builtins.cc ('k') | src/js/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698