OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --allow-natives-syntax --fold-constants |
| 6 |
| 7 function test() { |
| 8 assertEquals("string", typeof ""); |
| 9 assertEquals("number", typeof 1.1); |
| 10 assertEquals("number", typeof 1); |
| 11 assertEquals("boolean", typeof true); |
| 12 assertEquals("function", typeof function() {}); |
| 13 assertEquals("object", typeof null); |
| 14 assertEquals("object", typeof {}); |
| 15 |
| 16 assertTrue(%_IsObject({})); |
| 17 assertTrue(%_IsObject(null)); |
| 18 assertTrue(%_IsObject(/regex/)); |
| 19 assertFalse(%_IsObject(0)); |
| 20 assertFalse(%_IsObject("")); |
| 21 |
| 22 assertTrue(%_IsSmi(1)); |
| 23 assertFalse(%_IsSmi(1.1)); |
| 24 assertFalse(%_IsSmi({})); |
| 25 |
| 26 assertTrue(%_IsRegExp(/regexp/)); |
| 27 assertFalse(%_IsRegExp({})); |
| 28 |
| 29 assertTrue(%_IsArray([1])); |
| 30 assertFalse(%_IsArray(function() {})); |
| 31 |
| 32 assertTrue(%_IsFunction(function() {})); |
| 33 assertFalse(%_IsFunction(null)); |
| 34 |
| 35 assertTrue(%_IsSpecObject(new Date())); |
| 36 assertFalse(%_IsSpecObject(1)); |
| 37 } |
| 38 |
| 39 |
| 40 test(); |
| 41 test(); |
| 42 %OptimizeFunctionOnNextCall(test); |
| 43 test(); |
OLD | NEW |