OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --allow-natives-syntax --fold-constants | 5 // Flags: --allow-natives-syntax --fold-constants |
6 | 6 |
7 function test() { | 7 function test() { |
8 assertEquals("string", typeof ""); | 8 assertEquals("string", typeof ""); |
9 assertEquals("number", typeof 1.1); | 9 assertEquals("number", typeof 1.1); |
10 assertEquals("number", typeof 1); | 10 assertEquals("number", typeof 1); |
11 assertEquals("boolean", typeof true); | 11 assertEquals("boolean", typeof true); |
12 assertEquals("function", typeof function() {}); | 12 assertEquals("function", typeof function() {}); |
13 assertEquals("object", typeof null); | 13 assertEquals("object", typeof null); |
14 assertEquals("object", typeof {}); | 14 assertEquals("object", typeof {}); |
15 | 15 assertEquals("object", typeof /regex/); |
16 assertTrue(%_IsObject({})); | |
17 assertTrue(%_IsObject(null)); | |
18 assertTrue(%_IsObject(/regex/)); | |
19 assertFalse(%_IsObject(0)); | |
20 assertFalse(%_IsObject("")); | |
21 | 16 |
22 assertTrue(%_IsSmi(1)); | 17 assertTrue(%_IsSmi(1)); |
23 assertFalse(%_IsSmi(1.1)); | 18 assertFalse(%_IsSmi(1.1)); |
24 assertFalse(%_IsSmi({})); | 19 assertFalse(%_IsSmi({})); |
25 | 20 |
26 assertTrue(%_IsRegExp(/regexp/)); | 21 assertTrue(%_IsRegExp(/regexp/)); |
27 assertFalse(%_IsRegExp({})); | 22 assertFalse(%_IsRegExp({})); |
28 | 23 |
29 assertTrue(%_IsArray([1])); | 24 assertTrue(%_IsArray([1])); |
30 assertFalse(%_IsArray(function() {})); | 25 assertFalse(%_IsArray(function() {})); |
31 | 26 |
32 assertTrue(%_IsFunction(function() {})); | 27 assertTrue(%_IsFunction(function() {})); |
33 assertFalse(%_IsFunction(null)); | 28 assertFalse(%_IsFunction(null)); |
34 | 29 |
35 assertTrue(%_IsSpecObject(new Date())); | 30 assertTrue(%_IsSpecObject(new Date())); |
36 assertFalse(%_IsSpecObject(1)); | 31 assertFalse(%_IsSpecObject(1)); |
37 | 32 |
38 assertTrue(%_IsMinusZero(-0.0)); | 33 assertTrue(%_IsMinusZero(-0.0)); |
39 assertFalse(%_IsMinusZero(1)); | 34 assertFalse(%_IsMinusZero(1)); |
40 assertFalse(%_IsMinusZero("")); | 35 assertFalse(%_IsMinusZero("")); |
41 } | 36 } |
42 | 37 |
43 | 38 |
44 test(); | 39 test(); |
45 test(); | 40 test(); |
46 %OptimizeFunctionOnNextCall(test); | 41 %OptimizeFunctionOnNextCall(test); |
47 test(); | 42 test(); |
OLD | NEW |