forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimplicitCallSwitchExpr.js
More file actions
42 lines (37 loc) · 1.09 KB
/
implicitCallSwitchExpr.js
File metadata and controls
42 lines (37 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
/*
*******************************UNIT TEST FOR SWITCH CASE OPTIMIZATION*******************************
* Test for Bug 232738
* Exprgen:CAS: JIT is causing a bad code gen with Switches: -maxinterpretcount:1 -bgjit- -loopinterpretcount:1
*
*/
var shouldBailout = false;
function test0(){
var g = 1;
if(shouldBailout)
{
g = { valueOf: function() { WScript.Echo('g value1Of'); return 3; } }
}
var __loopvar2 = 1;
do {
switch(g) {
case 1:
d = 1;
case 2:
d = 2;
case 3:
d = 3;
case 4:
d = 4;
default:
d = -1;
}
} while(__loopvar2 < 1)
return d;
};
WScript.Echo(test0());
shouldBailout = true;
WScript.Echo(test0());