| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 return res; | 219 return res; |
| 220 } | 220 } |
| 221 | 221 |
| 222 assertEquals(190, f6(20), "largeSwitch.20"); | 222 assertEquals(190, f6(20), "largeSwitch.20"); |
| 223 assertEquals(2016, f6(64), "largeSwitch.64"); | 223 assertEquals(2016, f6(64), "largeSwitch.64"); |
| 224 assertEquals(4032, f6(128), "largeSwitch.128"); | 224 assertEquals(4032, f6(128), "largeSwitch.128"); |
| 225 assertEquals(4222, f6(148), "largeSwitch.148"); | 225 assertEquals(4222, f6(148), "largeSwitch.148"); |
| 226 | 226 |
| 227 | 227 |
| 228 function f7(value) { |
| 229 |
| 230 switch (value) { |
| 231 case 0: return "0"; |
| 232 case -0: return "-0"; |
| 233 case 1: case 2: case 3: case 4: // Dummy fillers. |
| 234 } |
| 235 switch (value) { |
| 236 case 0x3fffffff: return "MaxSmi"; |
| 237 case 0x3ffffffe: |
| 238 case 0x3ffffffd: |
| 239 case 0x3ffffffc: |
| 240 case 0x3ffffffb: |
| 241 case 0x3ffffffa: // Dummy fillers |
| 242 } |
| 243 switch (value) { |
| 244 case -0x40000000: return "MinSmi"; |
| 245 case -0x3fffffff: |
| 246 case -0x3ffffffe: |
| 247 case -0x3ffffffd: |
| 248 case -0x3ffffffc: |
| 249 case -0x3ffffffb: // Dummy fillers |
| 250 } |
| 251 switch (value) { |
| 252 case 10: return "A"; |
| 253 case 11: |
| 254 case 12: |
| 255 case 13: |
| 256 case 14: |
| 257 case 15: // Dummy fillers |
| 258 } |
| 259 return "default"; |
| 260 } |
| 261 |
| 262 |
| 263 assertEquals("default", f7(0.1), "0-1-switch.double-0.1"); |
| 264 assertEquals("0", f7(-0), "0-1-switch.double-neg0"); |
| 265 assertEquals("MaxSmi", f7((1<<30)-1), "0-1-switch.maxsmi"); |
| 266 assertEquals("MinSmi", f7(-(1<<30)), "0-1-switch.minsmi"); |
| 267 assertEquals("default", f7(1<<30), "0-1-switch.maxsmi++"); |
| 268 assertEquals("default", f7(-(1<<30)-1), "0-1-switch.minsmi--"); |
| 269 assertEquals("A", f7((170/16)-(170%16/16)), "0-1-switch.heapnum"); |
| 270 |
| OLD | NEW |