| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 */ | 43 */ |
| 44 | 44 |
| 45 | 45 |
| 46 function ToPositiveInteger(x, rangeErrorIndex) { | 46 function ToPositiveInteger(x, rangeErrorIndex) { |
| 47 var i = TO_INTEGER(x) + 0; | 47 var i = TO_INTEGER(x) + 0; |
| 48 if (i < 0) throw MakeRangeError(rangeErrorIndex); | 48 if (i < 0) throw MakeRangeError(rangeErrorIndex); |
| 49 return i; | 49 return i; |
| 50 } | 50 } |
| 51 | 51 |
| 52 | 52 |
| 53 function ToIndex(x, rangeErrorIndex) { |
| 54 var i = TO_INTEGER(x) + 0; |
| 55 if (i < 0 || i > kMaxSafeInteger) throw MakeRangeError(rangeErrorIndex); |
| 56 return i; |
| 57 } |
| 58 |
| 59 |
| 53 function MaxSimple(a, b) { | 60 function MaxSimple(a, b) { |
| 54 return a > b ? a : b; | 61 return a > b ? a : b; |
| 55 } | 62 } |
| 56 | 63 |
| 57 | 64 |
| 58 function MinSimple(a, b) { | 65 function MinSimple(a, b) { |
| 59 return a > b ? b : a; | 66 return a > b ? b : a; |
| 60 } | 67 } |
| 61 | 68 |
| 62 | 69 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // boilerplate gets the right prototype. | 112 // boilerplate gets the right prototype. |
| 106 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); | 113 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); |
| 107 | 114 |
| 108 // ---------------------------------------------------------------------------- | 115 // ---------------------------------------------------------------------------- |
| 109 // Exports | 116 // Exports |
| 110 | 117 |
| 111 utils.Export(function(to) { | 118 utils.Export(function(to) { |
| 112 to.MaxSimple = MaxSimple; | 119 to.MaxSimple = MaxSimple; |
| 113 to.MinSimple = MinSimple; | 120 to.MinSimple = MinSimple; |
| 114 to.ToPositiveInteger = ToPositiveInteger; | 121 to.ToPositiveInteger = ToPositiveInteger; |
| 122 to.ToIndex = ToIndex; |
| 115 to.SpeciesConstructor = SpeciesConstructor; | 123 to.SpeciesConstructor = SpeciesConstructor; |
| 116 }); | 124 }); |
| 117 | 125 |
| 118 }) | 126 }) |
| OLD | NEW |