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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 string->SeqOneByteStringSet(0, 'b'); | 210 string->SeqOneByteStringSet(0, 'b'); |
211 string->SeqOneByteStringSet(1, 'a'); | 211 string->SeqOneByteStringSet(1, 'a'); |
212 string->SeqOneByteStringSet(2, 'r'); | 212 string->SeqOneByteStringSet(2, 'r'); |
213 T.Call(T.Val(1), string); | 213 T.Call(T.Val(1), string); |
214 CHECK_EQ('b', string->SeqOneByteStringGet(0)); | 214 CHECK_EQ('b', string->SeqOneByteStringGet(0)); |
215 CHECK_EQ('X', string->SeqOneByteStringGet(1)); | 215 CHECK_EQ('X', string->SeqOneByteStringGet(1)); |
216 CHECK_EQ('r', string->SeqOneByteStringGet(2)); | 216 CHECK_EQ('r', string->SeqOneByteStringGet(2)); |
217 } | 217 } |
218 | 218 |
219 | 219 |
220 TEST(NewConsString) { | |
221 FunctionTester T( | |
222 "(function() { " | |
223 " return %_NewConsString(14, true, 'abcdefghi', 'jklmn');" | |
224 " })", | |
225 flags); | |
226 | |
227 T.CheckCall(T.Val("abcdefghijklmn")); | |
228 } | |
229 | |
230 | |
231 TEST(SetValueOf) { | 220 TEST(SetValueOf) { |
232 FunctionTester T("(function(a,b) { return %_SetValueOf(a,b); })", flags); | 221 FunctionTester T("(function(a,b) { return %_SetValueOf(a,b); })", flags); |
233 | 222 |
234 T.CheckCall(T.Val("a"), T.NewObject("(new String)"), T.Val("a")); | 223 T.CheckCall(T.Val("a"), T.NewObject("(new String)"), T.Val("a")); |
235 T.CheckCall(T.Val(123), T.NewObject("(new Number)"), T.Val(123)); | 224 T.CheckCall(T.Val(123), T.NewObject("(new Number)"), T.Val(123)); |
236 T.CheckCall(T.Val("x"), T.undefined(), T.Val("x")); | 225 T.CheckCall(T.Val("x"), T.undefined(), T.Val("x")); |
237 } | 226 } |
238 | 227 |
239 | 228 |
240 TEST(StringAdd) { | 229 TEST(StringAdd) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 313 |
325 | 314 |
326 TEST(ValueOf) { | 315 TEST(ValueOf) { |
327 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); | 316 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); |
328 | 317 |
329 T.CheckCall(T.Val("a"), T.Val("a")); | 318 T.CheckCall(T.Val("a"), T.Val("a")); |
330 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); | 319 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); |
331 T.CheckCall(T.Val(123), T.Val(123)); | 320 T.CheckCall(T.Val(123), T.Val(123)); |
332 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); | 321 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); |
333 } | 322 } |
OLD | NEW |