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 18107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18118 double test_value = test_values[i]; | 18118 double test_value = test_values[i]; |
18119 | 18119 |
18120 // Check that Number::New preserves non-NaNs and quiets SNaNs. | 18120 // Check that Number::New preserves non-NaNs and quiets SNaNs. |
18121 v8::Handle<v8::Value> number = v8::Number::New(isolate, test_value); | 18121 v8::Handle<v8::Value> number = v8::Number::New(isolate, test_value); |
18122 double stored_number = number->NumberValue(); | 18122 double stored_number = number->NumberValue(); |
18123 if (!std::isnan(test_value)) { | 18123 if (!std::isnan(test_value)) { |
18124 CHECK_EQ(test_value, stored_number); | 18124 CHECK_EQ(test_value, stored_number); |
18125 } else { | 18125 } else { |
18126 uint64_t stored_bits = DoubleToBits(stored_number); | 18126 uint64_t stored_bits = DoubleToBits(stored_number); |
18127 // Check if quiet nan (bits 51..62 all set). | 18127 // Check if quiet nan (bits 51..62 all set). |
18128 #if defined(V8_TARGET_ARCH_MIPS) && !defined(USE_SIMULATOR) | 18128 #if (defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64)) && \ |
| 18129 !defined(USE_SIMULATOR) |
18129 // Most significant fraction bit for quiet nan is set to 0 | 18130 // Most significant fraction bit for quiet nan is set to 0 |
18130 // on MIPS architecture. Allowed by IEEE-754. | 18131 // on MIPS architecture. Allowed by IEEE-754. |
18131 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); | 18132 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); |
18132 #else | 18133 #else |
18133 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); | 18134 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
18134 #endif | 18135 #endif |
18135 } | 18136 } |
18136 | 18137 |
18137 // Check that Date::New preserves non-NaNs in the date range and | 18138 // Check that Date::New preserves non-NaNs in the date range and |
18138 // quiets SNaNs. | 18139 // quiets SNaNs. |
18139 v8::Handle<v8::Value> date = | 18140 v8::Handle<v8::Value> date = |
18140 v8::Date::New(isolate, test_value); | 18141 v8::Date::New(isolate, test_value); |
18141 double expected_stored_date = DoubleToDateTime(test_value); | 18142 double expected_stored_date = DoubleToDateTime(test_value); |
18142 double stored_date = date->NumberValue(); | 18143 double stored_date = date->NumberValue(); |
18143 if (!std::isnan(expected_stored_date)) { | 18144 if (!std::isnan(expected_stored_date)) { |
18144 CHECK_EQ(expected_stored_date, stored_date); | 18145 CHECK_EQ(expected_stored_date, stored_date); |
18145 } else { | 18146 } else { |
18146 uint64_t stored_bits = DoubleToBits(stored_date); | 18147 uint64_t stored_bits = DoubleToBits(stored_date); |
18147 // Check if quiet nan (bits 51..62 all set). | 18148 // Check if quiet nan (bits 51..62 all set). |
18148 #if defined(V8_TARGET_ARCH_MIPS) && !defined(USE_SIMULATOR) | 18149 #if (defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64)) && \ |
| 18150 !defined(USE_SIMULATOR) |
18149 // Most significant fraction bit for quiet nan is set to 0 | 18151 // Most significant fraction bit for quiet nan is set to 0 |
18150 // on MIPS architecture. Allowed by IEEE-754. | 18152 // on MIPS architecture. Allowed by IEEE-754. |
18151 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); | 18153 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); |
18152 #else | 18154 #else |
18153 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); | 18155 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
18154 #endif | 18156 #endif |
18155 } | 18157 } |
18156 } | 18158 } |
18157 } | 18159 } |
18158 | 18160 |
(...skipping 4730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22889 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); | 22891 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); |
22890 Local<Function> set = | 22892 Local<Function> set = |
22891 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); | 22893 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); |
22892 Local<Function> get = | 22894 Local<Function> get = |
22893 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); | 22895 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); |
22894 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); | 22896 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); |
22895 Handle<Value> args[] = { v8_num(14) }; | 22897 Handle<Value> args[] = { v8_num(14) }; |
22896 set->Call(x, 1, args); | 22898 set->Call(x, 1, args); |
22897 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); | 22899 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); |
22898 } | 22900 } |
OLD | NEW |