Chromium Code Reviews| Index: test/mjsunit/strong/implicit-conversions.js |
| diff --git a/test/mjsunit/strong/implicit-conversions.js b/test/mjsunit/strong/implicit-conversions.js |
| index c4a6765f8a1c337b831daf23a0de98a73a0f7072..525b81ec6be6471fc9e4fccf393d2978e6020d00 100644 |
| --- a/test/mjsunit/strong/implicit-conversions.js |
| +++ b/test/mjsunit/strong/implicit-conversions.js |
| @@ -61,23 +61,17 @@ let numberValues = [ |
| "0", |
| "(-0)", |
| "1", |
| - "0.79", |
|
rossberg
2015/06/30 12:53:52
Why did you remove these cases?
conradw
2015/06/30 14:01:10
The runtime of this test was beginning to get exce
|
| - "(-0.79)", |
| - "4294967295", |
| - "4294967296", |
| "(-4294967295)", |
| "(-4294967296)", |
| "9999999999999", |
| "(-9999999999999)", |
| - "1.5e10", |
| - "(-1.5e10)", |
| - "0xFFF", |
| - "(-0xFFF)", |
| "NaN", |
| "Infinity", |
| "(-Infinity)" |
| ]; |
| +//****************************************************************************** |
| +// Relational comparison function declarations |
| function add_strong(x, y) { |
| "use strong"; |
| return x + y; |
| @@ -253,6 +247,18 @@ function typed_greater_equal_strong(x, y) { |
| return (+x) >= (+y); |
| } |
| +//****************************************************************************** |
| +// (in)equality function declarations |
| +function str_equal_strong(x, y) { |
| + "use strong"; |
| + return x === y; |
| +} |
| + |
| +function str_ineq_strong(x, y) { |
| + "use strong"; |
| + return x !== y; |
| +} |
| + |
| let strongNumberFuncs = [add_num_strong, sub_strong, mul_strong, div_strong, |
| mod_strong, or_strong, and_strong, xor_strong, |
| shl_strong, shr_strong, sar_strong, less_num_strong, |
| @@ -332,44 +338,77 @@ for (let op of strongUnops) { |
| for (let func of strongNumberFuncs) { |
| // Check IC None*None->None throws |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| - %OptimizeFunctionOnNextCall(func); |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| - %DeoptimizeFunction(func); |
| + for (let v of nonNumberValues) { |
| + let value = eval(v); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %OptimizeFunctionOnNextCall(func); |
| + print(func); |
|
rossberg
2015/06/30 12:53:52
Stray debug output?
conradw
2015/06/30 14:01:10
Done.
|
| + print(value); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %DeoptimizeFunction(func); |
| + } |
| func(4, 5); |
| func(4, 5); |
| // Check IC Smi*Smi->Smi throws |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| - %OptimizeFunctionOnNextCall(func); |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| - %DeoptimizeFunction(func); |
| + for (let v of nonNumberValues) { |
| + let value = eval(v); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %OptimizeFunctionOnNextCall(func); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %DeoptimizeFunction(func); |
| + } |
| func(NaN, NaN); |
| func(NaN, NaN); |
| // Check IC Number*Number->Number throws |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| - %OptimizeFunctionOnNextCall(func); |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| - %DeoptimizeFunction(func); |
| + for (let v of nonNumberValues) { |
| + let value = eval(v); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %OptimizeFunctionOnNextCall(func); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %DeoptimizeFunction(func); |
| + } |
| } |
| for (let func of strongStringOrNumberFuncs) { |
| // Check IC None*None->None throws |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| - %OptimizeFunctionOnNextCall(func); |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| - %DeoptimizeFunction(func); |
| + for (let v of nonNumberValues) { |
| + let value = eval(v); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %OptimizeFunctionOnNextCall(func); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %DeoptimizeFunction(func); |
| + } |
| func("foo", "bar"); |
| func("foo", "bar"); |
| // Check IC String*String->String throws |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| - %OptimizeFunctionOnNextCall(func); |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| - %DeoptimizeFunction(func); |
| + for (let v of nonNumberValues) { |
| + let value = eval(v); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %OptimizeFunctionOnNextCall(func); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %DeoptimizeFunction(func); |
| + } |
| func(NaN, NaN); |
| func(NaN, NaN); |
| // Check IC Generic*Generic->Generic throws |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| + for (let v of nonNumberValues) { |
| + let value = eval(v); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %OptimizeFunctionOnNextCall(func); |
| + assertThrows(function(){func(2, value);}, TypeError); |
| + %DeoptimizeFunction(func); |
| + } |
| +} |
| + |
| +for (let func of [str_equal_strong, str_ineq_strong]) { |
| + assertDoesNotThrow(function(){func(2, undefined)}); |
| + assertDoesNotThrow(function(){func(2, undefined)}); |
| + %OptimizeFunctionOnNextCall(func); |
| + assertDoesNotThrow(function(){func(2, undefined)}); |
| + %DeoptimizeFunction(func); |
| + assertDoesNotThrow(function(){func(true, {})}); |
| + assertDoesNotThrow(function(){func(true, {})}); |
| %OptimizeFunctionOnNextCall(func); |
| - assertThrows(function(){func(2, "foo");}, TypeError); |
| + assertDoesNotThrow(function(){func(true, {})}); |
| %DeoptimizeFunction(func); |
| } |