| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 v8::Local<v8::Script> script = v8::Script::Compile(v8_str(code)); | 143 v8::Local<v8::Script> script = v8::Script::Compile(v8_str(code)); |
| 144 v8::Local<v8::Object> result = v8::Local<v8::Object>::Cast(script->Run()); | 144 v8::Local<v8::Object> result = v8::Local<v8::Object>::Cast(script->Run()); |
| 145 // Have to populate the handle manually, as it's not Cast-able. | 145 // Have to populate the handle manually, as it's not Cast-able. |
| 146 i::Handle<i::JSObject> o = | 146 i::Handle<i::JSObject> o = |
| 147 v8::Utils::OpenHandle<v8::Object, i::JSObject>(result); | 147 v8::Utils::OpenHandle<v8::Object, i::JSObject>(result); |
| 148 i::Handle<i::JSArray> array1(reinterpret_cast<i::JSArray*>(*o)); | 148 i::Handle<i::JSArray> array1(reinterpret_cast<i::JSArray*>(*o)); |
| 149 i::FixedDoubleArray* a = i::FixedDoubleArray::cast(array1->elements()); | 149 i::FixedDoubleArray* a = i::FixedDoubleArray::cast(array1->elements()); |
| 150 double value = a->get_scalar(0); | 150 double value = a->get_scalar(0); |
| 151 CHECK(std::isnan(value) && | 151 CHECK(std::isnan(value) && |
| 152 i::BitCast<uint64_t>(value) == | 152 i::bit_cast<uint64_t>(value) == |
| 153 i::BitCast<uint64_t>( | 153 i::bit_cast<uint64_t>( |
| 154 i::FixedDoubleArray::canonical_not_the_hole_nan_as_double())); | 154 i::FixedDoubleArray::canonical_not_the_hole_nan_as_double())); |
| 155 } | 155 } |
| 156 | 156 |
| 157 | 157 |
| 158 TEST(NaN0) { | 158 TEST(NaN0) { |
| 159 TestNaN( | 159 TestNaN( |
| 160 "var result;" | 160 "var result;" |
| 161 "for (var i = 0; i < 2; i++) {" | 161 "for (var i = 0; i < 2; i++) {" |
| 162 " result = new Array(Number.NaN, Number.POSITIVE_INFINITY);" | 162 " result = new Array(Number.NaN, Number.POSITIVE_INFINITY);" |
| 163 "}" | 163 "}" |
| 164 "result;"); | 164 "result;"); |
| 165 } | 165 } |
| 166 | 166 |
| 167 | 167 |
| 168 TEST(NaN1) { | 168 TEST(NaN1) { |
| 169 TestNaN( | 169 TestNaN( |
| 170 "var result;" | 170 "var result;" |
| 171 "for (var i = 0; i < 2; i++) {" | 171 "for (var i = 0; i < 2; i++) {" |
| 172 " result = [NaN];" | 172 " result = [NaN];" |
| 173 "}" | 173 "}" |
| 174 "result;"); | 174 "result;"); |
| 175 } | 175 } |
| 176 | 176 |
| 177 | 177 |
| 178 #undef __ | 178 #undef __ |
| OLD | NEW |