| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // TODO(jochen): Remove this after the setting is turned on globally. | 5 // TODO(jochen): Remove this after the setting is turned on globally. |
| 6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
| 11 #include "test/cctest/compiler/codegen-tester.h" | 11 #include "test/cctest/compiler/codegen-tester.h" |
| 12 #include "test/cctest/compiler/graph-builder-tester.h" | 12 #include "test/cctest/compiler/graph-builder-tester.h" |
| 13 #include "test/cctest/compiler/value-helper.h" | 13 #include "test/cctest/compiler/value-helper.h" |
| 14 | 14 |
| 15 #include "src/compiler/node-matchers.h" | 15 #include "src/compiler/node-matchers.h" |
| 16 #include "src/compiler/representation-change.h" | 16 #include "src/compiler/representation-change.h" |
| 17 | 17 |
| 18 using namespace v8::internal; | 18 namespace v8 { |
| 19 using namespace v8::internal::compiler; | |
| 20 | |
| 21 namespace v8 { // for friendiness. | |
| 22 namespace internal { | 19 namespace internal { |
| 23 namespace compiler { | 20 namespace compiler { |
| 24 | 21 |
| 25 class RepresentationChangerTester : public HandleAndZoneScope, | 22 class RepresentationChangerTester : public HandleAndZoneScope, |
| 26 public GraphAndBuilders { | 23 public GraphAndBuilders { |
| 27 public: | 24 public: |
| 28 explicit RepresentationChangerTester(int num_parameters = 0) | 25 explicit RepresentationChangerTester(int num_parameters = 0) |
| 29 : GraphAndBuilders(main_zone()), | 26 : GraphAndBuilders(main_zone()), |
| 30 javascript_(main_zone()), | 27 javascript_(main_zone()), |
| 31 jsgraph_(main_isolate(), main_graph_, &main_common_, &javascript_, | 28 jsgraph_(main_isolate(), main_graph_, &main_common_, &javascript_, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 CHECK(changer()->type_error_); | 92 CHECK(changer()->type_error_); |
| 96 CHECK_EQ(n, c); | 93 CHECK_EQ(n, c); |
| 97 } | 94 } |
| 98 | 95 |
| 99 void CheckNop(MachineTypeUnion from, MachineTypeUnion to) { | 96 void CheckNop(MachineTypeUnion from, MachineTypeUnion to) { |
| 100 Node* n = Parameter(0); | 97 Node* n = Parameter(0); |
| 101 Node* c = changer()->GetRepresentationFor(n, from, to); | 98 Node* c = changer()->GetRepresentationFor(n, from, to); |
| 102 CHECK_EQ(n, c); | 99 CHECK_EQ(n, c); |
| 103 } | 100 } |
| 104 }; | 101 }; |
| 105 } // namespace compiler | |
| 106 } // namespace internal | |
| 107 } // namespace v8 | |
| 108 | 102 |
| 109 | 103 |
| 110 static const MachineType all_reps[] = {kRepBit, kRepWord32, kRepWord64, | 104 static const MachineType all_reps[] = {kRepBit, kRepWord32, kRepWord64, |
| 111 kRepFloat32, kRepFloat64, kRepTagged}; | 105 kRepFloat32, kRepFloat64, kRepTagged}; |
| 112 | 106 |
| 113 | 107 |
| 114 TEST(BoolToBit_constant) { | 108 TEST(BoolToBit_constant) { |
| 115 RepresentationChangerTester r; | 109 RepresentationChangerTester r; |
| 116 | 110 |
| 117 Node* true_node = r.jsgraph()->TrueConstant(); | 111 Node* true_node = r.jsgraph()->TrueConstant(); |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 r.CheckTypeError(kRepWord32 | kTypeUint32, kRepWord64); | 540 r.CheckTypeError(kRepWord32 | kTypeUint32, kRepWord64); |
| 547 | 541 |
| 548 for (size_t i = 0; i < arraysize(all_reps); i++) { | 542 for (size_t i = 0; i < arraysize(all_reps); i++) { |
| 549 for (size_t j = 0; j < arraysize(all_reps); j++) { | 543 for (size_t j = 0; j < arraysize(all_reps); j++) { |
| 550 if (i == j) continue; | 544 if (i == j) continue; |
| 551 // Only a single from representation is allowed. | 545 // Only a single from representation is allowed. |
| 552 r.CheckTypeError(all_reps[i] | all_reps[j], kRepTagged); | 546 r.CheckTypeError(all_reps[i] | all_reps[j], kRepTagged); |
| 553 } | 547 } |
| 554 } | 548 } |
| 555 } | 549 } |
| 550 |
| 551 } // namespace compiler |
| 552 } // namespace internal |
| 553 } // namespace v8 |
| OLD | NEW |