| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 value = factory->NewFloat32x4(special_lanes); | 279 value = factory->NewFloat32x4(special_lanes); |
| 280 std::ostringstream os; | 280 std::ostringstream os; |
| 281 value->Float32x4Print(os); | 281 value->Float32x4Print(os); |
| 282 // Value printing doesn't preserve signed zeroes. | 282 // Value printing doesn't preserve signed zeroes. |
| 283 CHECK_EQ("0, 0, NaN, NaN", os.str()); | 283 CHECK_EQ("0, 0, NaN, NaN", os.str()); |
| 284 } | 284 } |
| 285 #endif // OBJECT_PRINT | 285 #endif // OBJECT_PRINT |
| 286 } | 286 } |
| 287 // Int32x4 | 287 // Int32x4 |
| 288 { | 288 { |
| 289 int32_t lanes[4] = {-1, 0, 1, 2}; | 289 int32_t lanes[4] = {1, 2, 3, 4}; |
| 290 | 290 |
| 291 Handle<Int32x4> value = factory->NewInt32x4(lanes); | 291 Handle<Int32x4> value = factory->NewInt32x4(lanes); |
| 292 CHECK(value->IsInt32x4()); | 292 CHECK(value->IsInt32x4()); |
| 293 CheckSimdValue<Int32x4, int32_t, 4>(*value, lanes, 3); | 293 CheckSimdValue<Int32x4, int32_t, 4>(*value, lanes, 3); |
| 294 | 294 |
| 295 #ifdef OBJECT_PRINT | 295 #ifdef OBJECT_PRINT |
| 296 std::ostringstream os; | 296 std::ostringstream os; |
| 297 value->Int32x4Print(os); | 297 value->Int32x4Print(os); |
| 298 CHECK_EQ("-1, 0, 1, 2", os.str()); | 298 CHECK_EQ("1, 2, 3, 4", os.str()); |
| 299 #endif // OBJECT_PRINT |
| 300 } |
| 301 // Uint32x4 |
| 302 { |
| 303 uint32_t lanes[4] = {1, 2, 3, 4}; |
| 304 |
| 305 Handle<Uint32x4> value = factory->NewUint32x4(lanes); |
| 306 CHECK(value->IsUint32x4()); |
| 307 CheckSimdValue<Uint32x4, uint32_t, 4>(*value, lanes, 3); |
| 308 |
| 309 #ifdef OBJECT_PRINT |
| 310 std::ostringstream os; |
| 311 value->Uint32x4Print(os); |
| 312 CHECK_EQ("1, 2, 3, 4", os.str()); |
| 299 #endif // OBJECT_PRINT | 313 #endif // OBJECT_PRINT |
| 300 } | 314 } |
| 301 // Bool32x4 | 315 // Bool32x4 |
| 302 { | 316 { |
| 303 bool lanes[4] = {true, true, true, false}; | 317 bool lanes[4] = {true, false, true, false}; |
| 304 | 318 |
| 305 Handle<Bool32x4> value = factory->NewBool32x4(lanes); | 319 Handle<Bool32x4> value = factory->NewBool32x4(lanes); |
| 306 CHECK(value->IsBool32x4()); | 320 CHECK(value->IsBool32x4()); |
| 307 CheckSimdValue<Bool32x4, bool, 4>(*value, lanes, false); | 321 CheckSimdValue<Bool32x4, bool, 4>(*value, lanes, false); |
| 308 | 322 |
| 309 #ifdef OBJECT_PRINT | 323 #ifdef OBJECT_PRINT |
| 310 std::ostringstream os; | 324 std::ostringstream os; |
| 311 value->Bool32x4Print(os); | 325 value->Bool32x4Print(os); |
| 312 CHECK_EQ("true, true, true, false", os.str()); | 326 CHECK_EQ("true, false, true, false", os.str()); |
| 313 #endif // OBJECT_PRINT | 327 #endif // OBJECT_PRINT |
| 314 } | 328 } |
| 315 // Int16x8 | 329 // Int16x8 |
| 316 { | 330 { |
| 317 int16_t lanes[8] = {-1, 0, 1, 2, 3, 4, 5, -32768}; | 331 int16_t lanes[8] = {1, 2, 3, 4, 5, 6, 7, 8}; |
| 318 | 332 |
| 319 Handle<Int16x8> value = factory->NewInt16x8(lanes); | 333 Handle<Int16x8> value = factory->NewInt16x8(lanes); |
| 320 CHECK(value->IsInt16x8()); | 334 CHECK(value->IsInt16x8()); |
| 321 CheckSimdValue<Int16x8, int16_t, 8>(*value, lanes, 32767); | 335 CheckSimdValue<Int16x8, int16_t, 8>(*value, lanes, 32767); |
| 322 | 336 |
| 323 #ifdef OBJECT_PRINT | 337 #ifdef OBJECT_PRINT |
| 324 std::ostringstream os; | 338 std::ostringstream os; |
| 325 value->Int16x8Print(os); | 339 value->Int16x8Print(os); |
| 326 CHECK_EQ("-1, 0, 1, 2, 3, 4, 5, -32768", os.str()); | 340 CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8", os.str()); |
| 341 #endif // OBJECT_PRINT |
| 342 } |
| 343 // Uint16x8 |
| 344 { |
| 345 uint16_t lanes[8] = {1, 2, 3, 4, 5, 6, 7, 8}; |
| 346 |
| 347 Handle<Uint16x8> value = factory->NewUint16x8(lanes); |
| 348 CHECK(value->IsUint16x8()); |
| 349 CheckSimdValue<Uint16x8, uint16_t, 8>(*value, lanes, 32767); |
| 350 |
| 351 #ifdef OBJECT_PRINT |
| 352 std::ostringstream os; |
| 353 value->Uint16x8Print(os); |
| 354 CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8", os.str()); |
| 327 #endif // OBJECT_PRINT | 355 #endif // OBJECT_PRINT |
| 328 } | 356 } |
| 329 // Bool16x8 | 357 // Bool16x8 |
| 330 { | 358 { |
| 331 bool lanes[8] = {true, true, true, true, true, true, true, false}; | 359 bool lanes[8] = {true, false, true, false, true, false, true, false}; |
| 332 | 360 |
| 333 Handle<Bool16x8> value = factory->NewBool16x8(lanes); | 361 Handle<Bool16x8> value = factory->NewBool16x8(lanes); |
| 334 CHECK(value->IsBool16x8()); | 362 CHECK(value->IsBool16x8()); |
| 335 CheckSimdValue<Bool16x8, bool, 8>(*value, lanes, false); | 363 CheckSimdValue<Bool16x8, bool, 8>(*value, lanes, false); |
| 336 | 364 |
| 337 #ifdef OBJECT_PRINT | 365 #ifdef OBJECT_PRINT |
| 338 std::ostringstream os; | 366 std::ostringstream os; |
| 339 value->Bool16x8Print(os); | 367 value->Bool16x8Print(os); |
| 340 CHECK_EQ("true, true, true, true, true, true, true, false", os.str()); | 368 CHECK_EQ("true, false, true, false, true, false, true, false", os.str()); |
| 341 #endif // OBJECT_PRINT | 369 #endif // OBJECT_PRINT |
| 342 } | 370 } |
| 343 // Int8x16 | 371 // Int8x16 |
| 344 { | 372 { |
| 345 int8_t lanes[16] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -128}; | 373 int8_t lanes[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; |
| 346 | 374 |
| 347 Handle<Int8x16> value = factory->NewInt8x16(lanes); | 375 Handle<Int8x16> value = factory->NewInt8x16(lanes); |
| 348 CHECK(value->IsInt8x16()); | 376 CHECK(value->IsInt8x16()); |
| 349 CheckSimdValue<Int8x16, int8_t, 16>(*value, lanes, 127); | 377 CheckSimdValue<Int8x16, int8_t, 16>(*value, lanes, 127); |
| 350 | 378 |
| 351 #ifdef OBJECT_PRINT | 379 #ifdef OBJECT_PRINT |
| 352 std::ostringstream os; | 380 std::ostringstream os; |
| 353 value->Int8x16Print(os); | 381 value->Int8x16Print(os); |
| 354 CHECK_EQ("-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -128", | 382 CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16", os.str()); |
| 355 os.str()); | 383 #endif // OBJECT_PRINT |
| 384 } |
| 385 // Uint8x16 |
| 386 { |
| 387 uint8_t lanes[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; |
| 388 |
| 389 Handle<Uint8x16> value = factory->NewUint8x16(lanes); |
| 390 CHECK(value->IsUint8x16()); |
| 391 CheckSimdValue<Uint8x16, uint8_t, 16>(*value, lanes, 127); |
| 392 |
| 393 #ifdef OBJECT_PRINT |
| 394 std::ostringstream os; |
| 395 value->Uint8x16Print(os); |
| 396 CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16", os.str()); |
| 356 #endif // OBJECT_PRINT | 397 #endif // OBJECT_PRINT |
| 357 } | 398 } |
| 358 // Bool8x16 | 399 // Bool8x16 |
| 359 { | 400 { |
| 360 bool lanes[16] = {true, true, true, true, true, true, true, false, | 401 bool lanes[16] = {true, false, true, false, true, false, true, false, |
| 361 true, true, true, true, true, true, true, false}; | 402 true, false, true, false, true, false, true, false}; |
| 362 | 403 |
| 363 Handle<Bool8x16> value = factory->NewBool8x16(lanes); | 404 Handle<Bool8x16> value = factory->NewBool8x16(lanes); |
| 364 CHECK(value->IsBool8x16()); | 405 CHECK(value->IsBool8x16()); |
| 365 CheckSimdValue<Bool8x16, bool, 16>(*value, lanes, false); | 406 CheckSimdValue<Bool8x16, bool, 16>(*value, lanes, false); |
| 366 | 407 |
| 367 #ifdef OBJECT_PRINT | 408 #ifdef OBJECT_PRINT |
| 368 std::ostringstream os; | 409 std::ostringstream os; |
| 369 value->Bool8x16Print(os); | 410 value->Bool8x16Print(os); |
| 370 CHECK_EQ( | 411 CHECK_EQ( |
| 371 "true, true, true, true, true, true, true, false, true, true, true, " | 412 "true, false, true, false, true, false, true, false, true, false, " |
| 372 "true, true, true, true, false", | 413 "true, false, true, false, true, false", |
| 373 os.str()); | 414 os.str()); |
| 374 #endif // OBJECT_PRINT | 415 #endif // OBJECT_PRINT |
| 375 } | 416 } |
| 376 } | 417 } |
| 377 | 418 |
| 378 | 419 |
| 379 TEST(Tagging) { | 420 TEST(Tagging) { |
| 380 CcTest::InitializeVM(); | 421 CcTest::InitializeVM(); |
| 381 int request = 24; | 422 int request = 24; |
| 382 CHECK_EQ(request, static_cast<int>(OBJECT_POINTER_ALIGN(request))); | 423 CHECK_EQ(request, static_cast<int>(OBJECT_POINTER_ALIGN(request))); |
| (...skipping 5997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6380 | 6421 |
| 6381 PrintF("Context size : %d bytes\n", measure.Size()); | 6422 PrintF("Context size : %d bytes\n", measure.Size()); |
| 6382 PrintF("Context object count: %d\n", measure.Count()); | 6423 PrintF("Context object count: %d\n", measure.Count()); |
| 6383 | 6424 |
| 6384 CHECK_LE(1000, measure.Count()); | 6425 CHECK_LE(1000, measure.Count()); |
| 6385 CHECK_LE(50000, measure.Size()); | 6426 CHECK_LE(50000, measure.Size()); |
| 6386 | 6427 |
| 6387 CHECK_LE(measure.Count(), count_upper_limit); | 6428 CHECK_LE(measure.Count(), count_upper_limit); |
| 6388 CHECK_LE(measure.Size(), size_upper_limit); | 6429 CHECK_LE(measure.Size(), size_upper_limit); |
| 6389 } | 6430 } |
| OLD | NEW |