| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } | 128 } |
| 129 | 129 |
| 130 | 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()); | |
| 140 } | |
| 141 | |
| 142 | |
| 143 TEST(IsRegExp) { | 131 TEST(IsRegExp) { |
| 144 FunctionTester T("(function(a) { return %_IsRegExp(a); })", flags); | 132 FunctionTester T("(function(a) { return %_IsRegExp(a); })", flags); |
| 145 | 133 |
| 146 T.CheckFalse(T.NewObject("new Date()")); | 134 T.CheckFalse(T.NewObject("new Date()")); |
| 147 T.CheckFalse(T.NewObject("(function() {})")); | 135 T.CheckFalse(T.NewObject("(function() {})")); |
| 148 T.CheckFalse(T.NewObject("([1])")); | 136 T.CheckFalse(T.NewObject("([1])")); |
| 149 T.CheckFalse(T.NewObject("({})")); | 137 T.CheckFalse(T.NewObject("({})")); |
| 150 T.CheckTrue(T.NewObject("(/x/)")); | 138 T.CheckTrue(T.NewObject("(/x/)")); |
| 151 T.CheckFalse(T.undefined()); | 139 T.CheckFalse(T.undefined()); |
| 152 T.CheckFalse(T.null()); | 140 T.CheckFalse(T.null()); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 324 |
| 337 | 325 |
| 338 TEST(ValueOf) { | 326 TEST(ValueOf) { |
| 339 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); | 327 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); |
| 340 | 328 |
| 341 T.CheckCall(T.Val("a"), T.Val("a")); | 329 T.CheckCall(T.Val("a"), T.Val("a")); |
| 342 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); | 330 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); |
| 343 T.CheckCall(T.Val(123), T.Val(123)); | 331 T.CheckCall(T.Val(123), T.Val(123)); |
| 344 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); | 332 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); |
| 345 } | 333 } |
| OLD | NEW |