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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 enum VCVTTypes { | 436 enum VCVTTypes { |
437 s32_f64, | 437 s32_f64, |
438 u32_f64 | 438 u32_f64 |
439 }; | 439 }; |
440 | 440 |
441 static void TestRoundingMode(VCVTTypes types, | 441 static void TestRoundingMode(VCVTTypes types, |
442 VFPRoundingMode mode, | 442 VFPRoundingMode mode, |
443 double value, | 443 double value, |
444 int expected, | 444 int expected, |
445 bool expected_exception = false) { | 445 bool expected_exception = false) { |
446 CcTest::InitializeVM(); | |
447 Isolate* isolate = CcTest::i_isolate(); | 446 Isolate* isolate = CcTest::i_isolate(); |
448 HandleScope scope(isolate); | 447 HandleScope scope(isolate); |
449 | 448 |
450 Assembler assm(isolate, NULL, 0); | 449 Assembler assm(isolate, NULL, 0); |
451 | 450 |
452 if (CpuFeatures::IsSupported(VFP3)) { | 451 if (CpuFeatures::IsSupported(VFP3)) { |
453 CpuFeatureScope scope(&assm, VFP3); | 452 CpuFeatureScope scope(&assm, VFP3); |
454 | 453 |
455 Label wrong_exception; | 454 Label wrong_exception; |
456 | 455 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 503 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
505 int res = reinterpret_cast<int>( | 504 int res = reinterpret_cast<int>( |
506 CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); | 505 CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); |
507 ::printf("res = %d\n", res); | 506 ::printf("res = %d\n", res); |
508 CHECK_EQ(expected, res); | 507 CHECK_EQ(expected, res); |
509 } | 508 } |
510 } | 509 } |
511 | 510 |
512 | 511 |
513 TEST(7) { | 512 TEST(7) { |
| 513 CcTest::InitializeVM(); |
514 // Test vfp rounding modes. | 514 // Test vfp rounding modes. |
515 | 515 |
516 // s32_f64 (double to integer). | 516 // s32_f64 (double to integer). |
517 | 517 |
518 TestRoundingMode(s32_f64, RN, 0, 0); | 518 TestRoundingMode(s32_f64, RN, 0, 0); |
519 TestRoundingMode(s32_f64, RN, 0.5, 0); | 519 TestRoundingMode(s32_f64, RN, 0.5, 0); |
520 TestRoundingMode(s32_f64, RN, -0.5, 0); | 520 TestRoundingMode(s32_f64, RN, -0.5, 0); |
521 TestRoundingMode(s32_f64, RN, 1.5, 2); | 521 TestRoundingMode(s32_f64, RN, 1.5, 2); |
522 TestRoundingMode(s32_f64, RN, -1.5, -2); | 522 TestRoundingMode(s32_f64, RN, -1.5, -2); |
523 TestRoundingMode(s32_f64, RN, 123.7, 124); | 523 TestRoundingMode(s32_f64, RN, 123.7, 124); |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 Handle<Code> code = isolate->factory()->NewCode(desc, | 1504 Handle<Code> code = isolate->factory()->NewCode(desc, |
1505 Code::ComputeFlags(Code::STUB), code_object); | 1505 Code::ComputeFlags(Code::STUB), code_object); |
1506 CHECK(code->IsCode()); | 1506 CHECK(code->IsCode()); |
1507 F1 f = FUNCTION_CAST<F1>(code->entry()); | 1507 F1 f = FUNCTION_CAST<F1>(code->entry()); |
1508 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); | 1508 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); |
1509 ::printf("f() = %d\n", res); | 1509 ::printf("f() = %d\n", res); |
1510 CHECK_EQ(42, res); | 1510 CHECK_EQ(42, res); |
1511 } | 1511 } |
1512 | 1512 |
1513 #undef __ | 1513 #undef __ |
OLD | NEW |