Index: test/mjsunit/strong/implicit-conversions-constants.js |
diff --git a/test/mjsunit/strong/implicit-conversions-constants.js b/test/mjsunit/strong/implicit-conversions-constants.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c24056299ff8d80fb55bf24b5906433c8461c581 |
--- /dev/null |
+++ b/test/mjsunit/strong/implicit-conversions-constants.js |
@@ -0,0 +1,203 @@ |
+// 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: --strong-mode --allow-natives-syntax |
+ |
+"use strict"; |
+ |
+function getTestFuncs() { |
+ "use strong"; |
+ return [ |
+ function(x){return 1 + true;}, |
+ function(x){return 1 - true;}, |
+ function(x){return 1 * true;}, |
+ function(x){return 1 / true;}, |
+ function(x){return 1 % true;}, |
+ function(x){return 1 | true;}, |
+ function(x){return 1 & true;}, |
+ function(x){return 1 ^ true;}, |
+ function(x){return 1 << true;}, |
+ function(x){return 1 >> true;}, |
+ function(x){return 1 >>> true;}, |
+ function(x){return 1 < true;}, |
+ function(x){return 1 > true;}, |
+ function(x){return 1 <= true;}, |
+ function(x){return 1 >= true;}, |
+ function(x){return 1 + undefined;}, |
+ function(x){return 1 - undefined;}, |
+ function(x){return 1 * undefined;}, |
+ function(x){return 1 / undefined;}, |
+ function(x){return 1 % undefined;}, |
+ function(x){return 1 | undefined;}, |
+ function(x){return 1 & undefined;}, |
+ function(x){return 1 ^ undefined;}, |
+ function(x){return 1 << undefined;}, |
+ function(x){return 1 >> undefined;}, |
+ function(x){return 1 >>> undefined;}, |
+ function(x){return 1 < undefined;}, |
+ function(x){return 1 > undefined;}, |
+ function(x){return 1 <= undefined;}, |
+ function(x){return 1 >= undefined;}, |
+ function(x){return 1 + null;}, |
+ function(x){return 1 - null;}, |
+ function(x){return 1 * null;}, |
+ function(x){return 1 / null;}, |
+ function(x){return 1 % null;}, |
+ function(x){return 1 | null;}, |
+ function(x){return 1 & null;}, |
+ function(x){return 1 ^ null;}, |
+ function(x){return 1 << null;}, |
+ function(x){return 1 >> null;}, |
+ function(x){return 1 >>> null;}, |
+ function(x){return 1 < null;}, |
+ function(x){return 1 > null;}, |
+ function(x){return 1 <= null;}, |
+ function(x){return 1 >= null;}, |
+ function(x){return NaN + true;}, |
+ function(x){return NaN - true;}, |
+ function(x){return NaN * true;}, |
+ function(x){return NaN / true;}, |
+ function(x){return NaN % true;}, |
+ function(x){return NaN | true;}, |
+ function(x){return NaN & true;}, |
+ function(x){return NaN ^ true;}, |
+ function(x){return NaN << true;}, |
+ function(x){return NaN >> true;}, |
+ function(x){return NaN >>> true;}, |
+ function(x){return NaN < true;}, |
+ function(x){return NaN > true;}, |
+ function(x){return NaN <= true;}, |
+ function(x){return NaN >= true;}, |
+ function(x){return NaN + undefined;}, |
+ function(x){return NaN - undefined;}, |
+ function(x){return NaN * undefined;}, |
+ function(x){return NaN / undefined;}, |
+ function(x){return NaN % undefined;}, |
+ function(x){return NaN | undefined;}, |
+ function(x){return NaN & undefined;}, |
+ function(x){return NaN ^ undefined;}, |
+ function(x){return NaN << undefined;}, |
+ function(x){return NaN >> undefined;}, |
+ function(x){return NaN >>> undefined;}, |
+ function(x){return NaN < undefined;}, |
+ function(x){return NaN > undefined;}, |
+ function(x){return NaN <= undefined;}, |
+ function(x){return NaN >= undefined;}, |
+ function(x){return NaN + null;}, |
+ function(x){return NaN - null;}, |
+ function(x){return NaN * null;}, |
+ function(x){return NaN / null;}, |
+ function(x){return NaN % null;}, |
+ function(x){return NaN | null;}, |
+ function(x){return NaN & null;}, |
+ function(x){return NaN ^ null;}, |
+ function(x){return NaN << null;}, |
+ function(x){return NaN >> null;}, |
+ function(x){return NaN >>> null;}, |
+ function(x){return NaN < null;}, |
+ function(x){return NaN > null;}, |
+ function(x){return NaN <= null;}, |
+ function(x){return NaN >= null;}, |
+ function(x){return true + 1;}, |
+ function(x){return true - 1;}, |
+ function(x){return true * 1;}, |
+ function(x){return true / 1;}, |
+ function(x){return true % 1;}, |
+ function(x){return true | 1;}, |
+ function(x){return true & 1;}, |
+ function(x){return true ^ 1;}, |
+ function(x){return true << 1;}, |
+ function(x){return true >> 1;}, |
+ function(x){return true >>> 1;}, |
+ function(x){return true < 1;}, |
+ function(x){return true > 1;}, |
+ function(x){return true <= 1;}, |
+ function(x){return true >= 1;}, |
+ function(x){return undefined + 1;}, |
+ function(x){return undefined - 1;}, |
+ function(x){return undefined * 1;}, |
+ function(x){return undefined / 1;}, |
+ function(x){return undefined % 1;}, |
+ function(x){return undefined | 1;}, |
+ function(x){return undefined & 1;}, |
+ function(x){return undefined ^ 1;}, |
+ function(x){return undefined << 1;}, |
+ function(x){return undefined >> 1;}, |
+ function(x){return undefined >>> 1;}, |
+ function(x){return undefined < 1;}, |
+ function(x){return undefined > 1;}, |
+ function(x){return undefined <= 1;}, |
+ function(x){return undefined >= 1;}, |
+ function(x){return null + 1;}, |
+ function(x){return null - 1;}, |
+ function(x){return null * 1;}, |
+ function(x){return null / 1;}, |
+ function(x){return null % 1;}, |
+ function(x){return null | 1;}, |
+ function(x){return null & 1;}, |
+ function(x){return null ^ 1;}, |
+ function(x){return null << 1;}, |
+ function(x){return null >> 1;}, |
+ function(x){return null >>> 1;}, |
+ function(x){return null < 1;}, |
+ function(x){return null > 1;}, |
+ function(x){return null <= 1;}, |
+ function(x){return null >= 1;}, |
+ function(x){return true + NaN;}, |
+ function(x){return true - NaN;}, |
+ function(x){return true * NaN;}, |
+ function(x){return true / NaN;}, |
+ function(x){return true % NaN;}, |
+ function(x){return true | NaN;}, |
+ function(x){return true & NaN;}, |
+ function(x){return true ^ NaN;}, |
+ function(x){return true << NaN;}, |
+ function(x){return true >> NaN;}, |
+ function(x){return true >>> NaN;}, |
+ function(x){return true < NaN;}, |
+ function(x){return true > NaN;}, |
+ function(x){return true <= NaN;}, |
+ function(x){return true >= NaN;}, |
+ function(x){return undefined + NaN;}, |
+ function(x){return undefined - NaN;}, |
+ function(x){return undefined * NaN;}, |
+ function(x){return undefined / NaN;}, |
+ function(x){return undefined % NaN;}, |
+ function(x){return undefined | NaN;}, |
+ function(x){return undefined & NaN;}, |
+ function(x){return undefined ^ NaN;}, |
+ function(x){return undefined << NaN;}, |
+ function(x){return undefined >> NaN;}, |
+ function(x){return undefined >>> NaN;}, |
+ function(x){return undefined < NaN;}, |
+ function(x){return undefined > NaN;}, |
+ function(x){return undefined <= NaN;}, |
+ function(x){return undefined >= NaN;}, |
+ function(x){return null + NaN;}, |
+ function(x){return null - NaN;}, |
+ function(x){return null * NaN;}, |
+ function(x){return null / NaN;}, |
+ function(x){return null % NaN;}, |
+ function(x){return null | NaN;}, |
+ function(x){return null & NaN;}, |
+ function(x){return null ^ NaN;}, |
+ function(x){return null << NaN;}, |
+ function(x){return null >> NaN;}, |
+ function(x){return null >>> NaN;}, |
+ function(x){return null < NaN;}, |
+ function(x){return null > NaN;}, |
+ function(x){return null <= NaN;}, |
+ function(x){return null >= NaN;} |
+ ]; |
+} |
+ |
+for (let func of getTestFuncs()) { |
+ assertThrows(func, TypeError); |
+ assertThrows(func, TypeError); |
+ assertThrows(func, TypeError); |
+ %OptimizeFunctionOnNextCall(func); |
+ assertThrows(func, TypeError); |
+ %DeoptimizeFunction(func); |
+ assertThrows(func, TypeError); |
+} |