blob: 20900d61717576e7c6f3a3109b49d1e40081e2e6 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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
7function 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 {});
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000015 assertEquals("object", typeof /regex/);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000016
17 assertTrue(%_IsSmi(1));
18 assertFalse(%_IsSmi(1.1));
19 assertFalse(%_IsSmi({}));
20
21 assertTrue(%_IsRegExp(/regexp/));
22 assertFalse(%_IsRegExp({}));
23
24 assertTrue(%_IsArray([1]));
25 assertFalse(%_IsArray(function() {}));
26
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000027 assertTrue(%_IsJSReceiver(new Date()));
28 assertFalse(%_IsJSReceiver(1));
Ben Murdochb8a8cc12014-11-26 15:28:44 +000029}
30
31
32test();
33test();
34%OptimizeFunctionOnNextCall(test);
35test();