OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 value = factory->NewFloat32x4(special_lanes); | 281 value = factory->NewFloat32x4(special_lanes); |
282 std::ostringstream os; | 282 std::ostringstream os; |
283 value->Float32x4Print(os); | 283 value->Float32x4Print(os); |
284 // Value printing doesn't preserve signed zeroes. | 284 // Value printing doesn't preserve signed zeroes. |
285 CHECK_EQ("0, 0, NaN, NaN", os.str()); | 285 CHECK_EQ("0, 0, NaN, NaN", os.str()); |
286 } | 286 } |
287 #endif // OBJECT_PRINT | 287 #endif // OBJECT_PRINT |
288 } | 288 } |
289 // Int32x4 | 289 // Int32x4 |
290 { | 290 { |
291 int32_t lanes[4] = {1, 2, 3, 4}; | 291 int32_t lanes[4] = {-1, 0, 1, 2}; |
292 | 292 |
293 Handle<Int32x4> value = factory->NewInt32x4(lanes); | 293 Handle<Int32x4> value = factory->NewInt32x4(lanes); |
294 CHECK(value->IsInt32x4()); | 294 CHECK(value->IsInt32x4()); |
295 CheckSimdValue<Int32x4, int32_t, 4>(*value, lanes, 3); | 295 CheckSimdValue<Int32x4, int32_t, 4>(*value, lanes, 3); |
296 | 296 |
297 #ifdef OBJECT_PRINT | 297 #ifdef OBJECT_PRINT |
298 std::ostringstream os; | 298 std::ostringstream os; |
299 value->Int32x4Print(os); | 299 value->Int32x4Print(os); |
300 CHECK_EQ("1, 2, 3, 4", os.str()); | 300 CHECK_EQ("-1, 0, 1, 2", os.str()); |
301 #endif // OBJECT_PRINT | |
302 } | |
303 // Uint32x4 | |
304 { | |
305 uint32_t lanes[4] = {1, 2, 3, 4}; | |
306 | |
307 Handle<Uint32x4> value = factory->NewUint32x4(lanes); | |
308 CHECK(value->IsUint32x4()); | |
309 CheckSimdValue<Uint32x4, uint32_t, 4>(*value, lanes, 3); | |
310 | |
311 #ifdef OBJECT_PRINT | |
312 std::ostringstream os; | |
313 value->Uint32x4Print(os); | |
314 CHECK_EQ("1, 2, 3, 4", os.str()); | |
315 #endif // OBJECT_PRINT | 301 #endif // OBJECT_PRINT |
316 } | 302 } |
317 // Bool32x4 | 303 // Bool32x4 |
318 { | 304 { |
319 bool lanes[4] = {true, false, true, false}; | 305 bool lanes[4] = {true, true, true, false}; |
320 | 306 |
321 Handle<Bool32x4> value = factory->NewBool32x4(lanes); | 307 Handle<Bool32x4> value = factory->NewBool32x4(lanes); |
322 CHECK(value->IsBool32x4()); | 308 CHECK(value->IsBool32x4()); |
323 CheckSimdValue<Bool32x4, bool, 4>(*value, lanes, false); | 309 CheckSimdValue<Bool32x4, bool, 4>(*value, lanes, false); |
324 | 310 |
325 #ifdef OBJECT_PRINT | 311 #ifdef OBJECT_PRINT |
326 std::ostringstream os; | 312 std::ostringstream os; |
327 value->Bool32x4Print(os); | 313 value->Bool32x4Print(os); |
328 CHECK_EQ("true, false, true, false", os.str()); | 314 CHECK_EQ("true, true, true, false", os.str()); |
329 #endif // OBJECT_PRINT | 315 #endif // OBJECT_PRINT |
330 } | 316 } |
331 // Int16x8 | 317 // Int16x8 |
332 { | 318 { |
333 int16_t lanes[8] = {1, 2, 3, 4, 5, 6, 7, 8}; | 319 int16_t lanes[8] = {-1, 0, 1, 2, 3, 4, 5, -32768}; |
334 | 320 |
335 Handle<Int16x8> value = factory->NewInt16x8(lanes); | 321 Handle<Int16x8> value = factory->NewInt16x8(lanes); |
336 CHECK(value->IsInt16x8()); | 322 CHECK(value->IsInt16x8()); |
337 CheckSimdValue<Int16x8, int16_t, 8>(*value, lanes, 32767); | 323 CheckSimdValue<Int16x8, int16_t, 8>(*value, lanes, 32767); |
338 | 324 |
339 #ifdef OBJECT_PRINT | 325 #ifdef OBJECT_PRINT |
340 std::ostringstream os; | 326 std::ostringstream os; |
341 value->Int16x8Print(os); | 327 value->Int16x8Print(os); |
342 CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8", os.str()); | 328 CHECK_EQ("-1, 0, 1, 2, 3, 4, 5, -32768", os.str()); |
343 #endif // OBJECT_PRINT | |
344 } | |
345 // Uint16x8 | |
346 { | |
347 uint16_t lanes[8] = {1, 2, 3, 4, 5, 6, 7, 8}; | |
348 | |
349 Handle<Uint16x8> value = factory->NewUint16x8(lanes); | |
350 CHECK(value->IsUint16x8()); | |
351 CheckSimdValue<Uint16x8, uint16_t, 8>(*value, lanes, 32767); | |
352 | |
353 #ifdef OBJECT_PRINT | |
354 std::ostringstream os; | |
355 value->Uint16x8Print(os); | |
356 CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8", os.str()); | |
357 #endif // OBJECT_PRINT | 329 #endif // OBJECT_PRINT |
358 } | 330 } |
359 // Bool16x8 | 331 // Bool16x8 |
360 { | 332 { |
361 bool lanes[8] = {true, false, true, false, true, false, true, false}; | 333 bool lanes[8] = {true, true, true, true, true, true, true, false}; |
362 | 334 |
363 Handle<Bool16x8> value = factory->NewBool16x8(lanes); | 335 Handle<Bool16x8> value = factory->NewBool16x8(lanes); |
364 CHECK(value->IsBool16x8()); | 336 CHECK(value->IsBool16x8()); |
365 CheckSimdValue<Bool16x8, bool, 8>(*value, lanes, false); | 337 CheckSimdValue<Bool16x8, bool, 8>(*value, lanes, false); |
366 | 338 |
367 #ifdef OBJECT_PRINT | 339 #ifdef OBJECT_PRINT |
368 std::ostringstream os; | 340 std::ostringstream os; |
369 value->Bool16x8Print(os); | 341 value->Bool16x8Print(os); |
370 CHECK_EQ("true, false, true, false, true, false, true, false", os.str()); | 342 CHECK_EQ("true, true, true, true, true, true, true, false", os.str()); |
371 #endif // OBJECT_PRINT | 343 #endif // OBJECT_PRINT |
372 } | 344 } |
373 // Int8x16 | 345 // Int8x16 |
374 { | 346 { |
375 int8_t lanes[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; | 347 int8_t lanes[16] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -128}; |
376 | 348 |
377 Handle<Int8x16> value = factory->NewInt8x16(lanes); | 349 Handle<Int8x16> value = factory->NewInt8x16(lanes); |
378 CHECK(value->IsInt8x16()); | 350 CHECK(value->IsInt8x16()); |
379 CheckSimdValue<Int8x16, int8_t, 16>(*value, lanes, 127); | 351 CheckSimdValue<Int8x16, int8_t, 16>(*value, lanes, 127); |
380 | 352 |
381 #ifdef OBJECT_PRINT | 353 #ifdef OBJECT_PRINT |
382 std::ostringstream os; | 354 std::ostringstream os; |
383 value->Int8x16Print(os); | 355 value->Int8x16Print(os); |
384 CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16", os.str()); | 356 CHECK_EQ("-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -128", |
385 #endif // OBJECT_PRINT | 357 os.str()); |
386 } | |
387 // Uint8x16 | |
388 { | |
389 uint8_t lanes[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; | |
390 | |
391 Handle<Uint8x16> value = factory->NewUint8x16(lanes); | |
392 CHECK(value->IsUint8x16()); | |
393 CheckSimdValue<Uint8x16, uint8_t, 16>(*value, lanes, 127); | |
394 | |
395 #ifdef OBJECT_PRINT | |
396 std::ostringstream os; | |
397 value->Uint8x16Print(os); | |
398 CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16", os.str()); | |
399 #endif // OBJECT_PRINT | 358 #endif // OBJECT_PRINT |
400 } | 359 } |
401 // Bool8x16 | 360 // Bool8x16 |
402 { | 361 { |
403 bool lanes[16] = {true, false, true, false, true, false, true, false, | 362 bool lanes[16] = {true, true, true, true, true, true, true, false, |
404 true, false, true, false, true, false, true, false}; | 363 true, true, true, true, true, true, true, false}; |
405 | 364 |
406 Handle<Bool8x16> value = factory->NewBool8x16(lanes); | 365 Handle<Bool8x16> value = factory->NewBool8x16(lanes); |
407 CHECK(value->IsBool8x16()); | 366 CHECK(value->IsBool8x16()); |
408 CheckSimdValue<Bool8x16, bool, 16>(*value, lanes, false); | 367 CheckSimdValue<Bool8x16, bool, 16>(*value, lanes, false); |
409 | 368 |
410 #ifdef OBJECT_PRINT | 369 #ifdef OBJECT_PRINT |
411 std::ostringstream os; | 370 std::ostringstream os; |
412 value->Bool8x16Print(os); | 371 value->Bool8x16Print(os); |
413 CHECK_EQ( | 372 CHECK_EQ( |
414 "true, false, true, false, true, false, true, false, true, false, " | 373 "true, true, true, true, true, true, true, false, true, true, true, " |
415 "true, false, true, false, true, false", | 374 "true, true, true, true, false", |
416 os.str()); | 375 os.str()); |
417 #endif // OBJECT_PRINT | 376 #endif // OBJECT_PRINT |
418 } | 377 } |
419 } | 378 } |
420 | 379 |
421 | 380 |
422 TEST(Tagging) { | 381 TEST(Tagging) { |
423 CcTest::InitializeVM(); | 382 CcTest::InitializeVM(); |
424 int request = 24; | 383 int request = 24; |
425 CHECK_EQ(request, static_cast<int>(OBJECT_POINTER_ALIGN(request))); | 384 CHECK_EQ(request, static_cast<int>(OBJECT_POINTER_ALIGN(request))); |
(...skipping 6136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6562 { | 6521 { |
6563 SharedFunctionInfo::Iterator iterator(isolate); | 6522 SharedFunctionInfo::Iterator iterator(isolate); |
6564 while (iterator.Next()) sfi_count--; | 6523 while (iterator.Next()) sfi_count--; |
6565 } | 6524 } |
6566 | 6525 |
6567 CHECK_EQ(0, sfi_count); | 6526 CHECK_EQ(0, sfi_count); |
6568 } | 6527 } |
6569 | 6528 |
6570 } // namespace internal | 6529 } // namespace internal |
6571 } // namespace v8 | 6530 } // namespace v8 |
OLD | NEW |