Index: test/mjsunit/minmax-simple.js |
diff --git a/test/mjsunit/minmax-simple.js b/test/mjsunit/minmax-simple.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0f73d9cd73fb389c42d2afa005231db35f0bfd6b |
--- /dev/null |
+++ b/test/mjsunit/minmax-simple.js |
@@ -0,0 +1,36 @@ |
+// Copyright 2015 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Flags: --allow-natives-syntax |
+// Test the MaxSimple and MinSimple internal methods in runtime.js |
+ |
+function MaxSimple(a, b) { |
+ return a > b ? a : b; |
+} |
+ |
+function MinSimple(a, b) { |
+ return a > b ? b : a; |
+} |
+ |
+%SetForceInlineFlag(MaxSimple); |
+%SetForceInlineFlag(MinSimple); |
+ |
+function checkEvaluations(target) { |
+ var evaluations = 0; |
+ var observedNumber = { |
+ valueOf: function() { |
+ evaluations++; |
+ return 0; |
+ } |
+ }; |
+ target(observedNumber, observedNumber); |
+ return evaluations; |
+} |
+ |
+assertEquals(1, MaxSimple(-1, 1)); |
+assertEquals(2, checkEvaluations(MaxSimple)); |
+ |
+ |
+assertEquals(-1, MinSimple(-1, 1)); |
+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.
|