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

Side by Side Diff: test/mjsunit/minmax-simple.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: use existing export in runtime 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
« src/js/runtime.js ('K') | « src/js/typedarray.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax
6 // Test the MaxSimple and MinSimple internal methods in runtime.js
7
8 function MaxSimple(a, b) {
9 return a > b ? a : b;
10 }
11
12 function MinSimple(a, b) {
13 return a > b ? b : a;
14 }
15
16 %SetForceInlineFlag(MaxSimple);
17 %SetForceInlineFlag(MinSimple);
18
19 function checkEvaluations(target) {
20 var evaluations = 0;
21 var observedNumber = {
22 valueOf: function() {
23 evaluations++;
24 return 0;
25 }
26 };
27 target(observedNumber, observedNumber);
28 return evaluations;
29 }
30
31 assertEquals(1, MaxSimple(-1, 1));
32 assertEquals(2, checkEvaluations(MaxSimple));
33
34
35 assertEquals(-1, MinSimple(-1, 1));
36 assertEquals(2, checkEvaluations(MaxSimple));
Jakob Kummerow 2015/10/15 14:18:48 Clearly you mean MinSimple here.
skomski 2015/10/15 15:17:58 Done.
OLDNEW
« src/js/runtime.js ('K') | « src/js/typedarray.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698