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

Side by Side Diff: src/js/runtime.js

Issue 1410473002: Reland: Use simple/fast inline function version of MinMax in JS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: after yangs fix possible to use utils.ImportNow in test Created 5 years, 2 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/js/prologue.js ('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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return TO_BOOLEAN(spreadable); 209 return TO_BOOLEAN(spreadable);
210 } 210 }
211 211
212 212
213 function ToPositiveInteger(x, rangeErrorIndex) { 213 function ToPositiveInteger(x, rangeErrorIndex) {
214 var i = TO_INTEGER_MAP_MINUS_ZERO(x); 214 var i = TO_INTEGER_MAP_MINUS_ZERO(x);
215 if (i < 0) throw MakeRangeError(rangeErrorIndex); 215 if (i < 0) throw MakeRangeError(rangeErrorIndex);
216 return i; 216 return i;
217 } 217 }
218 218
219
220 function MaxSimple(a, b) {
221 return a > b ? a : b;
222 }
223
224
225 function MinSimple(a, b) {
226 return a > b ? b : a;
227 }
228
229
230 %SetForceInlineFlag(MaxSimple);
231 %SetForceInlineFlag(MinSimple);
232
219 //---------------------------------------------------------------------------- 233 //----------------------------------------------------------------------------
220 234
221 // NOTE: Setting the prototype for Array must take place as early as 235 // NOTE: Setting the prototype for Array must take place as early as
222 // possible due to code generation for array literals. When 236 // possible due to code generation for array literals. When
223 // generating code for a array literal a boilerplate array is created 237 // generating code for a array literal a boilerplate array is created
224 // that is cloned when running the code. It is essential that the 238 // that is cloned when running the code. It is essential that the
225 // boilerplate gets the right prototype. 239 // boilerplate gets the right prototype.
226 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); 240 %FunctionSetPrototype(GlobalArray, new GlobalArray(0));
227 241
228 // ---------------------------------------------------------------------------- 242 // ----------------------------------------------------------------------------
229 // Exports 243 // Exports
230 244
231 utils.Export(function(to) { 245 utils.Export(function(to) {
232 to.ToPositiveInteger = ToPositiveInteger; 246 to.MaxSimple = MaxSimple;
247 to.MinSimple = MinSimple;
233 to.SameValue = SameValue; 248 to.SameValue = SameValue;
234 to.SameValueZero = SameValueZero; 249 to.SameValueZero = SameValueZero;
250 to.ToPositiveInteger = ToPositiveInteger;
235 }); 251 });
236 252
237 %InstallToContext([ 253 %InstallToContext([
238 "apply_prepare_builtin", APPLY_PREPARE, 254 "apply_prepare_builtin", APPLY_PREPARE,
239 "concat_iterable_to_array_builtin", CONCAT_ITERABLE_TO_ARRAY, 255 "concat_iterable_to_array_builtin", CONCAT_ITERABLE_TO_ARRAY,
240 "reflect_apply_prepare_builtin", REFLECT_APPLY_PREPARE, 256 "reflect_apply_prepare_builtin", REFLECT_APPLY_PREPARE,
241 "reflect_construct_prepare_builtin", REFLECT_CONSTRUCT_PREPARE, 257 "reflect_construct_prepare_builtin", REFLECT_CONSTRUCT_PREPARE,
242 ]); 258 ]);
243 259
244 %InstallToContext([ 260 %InstallToContext([
245 "concat_iterable_to_array", ConcatIterableToArray, 261 "concat_iterable_to_array", ConcatIterableToArray,
246 ]); 262 ]);
247 263
248 }) 264 })
OLDNEW
« no previous file with comments | « src/js/prologue.js ('k') | src/js/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698