OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/v8.h" |
| 6 |
| 7 #include "src/objects.h" |
| 8 #include "src/ostreams.h" |
| 9 #include "test/cctest/cctest.h" |
| 10 |
| 11 using namespace v8::internal; |
| 12 |
| 13 |
| 14 TEST(SameValue) { |
| 15 CcTest::InitializeVM(); |
| 16 Isolate* isolate = CcTest::i_isolate(); |
| 17 Factory* factory = isolate->factory(); |
| 18 |
| 19 HandleScope sc(isolate); |
| 20 |
| 21 float nan = std::numeric_limits<float>::quiet_NaN(); |
| 22 |
| 23 Handle<Float32x4> a = factory->NewFloat32x4(0, 0, 0, 0); |
| 24 Handle<Float32x4> b = factory->NewFloat32x4(0, 0, 0, 0); |
| 25 CHECK(a->SameValue(*b)); |
| 26 for (int i = 0; i < 4; i++) { |
| 27 a->set_lane(i, nan); |
| 28 CHECK(!a->SameValue(*b)); |
| 29 CHECK(!a->SameValueZero(*b)); |
| 30 b->set_lane(i, nan); |
| 31 CHECK(a->SameValue(*b)); |
| 32 CHECK(a->SameValueZero(*b)); |
| 33 a->set_lane(i, -0.0); |
| 34 CHECK(!a->SameValue(*b)); |
| 35 b->set_lane(i, 0); |
| 36 CHECK(!a->SameValue(*b)); |
| 37 CHECK(a->SameValueZero(*b)); |
| 38 b->set_lane(i, -0.0); |
| 39 CHECK(a->SameValue(*b)); |
| 40 CHECK(a->SameValueZero(*b)); |
| 41 |
| 42 a->set_lane(i, 0); |
| 43 b->set_lane(i, 0); |
| 44 } |
| 45 } |
OLD | NEW |