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 "test/cctest/compiler/function-tester.h" | 5 #include "test/cctest/compiler/function-tester.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace compiler { | 9 namespace compiler { |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 string->SeqOneByteStringSet(0, 'b'); | 160 string->SeqOneByteStringSet(0, 'b'); |
161 string->SeqOneByteStringSet(1, 'a'); | 161 string->SeqOneByteStringSet(1, 'a'); |
162 string->SeqOneByteStringSet(2, 'r'); | 162 string->SeqOneByteStringSet(2, 'r'); |
163 T.Call(T.Val(1), string); | 163 T.Call(T.Val(1), string); |
164 CHECK_EQ('b', string->SeqOneByteStringGet(0)); | 164 CHECK_EQ('b', string->SeqOneByteStringGet(0)); |
165 CHECK_EQ('X', string->SeqOneByteStringGet(1)); | 165 CHECK_EQ('X', string->SeqOneByteStringGet(1)); |
166 CHECK_EQ('r', string->SeqOneByteStringGet(2)); | 166 CHECK_EQ('r', string->SeqOneByteStringGet(2)); |
167 } | 167 } |
168 | 168 |
169 | 169 |
170 TEST(SetValueOf) { | |
171 FunctionTester T("(function(a,b) { return %_SetValueOf(a,b); })", flags); | |
172 | |
173 T.CheckCall(T.Val("a"), T.NewObject("(new String)"), T.Val("a")); | |
174 T.CheckCall(T.Val(123), T.NewObject("(new Number)"), T.Val(123)); | |
175 T.CheckCall(T.Val("x"), T.undefined(), T.Val("x")); | |
176 } | |
177 | |
178 | |
179 TEST(StringAdd) { | 170 TEST(StringAdd) { |
180 FunctionTester T("(function(a,b) { return %_StringAdd(a,b); })", flags); | 171 FunctionTester T("(function(a,b) { return %_StringAdd(a,b); })", flags); |
181 | 172 |
182 T.CheckCall(T.Val("aaabbb"), T.Val("aaa"), T.Val("bbb")); | 173 T.CheckCall(T.Val("aaabbb"), T.Val("aaa"), T.Val("bbb")); |
183 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val("")); | 174 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val("")); |
184 T.CheckCall(T.Val("bbb"), T.Val(""), T.Val("bbb")); | 175 T.CheckCall(T.Val("bbb"), T.Val(""), T.Val("bbb")); |
185 } | 176 } |
186 | 177 |
187 | 178 |
188 TEST(StringCharAt) { | 179 TEST(StringCharAt) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 258 |
268 T.CheckCall(T.Val("a"), T.Val("a")); | 259 T.CheckCall(T.Val("a"), T.Val("a")); |
269 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); | 260 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); |
270 T.CheckCall(T.Val(123), T.Val(123)); | 261 T.CheckCall(T.Val(123), T.Val(123)); |
271 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); | 262 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); |
272 } | 263 } |
273 | 264 |
274 } // namespace compiler | 265 } // namespace compiler |
275 } // namespace internal | 266 } // namespace internal |
276 } // namespace v8 | 267 } // namespace v8 |
OLD | NEW |