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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 bit_cast<uint64_t>(value) == | 152 bit_cast<uint64_t>(value) == |
153 bit_cast<uint64_t>( | 153 bit_cast<uint64_t>(std::numeric_limits<double>::quiet_NaN())); |
154 i::FixedDoubleArray::canonical_not_the_hole_nan_as_double())); | |
155 } | 154 } |
156 | 155 |
157 | 156 |
158 TEST(NaN0) { | 157 TEST(NaN0) { |
159 TestNaN( | 158 TestNaN( |
160 "var result;" | 159 "var result;" |
161 "for (var i = 0; i < 2; i++) {" | 160 "for (var i = 0; i < 2; i++) {" |
162 " result = new Array(Number.NaN, Number.POSITIVE_INFINITY);" | 161 " result = new Array(Number.NaN, Number.POSITIVE_INFINITY);" |
163 "}" | 162 "}" |
164 "result;"); | 163 "result;"); |
165 } | 164 } |
166 | 165 |
167 | 166 |
168 TEST(NaN1) { | 167 TEST(NaN1) { |
169 TestNaN( | 168 TestNaN( |
170 "var result;" | 169 "var result;" |
171 "for (var i = 0; i < 2; i++) {" | 170 "for (var i = 0; i < 2; i++) {" |
172 " result = [NaN];" | 171 " result = [NaN];" |
173 "}" | 172 "}" |
174 "result;"); | 173 "result;"); |
175 } | 174 } |
176 | 175 |
177 | 176 |
178 #undef __ | 177 #undef __ |
OLD | NEW |