| 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/compilation-info.h" | 5 #include "src/compilation-info.h" |
| 6 #include "test/cctest/compiler/function-tester.h" | 6 #include "test/cctest/compiler/function-tester.h" |
| 7 | 7 |
| 8 namespace v8 { | 8 namespace v8 { |
| 9 namespace internal { | 9 namespace internal { |
| 10 namespace compiler { | 10 namespace compiler { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 T.CheckFalse(T.NewObject("([1])")); | 73 T.CheckFalse(T.NewObject("([1])")); |
| 74 T.CheckFalse(T.NewObject("({})")); | 74 T.CheckFalse(T.NewObject("({})")); |
| 75 T.CheckFalse(T.NewObject("(/x/)")); | 75 T.CheckFalse(T.NewObject("(/x/)")); |
| 76 T.CheckFalse(T.undefined()); | 76 T.CheckFalse(T.undefined()); |
| 77 T.CheckFalse(T.null()); | 77 T.CheckFalse(T.null()); |
| 78 T.CheckFalse(T.Val("x")); | 78 T.CheckFalse(T.Val("x")); |
| 79 T.CheckFalse(T.Val(1)); | 79 T.CheckFalse(T.Val(1)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 TEST(IsRegExp) { |
| 84 FunctionTester T("(function(a) { return %_IsRegExp(a); })", flags); |
| 85 |
| 86 T.CheckFalse(T.NewObject("new Date()")); |
| 87 T.CheckFalse(T.NewObject("(function() {})")); |
| 88 T.CheckFalse(T.NewObject("([1])")); |
| 89 T.CheckFalse(T.NewObject("({})")); |
| 90 T.CheckTrue(T.NewObject("(/x/)")); |
| 91 T.CheckFalse(T.undefined()); |
| 92 T.CheckFalse(T.null()); |
| 93 T.CheckFalse(T.Val("x")); |
| 94 T.CheckFalse(T.Val(1)); |
| 95 } |
| 96 |
| 97 |
| 83 TEST(IsSmi) { | 98 TEST(IsSmi) { |
| 84 FunctionTester T("(function(a) { return %_IsSmi(a); })", flags); | 99 FunctionTester T("(function(a) { return %_IsSmi(a); })", flags); |
| 85 | 100 |
| 86 T.CheckFalse(T.NewObject("new Date()")); | 101 T.CheckFalse(T.NewObject("new Date()")); |
| 87 T.CheckFalse(T.NewObject("(function() {})")); | 102 T.CheckFalse(T.NewObject("(function() {})")); |
| 88 T.CheckFalse(T.NewObject("([1])")); | 103 T.CheckFalse(T.NewObject("([1])")); |
| 89 T.CheckFalse(T.NewObject("({})")); | 104 T.CheckFalse(T.NewObject("({})")); |
| 90 T.CheckFalse(T.NewObject("(/x/)")); | 105 T.CheckFalse(T.NewObject("(/x/)")); |
| 91 T.CheckFalse(T.undefined()); | 106 T.CheckFalse(T.undefined()); |
| 92 T.CheckTrue(T.Val(1)); | 107 T.CheckTrue(T.Val(1)); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 FunctionTester T("(function(a,b) { return %_SubString(a,b,b+3); })", flags); | 144 FunctionTester T("(function(a,b) { return %_SubString(a,b,b+3); })", flags); |
| 130 | 145 |
| 131 T.CheckCall(T.Val("aaa"), T.Val("aaabbb"), T.Val(0.0)); | 146 T.CheckCall(T.Val("aaa"), T.Val("aaabbb"), T.Val(0.0)); |
| 132 T.CheckCall(T.Val("abb"), T.Val("aaabbb"), T.Val(2)); | 147 T.CheckCall(T.Val("abb"), T.Val("aaabbb"), T.Val(2)); |
| 133 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val(0.0)); | 148 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val(0.0)); |
| 134 } | 149 } |
| 135 | 150 |
| 136 } // namespace compiler | 151 } // namespace compiler |
| 137 } // namespace internal | 152 } // namespace internal |
| 138 } // namespace v8 | 153 } // namespace v8 |
| OLD | NEW |