2014-03-10 14:50:01 +00: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.
|
|
|
|
|
|
|
|
// Flags: --allow-natives-syntax --fold-constants
|
|
|
|
|
|
|
|
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-08-26 11:27:58 +00:00
|
|
|
assertEquals("object", typeof /regex/);
|
2014-03-10 14:50:01 +00:00
|
|
|
|
|
|
|
assertTrue(%_IsSmi(1));
|
|
|
|
assertFalse(%_IsSmi(1.1));
|
|
|
|
assertFalse(%_IsSmi({}));
|
|
|
|
|
|
|
|
assertTrue(%_IsRegExp(/regexp/));
|
|
|
|
assertFalse(%_IsRegExp({}));
|
|
|
|
|
|
|
|
assertTrue(%_IsArray([1]));
|
|
|
|
assertFalse(%_IsArray(function() {}));
|
|
|
|
|
2015-11-30 11:56:11 +00:00
|
|
|
assertTrue(%_IsJSReceiver(new Date()));
|
|
|
|
assertFalse(%_IsJSReceiver(1));
|
2014-03-10 14:50:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
test();
|
|
|
|
test();
|
|
|
|
%OptimizeFunctionOnNextCall(test);
|
|
|
|
test();
|