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

Side by Side 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, 5 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/builtins.cc ('k') | src/js/typedarray.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 // This files contains runtime support implemented in JavaScript. 5 // This files contains runtime support implemented in JavaScript.
6 6
7 // CAUTION: Some of the functions specified in this file are called 7 // CAUTION: Some of the functions specified in this file are called
8 // directly from compiled code. These are the functions with names in 8 // directly from compiled code. These are the functions with names in
9 // ALL CAPS. The compiled code passes the first argument in 'this'. 9 // ALL CAPS. The compiled code passes the first argument in 'this'.
10 10
(...skipping 27 matching lines...) Expand all
38 */ 38 */
39 39
40 40
41 function ToPositiveInteger(x, rangeErrorIndex) { 41 function ToPositiveInteger(x, rangeErrorIndex) {
42 var i = TO_INTEGER(x) + 0; 42 var i = TO_INTEGER(x) + 0;
43 if (i < 0) throw MakeRangeError(rangeErrorIndex); 43 if (i < 0) throw MakeRangeError(rangeErrorIndex);
44 return i; 44 return i;
45 } 45 }
46 46
47 47
48 function ToIndex(x, rangeErrorIndex) {
49 var i = TO_INTEGER(x) + 0;
50 if (i < 0 || i > kMaxSafeInteger) throw MakeRangeError(rangeErrorIndex);
51 return i;
52 }
53
54
48 function MaxSimple(a, b) { 55 function MaxSimple(a, b) {
49 return a > b ? a : b; 56 return a > b ? a : b;
50 } 57 }
51 58
52 59
53 function MinSimple(a, b) { 60 function MinSimple(a, b) {
54 return a > b ? b : a; 61 return a > b ? b : a;
55 } 62 }
56 63
57 64
(...skipping 29 matching lines...) Expand all
87 // boilerplate gets the right prototype. 94 // boilerplate gets the right prototype.
88 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); 95 %FunctionSetPrototype(GlobalArray, new GlobalArray(0));
89 96
90 // ---------------------------------------------------------------------------- 97 // ----------------------------------------------------------------------------
91 // Exports 98 // Exports
92 99
93 utils.Export(function(to) { 100 utils.Export(function(to) {
94 to.MaxSimple = MaxSimple; 101 to.MaxSimple = MaxSimple;
95 to.MinSimple = MinSimple; 102 to.MinSimple = MinSimple;
96 to.ToPositiveInteger = ToPositiveInteger; 103 to.ToPositiveInteger = ToPositiveInteger;
104 to.ToIndex = ToIndex;
97 to.SpeciesConstructor = SpeciesConstructor; 105 to.SpeciesConstructor = SpeciesConstructor;
98 }); 106 });
99 107
100 }) 108 })
OLDNEW
« 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