| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 T.CheckFalse(T.undefined()); | 165 T.CheckFalse(T.undefined()); |
| 166 T.CheckFalse(T.null()); | 166 T.CheckFalse(T.null()); |
| 167 T.CheckFalse(T.Val("x")); | 167 T.CheckFalse(T.Val("x")); |
| 168 T.CheckFalse(T.Val(1)); | 168 T.CheckFalse(T.Val(1)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 TEST(IsSmi) { | 172 TEST(IsSmi) { |
| 173 FunctionTester T("(function(a) { return %_IsSmi(a); })", flags); | 173 FunctionTester T("(function(a) { return %_IsSmi(a); })", flags); |
| 174 | 174 |
| 175 T.CheckFalse(T.NewObject("new Date()")); |
| 176 T.CheckFalse(T.NewObject("(function() {})")); |
| 177 T.CheckFalse(T.NewObject("([1])")); |
| 178 T.CheckFalse(T.NewObject("({})")); |
| 179 T.CheckFalse(T.NewObject("(/x/)")); |
| 180 T.CheckFalse(T.undefined()); |
| 175 T.CheckTrue(T.Val(1)); | 181 T.CheckTrue(T.Val(1)); |
| 176 T.CheckFalse(T.Val(1.1)); | 182 T.CheckFalse(T.Val(1.1)); |
| 177 T.CheckFalse(T.Val(-0.0)); | 183 T.CheckFalse(T.Val(-0.0)); |
| 178 T.CheckTrue(T.Val(-2)); | 184 T.CheckTrue(T.Val(-2)); |
| 179 T.CheckFalse(T.Val(-2.3)); | 185 T.CheckFalse(T.Val(-2.3)); |
| 180 T.CheckFalse(T.undefined()); | |
| 181 } | 186 } |
| 182 | 187 |
| 183 | 188 |
| 184 TEST(MapGetInstanceType) { | 189 TEST(MapGetInstanceType) { |
| 185 FunctionTester T( | 190 FunctionTester T( |
| 186 "(function(a) { return %_MapGetInstanceType(%_HeapObjectGetMap(a)); })", | 191 "(function(a) { return %_MapGetInstanceType(%_HeapObjectGetMap(a)); })", |
| 187 flags); | 192 flags); |
| 188 | 193 |
| 189 Factory* factory = T.main_isolate()->factory(); | 194 Factory* factory = T.main_isolate()->factory(); |
| 190 T.CheckCall(T.Val(ODDBALL_TYPE), T.null()); | 195 T.CheckCall(T.Val(ODDBALL_TYPE), T.null()); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 350 |
| 346 | 351 |
| 347 TEST(ValueOf) { | 352 TEST(ValueOf) { |
| 348 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); | 353 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); |
| 349 | 354 |
| 350 T.CheckCall(T.Val("a"), T.Val("a")); | 355 T.CheckCall(T.Val("a"), T.Val("a")); |
| 351 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); | 356 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); |
| 352 T.CheckCall(T.Val(123), T.Val(123)); | 357 T.CheckCall(T.Val(123), T.Val(123)); |
| 353 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); | 358 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); |
| 354 } | 359 } |
| OLD | NEW |