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 18046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18057 | 18057 |
18058 // Check that Number::New preserves non-NaNs and quiets SNaNs. | 18058 // Check that Number::New preserves non-NaNs and quiets SNaNs. |
18059 v8::Handle<v8::Value> number = v8::Number::New(isolate, test_value); | 18059 v8::Handle<v8::Value> number = v8::Number::New(isolate, test_value); |
18060 double stored_number = number->NumberValue(); | 18060 double stored_number = number->NumberValue(); |
18061 if (!std::isnan(test_value)) { | 18061 if (!std::isnan(test_value)) { |
18062 CHECK_EQ(test_value, stored_number); | 18062 CHECK_EQ(test_value, stored_number); |
18063 } else { | 18063 } else { |
18064 uint64_t stored_bits = DoubleToBits(stored_number); | 18064 uint64_t stored_bits = DoubleToBits(stored_number); |
18065 // Check if quiet nan (bits 51..62 all set). | 18065 // Check if quiet nan (bits 51..62 all set). |
18066 #if (defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64)) && \ | 18066 #if (defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64)) && \ |
18067 !defined(USE_SIMULATOR) | 18067 !defined(_MIPS_ARCH_MIPS64R6) && !defined(USE_SIMULATOR) |
18068 // Most significant fraction bit for quiet nan is set to 0 | 18068 // Most significant fraction bit for quiet nan is set to 0 |
18069 // on MIPS architecture. Allowed by IEEE-754. | 18069 // on MIPS architecture. Allowed by IEEE-754. |
18070 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); | 18070 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); |
18071 #else | 18071 #else |
18072 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); | 18072 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
18073 #endif | 18073 #endif |
18074 } | 18074 } |
18075 | 18075 |
18076 // Check that Date::New preserves non-NaNs in the date range and | 18076 // Check that Date::New preserves non-NaNs in the date range and |
18077 // quiets SNaNs. | 18077 // quiets SNaNs. |
18078 v8::Handle<v8::Value> date = | 18078 v8::Handle<v8::Value> date = |
18079 v8::Date::New(isolate, test_value); | 18079 v8::Date::New(isolate, test_value); |
18080 double expected_stored_date = DoubleToDateTime(test_value); | 18080 double expected_stored_date = DoubleToDateTime(test_value); |
18081 double stored_date = date->NumberValue(); | 18081 double stored_date = date->NumberValue(); |
18082 if (!std::isnan(expected_stored_date)) { | 18082 if (!std::isnan(expected_stored_date)) { |
18083 CHECK_EQ(expected_stored_date, stored_date); | 18083 CHECK_EQ(expected_stored_date, stored_date); |
18084 } else { | 18084 } else { |
18085 uint64_t stored_bits = DoubleToBits(stored_date); | 18085 uint64_t stored_bits = DoubleToBits(stored_date); |
18086 // Check if quiet nan (bits 51..62 all set). | 18086 // Check if quiet nan (bits 51..62 all set). |
18087 #if (defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64)) && \ | 18087 #if (defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64)) && \ |
18088 !defined(USE_SIMULATOR) | 18088 !defined(_MIPS_ARCH_MIPS64R6) && !defined(USE_SIMULATOR) |
18089 // Most significant fraction bit for quiet nan is set to 0 | 18089 // Most significant fraction bit for quiet nan is set to 0 |
18090 // on MIPS architecture. Allowed by IEEE-754. | 18090 // on MIPS architecture. Allowed by IEEE-754. |
18091 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); | 18091 CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); |
18092 #else | 18092 #else |
18093 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); | 18093 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
18094 #endif | 18094 #endif |
18095 } | 18095 } |
18096 } | 18096 } |
18097 } | 18097 } |
18098 | 18098 |
(...skipping 4730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22829 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); | 22829 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); |
22830 Local<Function> set = | 22830 Local<Function> set = |
22831 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); | 22831 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); |
22832 Local<Function> get = | 22832 Local<Function> get = |
22833 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); | 22833 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); |
22834 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); | 22834 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); |
22835 Handle<Value> args[] = { v8_num(14) }; | 22835 Handle<Value> args[] = { v8_num(14) }; |
22836 set->Call(x, 1, args); | 22836 set->Call(x, 1, args); |
22837 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); | 22837 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); |
22838 } | 22838 } |
OLD | NEW |