f5cc091f8f
Also fixes a crankshaft bug with strong implicit conversions. It turns out that the implicit conversion of oddball values is smushed into so many places in crankshaft that it would have been pretty invasive surgery to make everything fall out naturally. BUG=v8:3956 LOG=N Review URL: https://codereview.chromium.org/1216463003 Cr-Commit-Position: refs/heads/master@{#29381}
204 lines
7.2 KiB
JavaScript
204 lines
7.2 KiB
JavaScript
// 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);
|
|
}
|