2014-03-31 14:38:28 +02:00
|
|
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2017-09-12 11:34:59 +02:00
|
|
|
// Flags: --allow-natives-syntax
|
2014-03-31 14:38:28 +02:00
|
|
|
|
|
|
|
function test() {
|
|
|
|
assertEquals("string", typeof "");
|
|
|
|
assertEquals("number", typeof 1.1);
|
|
|
|
assertEquals("number", typeof 1);
|
|
|
|
assertEquals("boolean", typeof true);
|
|
|
|
assertEquals("function", typeof function() {});
|
|
|
|
assertEquals("object", typeof null);
|
|
|
|
assertEquals("object", typeof {});
|
2015-11-30 21:22:40 -08:00
|
|
|
assertEquals("object", typeof /regex/);
|
2014-03-31 14:38:28 +02:00
|
|
|
|
2021-08-29 14:20:49 +02:00
|
|
|
assertTrue(%IsSmi(1));
|
|
|
|
assertFalse(%IsSmi(1.1));
|
|
|
|
assertFalse(%IsSmi({}));
|
2014-03-31 14:38:28 +02:00
|
|
|
|
2021-08-29 14:20:49 +02:00
|
|
|
assertTrue(%IsArray([1]));
|
|
|
|
assertFalse(%IsArray(function() {}));
|
2014-03-31 14:38:28 +02:00
|
|
|
|
2021-08-29 14:20:49 +02:00
|
|
|
assertTrue(%IsJSReceiver(new Date()));
|
|
|
|
assertFalse(%IsJSReceiver(1));
|
2014-03-31 14:38:28 +02:00
|
|
|
}
|
|
|
|
|
2019-08-16 11:32:46 +02:00
|
|
|
%PrepareFunctionForOptimization(test);
|
2014-03-31 14:38:28 +02:00
|
|
|
test();
|
|
|
|
test();
|
|
|
|
%OptimizeFunctionOnNextCall(test);
|
|
|
|
test();
|