Chromium Code Reviews| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 return TO_BOOLEAN(spreadable); | 213 return TO_BOOLEAN(spreadable); |
| 214 } | 214 } |
| 215 | 215 |
| 216 | 216 |
| 217 function ToPositiveInteger(x, rangeErrorIndex) { | 217 function ToPositiveInteger(x, rangeErrorIndex) { |
| 218 var i = TO_INTEGER_MAP_MINUS_ZERO(x); | 218 var i = TO_INTEGER_MAP_MINUS_ZERO(x); |
| 219 if (i < 0) throw MakeRangeError(rangeErrorIndex); | 219 if (i < 0) throw MakeRangeError(rangeErrorIndex); |
| 220 return i; | 220 return i; |
| 221 } | 221 } |
| 222 | 222 |
| 223 | |
| 224 function MaxSimple(a, b) { | |
| 225 return a > b ? a : b; | |
| 226 } | |
| 227 | |
| 228 | |
| 229 function MinSimple(a, b) { | |
| 230 return a > b ? b : a; | |
| 231 } | |
| 232 | |
| 233 | |
| 234 %SetForceInlineFlag(MaxSimple); | |
|
Jakob Kummerow
2015/10/15 14:18:48
Have you measured that this actually makes a diffe
skomski
2015/10/15 15:17:58
Measured and definitely makes a big difference >9%
| |
| 235 %SetForceInlineFlag(MinSimple); | |
| 236 | |
| 223 //---------------------------------------------------------------------------- | 237 //---------------------------------------------------------------------------- |
| 224 | 238 |
| 225 // NOTE: Setting the prototype for Array must take place as early as | 239 // NOTE: Setting the prototype for Array must take place as early as |
| 226 // possible due to code generation for array literals. When | 240 // possible due to code generation for array literals. When |
| 227 // generating code for a array literal a boilerplate array is created | 241 // generating code for a array literal a boilerplate array is created |
| 228 // that is cloned when running the code. It is essential that the | 242 // that is cloned when running the code. It is essential that the |
| 229 // boilerplate gets the right prototype. | 243 // boilerplate gets the right prototype. |
| 230 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); | 244 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); |
| 231 | 245 |
| 232 // ---------------------------------------------------------------------------- | 246 // ---------------------------------------------------------------------------- |
| 233 // Exports | 247 // Exports |
| 234 | 248 |
| 235 $sameValue = SameValue; | 249 $sameValue = SameValue; |
| 236 $sameValueZero = SameValueZero; | 250 $sameValueZero = SameValueZero; |
| 237 | 251 |
| 238 utils.Export(function(to) { | 252 utils.Export(function(to) { |
| 239 to.ToPositiveInteger = ToPositiveInteger; | 253 to.ToPositiveInteger = ToPositiveInteger; |
| 254 to.MaxSimple = MaxSimple; | |
| 255 to.MinSimple = MinSimple; | |
| 240 }); | 256 }); |
| 241 | 257 |
| 242 %InstallToContext([ | 258 %InstallToContext([ |
| 243 "apply_prepare_builtin", APPLY_PREPARE, | 259 "apply_prepare_builtin", APPLY_PREPARE, |
| 244 "concat_iterable_to_array_builtin", CONCAT_ITERABLE_TO_ARRAY, | 260 "concat_iterable_to_array_builtin", CONCAT_ITERABLE_TO_ARRAY, |
| 245 "reflect_apply_prepare_builtin", REFLECT_APPLY_PREPARE, | 261 "reflect_apply_prepare_builtin", REFLECT_APPLY_PREPARE, |
| 246 "reflect_construct_prepare_builtin", REFLECT_CONSTRUCT_PREPARE, | 262 "reflect_construct_prepare_builtin", REFLECT_CONSTRUCT_PREPARE, |
| 247 ]); | 263 ]); |
| 248 | 264 |
| 249 %InstallToContext([ | 265 %InstallToContext([ |
| 250 "concat_iterable_to_array", ConcatIterableToArray, | 266 "concat_iterable_to_array", ConcatIterableToArray, |
| 251 ]); | 267 ]); |
| 252 | 268 |
| 253 }) | 269 }) |
| OLD | NEW |