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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
8 | 8 |
9 using namespace v8::internal; | 9 using namespace v8::internal; |
10 using namespace v8::internal::compiler; | 10 using namespace v8::internal::compiler; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 TEST(IsMinusZero) { | 119 TEST(IsMinusZero) { |
120 FunctionTester T("(function(a) { return %_IsMinusZero(a); })", flags); | 120 FunctionTester T("(function(a) { return %_IsMinusZero(a); })", flags); |
121 | 121 |
122 T.CheckFalse(T.Val(1)); | 122 T.CheckFalse(T.Val(1)); |
123 T.CheckFalse(T.Val(1.1)); | 123 T.CheckFalse(T.Val(1.1)); |
124 T.CheckTrue(T.Val(-0.0)); | 124 T.CheckTrue(T.Val(-0.0)); |
125 T.CheckFalse(T.Val(-2)); | 125 T.CheckFalse(T.Val(-2)); |
126 T.CheckFalse(T.Val(-2.3)); | 126 T.CheckFalse(T.Val(-2.3)); |
127 T.CheckFalse(T.undefined()); | 127 T.CheckFalse(T.undefined()); |
| 128 } |
| 129 |
| 130 |
| 131 TEST(IsNonNegativeSmi) { |
| 132 FunctionTester T("(function(a) { return %_IsNonNegativeSmi(a); })", flags); |
| 133 |
| 134 T.CheckTrue(T.Val(1)); |
| 135 T.CheckFalse(T.Val(1.1)); |
| 136 T.CheckFalse(T.Val(-0.0)); |
| 137 T.CheckFalse(T.Val(-2)); |
| 138 T.CheckFalse(T.Val(-2.3)); |
| 139 T.CheckFalse(T.undefined()); |
128 } | 140 } |
129 | 141 |
130 | 142 |
131 TEST(IsObject) { | 143 TEST(IsObject) { |
132 FunctionTester T("(function(a) { return %_IsObject(a); })", flags); | 144 FunctionTester T("(function(a) { return %_IsObject(a); })", flags); |
133 | 145 |
134 T.CheckFalse(T.NewObject("(function() {})")); | 146 T.CheckFalse(T.NewObject("(function() {})")); |
135 T.CheckTrue(T.NewObject("([1])")); | 147 T.CheckTrue(T.NewObject("([1])")); |
136 T.CheckTrue(T.NewObject("({})")); | 148 T.CheckTrue(T.NewObject("({})")); |
137 T.CheckTrue(T.NewObject("(/x/)")); | 149 T.CheckTrue(T.NewObject("(/x/)")); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 350 |
339 | 351 |
340 TEST(ValueOf) { | 352 TEST(ValueOf) { |
341 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); | 353 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); |
342 | 354 |
343 T.CheckCall(T.Val("a"), T.Val("a")); | 355 T.CheckCall(T.Val("a"), T.Val("a")); |
344 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); | 356 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); |
345 T.CheckCall(T.Val(123), T.Val(123)); | 357 T.CheckCall(T.Val(123), T.Val(123)); |
346 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); | 358 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); |
347 } | 359 } |
OLD | NEW |