OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 8575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8586 double test_value = test_values[i]; | 8586 double test_value = test_values[i]; |
8587 | 8587 |
8588 // Check that Number::New preserves non-NaNs and quiets SNaNs. | 8588 // Check that Number::New preserves non-NaNs and quiets SNaNs. |
8589 v8::Handle<v8::Value> number = v8::Number::New(test_value); | 8589 v8::Handle<v8::Value> number = v8::Number::New(test_value); |
8590 double stored_number = number->NumberValue(); | 8590 double stored_number = number->NumberValue(); |
8591 if (!IsNaN(test_value)) { | 8591 if (!IsNaN(test_value)) { |
8592 CHECK_EQ(test_value, stored_number); | 8592 CHECK_EQ(test_value, stored_number); |
8593 } else { | 8593 } else { |
8594 uint64_t stored_bits = DoubleToBits(stored_number); | 8594 uint64_t stored_bits = DoubleToBits(stored_number); |
8595 // Check if quiet nan (bits 51..62 all set). | 8595 // Check if quiet nan (bits 51..62 all set). |
8596 CHECK_EQ(0xfff, (stored_bits >> 51) & 0xfff); | 8596 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
8597 } | 8597 } |
8598 | 8598 |
8599 // Check that Date::New preserves non-NaNs in the date range and | 8599 // Check that Date::New preserves non-NaNs in the date range and |
8600 // quiets SNaNs. | 8600 // quiets SNaNs. |
8601 v8::Handle<v8::Value> date = v8::Date::New(test_value); | 8601 v8::Handle<v8::Value> date = v8::Date::New(test_value); |
8602 double expected_stored_date = DoubleToDateTime(test_value); | 8602 double expected_stored_date = DoubleToDateTime(test_value); |
8603 double stored_date = date->NumberValue(); | 8603 double stored_date = date->NumberValue(); |
8604 if (!IsNaN(expected_stored_date)) { | 8604 if (!IsNaN(expected_stored_date)) { |
8605 CHECK_EQ(expected_stored_date, stored_date); | 8605 CHECK_EQ(expected_stored_date, stored_date); |
8606 } else { | 8606 } else { |
8607 uint64_t stored_bits = DoubleToBits(stored_date); | 8607 uint64_t stored_bits = DoubleToBits(stored_date); |
8608 // Check if quiet nan (bits 51..62 all set). | 8608 // Check if quiet nan (bits 51..62 all set). |
8609 CHECK_EQ(0xfff, (stored_bits >> 51) & 0xfff); | 8609 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
8610 } | 8610 } |
8611 } | 8611 } |
8612 } | 8612 } |
OLD | NEW |