OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/asmjs/asm-types.h" | 5 #include "src/asmjs/asm-types.h" |
6 | 6 |
7 #include <unordered_map> | 7 #include <unordered_map> |
8 #include <unordered_set> | 8 #include <unordered_set> |
9 | 9 |
10 #include "src/base/macros.h" | 10 #include "src/base/macros.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // Generic validation tests for the bits in the type system's type | 148 // Generic validation tests for the bits in the type system's type |
149 // definitions. | 149 // definitions. |
150 | 150 |
151 std::unordered_set<Type*> seen_types; | 151 std::unordered_set<Type*> seen_types; |
152 std::unordered_set<uint32_t> seen_numbers; | 152 std::unordered_set<uint32_t> seen_numbers; |
153 uint32_t total_types = 0; | 153 uint32_t total_types = 0; |
154 #define V(CamelName, string_name, number, parent_types) \ | 154 #define V(CamelName, string_name, number, parent_types) \ |
155 do { \ | 155 do { \ |
156 ++total_types; \ | 156 ++total_types; \ |
157 if (AsmValueTypeParents::CamelName != 0) { \ | 157 if (AsmValueTypeParents::CamelName != 0) { \ |
158 EXPECT_NE(0, ParentsOf(AsmType::CamelName()).size()) << #CamelName; \ | 158 EXPECT_NE(0u, ParentsOf(AsmType::CamelName()).size()) << #CamelName; \ |
159 } \ | 159 } \ |
160 seen_types.insert(Type::CamelName()); \ | 160 seen_types.insert(Type::CamelName()); \ |
161 seen_numbers.insert(number); \ | 161 seen_numbers.insert(number); \ |
162 /* Every ASM type must have a valid number. */ \ | 162 /* Every ASM type must have a valid number. */ \ |
163 EXPECT_NE(0, number) << Type::CamelName()->Name(); \ | 163 EXPECT_NE(0, number) << Type::CamelName()->Name(); \ |
164 /* Inheritance cycles - unlikely, but we're paranoid and check for it */ \ | 164 /* Inheritance cycles - unlikely, but we're paranoid and check for it */ \ |
165 /* anyways.*/ \ | 165 /* anyways.*/ \ |
166 EXPECT_EQ(0, (1 << (number)) & AsmValueTypeParents::CamelName); \ | 166 EXPECT_EQ(0u, (1 << (number)) & AsmValueTypeParents::CamelName); \ |
167 } while (0); | 167 } while (0); |
168 FOR_EACH_ASM_VALUE_TYPE_LIST(V) | 168 FOR_EACH_ASM_VALUE_TYPE_LIST(V) |
169 #undef V | 169 #undef V |
170 | 170 |
171 // At least one type was expanded. | 171 // At least one type was expanded. |
172 EXPECT_GT(total_types, 0u); | 172 EXPECT_GT(total_types, 0u); |
173 | 173 |
174 // Each value type is unique. | 174 // Each value type is unique. |
175 EXPECT_EQ(total_types, seen_types.size()); | 175 EXPECT_EQ(total_types, seen_types.size()); |
176 | 176 |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 for (size_t ii = 0; ii < arraysize(test_types); ++ii) { | 714 for (size_t ii = 0; ii < arraysize(test_types); ++ii) { |
715 EXPECT_EQ(StoreTypeForType(test_types[ii]), test_types[ii]->StoreType()) | 715 EXPECT_EQ(StoreTypeForType(test_types[ii]), test_types[ii]->StoreType()) |
716 << test_types[ii]->Name(); | 716 << test_types[ii]->Name(); |
717 } | 717 } |
718 } | 718 } |
719 | 719 |
720 } // namespace | 720 } // namespace |
721 } // namespace wasm | 721 } // namespace wasm |
722 } // namespace internal | 722 } // namespace internal |
723 } // namespace v8 | 723 } // namespace v8 |
OLD | NEW |