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 | |
98 TEST(IsSmi) { | 83 TEST(IsSmi) { |
99 FunctionTester T("(function(a) { return %_IsSmi(a); })", flags); | 84 FunctionTester T("(function(a) { return %_IsSmi(a); })", flags); |
100 | 85 |
101 T.CheckFalse(T.NewObject("new Date()")); | 86 T.CheckFalse(T.NewObject("new Date()")); |
102 T.CheckFalse(T.NewObject("(function() {})")); | 87 T.CheckFalse(T.NewObject("(function() {})")); |
103 T.CheckFalse(T.NewObject("([1])")); | 88 T.CheckFalse(T.NewObject("([1])")); |
104 T.CheckFalse(T.NewObject("({})")); | 89 T.CheckFalse(T.NewObject("({})")); |
105 T.CheckFalse(T.NewObject("(/x/)")); | 90 T.CheckFalse(T.NewObject("(/x/)")); |
106 T.CheckFalse(T.undefined()); | 91 T.CheckFalse(T.undefined()); |
107 T.CheckTrue(T.Val(1)); | 92 T.CheckTrue(T.Val(1)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 FunctionTester T("(function(a,b) { return %_SubString(a,b,b+3); })", flags); | 129 FunctionTester T("(function(a,b) { return %_SubString(a,b,b+3); })", flags); |
145 | 130 |
146 T.CheckCall(T.Val("aaa"), T.Val("aaabbb"), T.Val(0.0)); | 131 T.CheckCall(T.Val("aaa"), T.Val("aaabbb"), T.Val(0.0)); |
147 T.CheckCall(T.Val("abb"), T.Val("aaabbb"), T.Val(2)); | 132 T.CheckCall(T.Val("abb"), T.Val("aaabbb"), T.Val(2)); |
148 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val(0.0)); | 133 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val(0.0)); |
149 } | 134 } |
150 | 135 |
151 } // namespace compiler | 136 } // namespace compiler |
152 } // namespace internal | 137 } // namespace internal |
153 } // namespace v8 | 138 } // namespace v8 |
OLD | NEW |