| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 }) |
| OLD | NEW |