Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: test/cctest/compiler/test-js-typed-lowering.cc

Issue 877643002: Reland of "Steps towards unification of number bitset and range types." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Avoid (some of the) uninhabited type normalization based on representation. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "src/compiler/graph-inl.h" 5 #include "src/compiler/graph-inl.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/js-typed-lowering.h" 7 #include "src/compiler/js-typed-lowering.h"
8 #include "src/compiler/machine-operator.h" 8 #include "src/compiler/machine-operator.h"
9 #include "src/compiler/node-properties-inl.h" 9 #include "src/compiler/node-properties-inl.h"
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 CHECK_EQ(IrOpcode::kHeapConstant, result->opcode()); 169 CHECK_EQ(IrOpcode::kHeapConstant, result->opcode());
170 Handle<Object> value = OpParameter<Unique<Object> >(result).handle(); 170 Handle<Object> value = OpParameter<Unique<Object> >(result).handle();
171 CHECK_EQ(*expected, *value); 171 CHECK_EQ(*expected, *value);
172 } 172 }
173 }; 173 };
174 174
175 static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(), 175 static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(),
176 Type::String()}; 176 Type::String()};
177 177
178 178
179 static Type* kInt32Types[] = { 179 static Type* kInt32Types[] = {Type::UnsignedSmall(), Type::Negative32(),
180 Type::UnsignedSmall(), Type::NegativeSigned32(), 180 Type::Unsigned31(), Type::SignedSmall(),
181 Type::NonNegativeSigned32(), Type::SignedSmall(), 181 Type::Signed32(), Type::Unsigned32(),
182 Type::Signed32(), Type::Unsigned32(), 182 Type::Integral32()};
183 Type::Integral32()};
184 183
185 184
186 static Type* kNumberTypes[] = { 185 static Type* kNumberTypes[] = {
187 Type::UnsignedSmall(), Type::NegativeSigned32(), 186 Type::UnsignedSmall(), Type::Negative32(), Type::Unsigned31(),
188 Type::NonNegativeSigned32(), Type::SignedSmall(), 187 Type::SignedSmall(), Type::Signed32(), Type::Unsigned32(),
189 Type::Signed32(), Type::Unsigned32(), 188 Type::Integral32(), Type::MinusZero(), Type::NaN(),
190 Type::Integral32(), Type::MinusZero(), 189 Type::OrderedNumber(), Type::PlainNumber(), Type::Number()};
191 Type::NaN(), Type::OrderedNumber(),
192 Type::PlainNumber(), Type::Number()};
193 190
194 191
195 static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), 192 static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(),
196 Type::Number(), Type::String(), Type::Object()}; 193 Type::Number(), Type::String(), Type::Object()};
197 194
198 195
199 static Type* I32Type(bool is_signed) { 196 static Type* I32Type(bool is_signed) {
200 return is_signed ? Type::Signed32() : Type::Unsigned32(); 197 return is_signed ? Type::Signed32() : Type::Unsigned32();
201 } 198 }
202 199
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 void set(int idx, const Operator* op, bool s) { 306 void set(int idx, const Operator* op, bool s) {
310 ops[idx] = op; 307 ops[idx] = op;
311 signedness[idx] = s; 308 signedness[idx] = s;
312 } 309 }
313 }; 310 };
314 311
315 312
316 TEST(Int32BitwiseShifts) { 313 TEST(Int32BitwiseShifts) {
317 JSBitwiseShiftTypedLoweringTester R; 314 JSBitwiseShiftTypedLoweringTester R;
318 315
319 Type* types[] = {Type::SignedSmall(), Type::UnsignedSmall(), 316 Type* types[] = {
320 Type::NegativeSigned32(), Type::NonNegativeSigned32(), 317 Type::SignedSmall(), Type::UnsignedSmall(), Type::Negative32(),
321 Type::Unsigned32(), Type::Signed32(), 318 Type::Unsigned31(), Type::Unsigned32(), Type::Signed32(),
322 Type::MinusZero(), Type::NaN(), 319 Type::MinusZero(), Type::NaN(), Type::Undefined(),
323 Type::Undefined(), Type::Null(), 320 Type::Null(), Type::Boolean(), Type::Number(),
324 Type::Boolean(), Type::Number(), 321 Type::PlainNumber(), Type::String()};
325 Type::PlainNumber(), Type::String()};
326 322
327 for (size_t i = 0; i < arraysize(types); ++i) { 323 for (size_t i = 0; i < arraysize(types); ++i) {
328 Node* p0 = R.Parameter(types[i], 0); 324 Node* p0 = R.Parameter(types[i], 0);
329 325
330 for (size_t j = 0; j < arraysize(types); ++j) { 326 for (size_t j = 0; j < arraysize(types); ++j) {
331 Node* p1 = R.Parameter(types[j], 1); 327 Node* p1 = R.Parameter(types[j], 1);
332 328
333 for (int k = 0; k < R.kNumberOps; k += 2) { 329 for (int k = 0; k < R.kNumberOps; k += 2) {
334 Node* add = R.Binop(R.ops[k], p0, p1); 330 Node* add = R.Binop(R.ops[k], p0, p1);
335 Node* r = R.reduce(add); 331 Node* r = R.reduce(add);
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 CHECK_EQ(p1, r->InputAt(0)); 1276 CHECK_EQ(p1, r->InputAt(0));
1281 CHECK_EQ(p0, r->InputAt(1)); 1277 CHECK_EQ(p0, r->InputAt(1));
1282 } else { 1278 } else {
1283 CHECK_EQ(p0, r->InputAt(0)); 1279 CHECK_EQ(p0, r->InputAt(0));
1284 CHECK_EQ(p1, r->InputAt(1)); 1280 CHECK_EQ(p1, r->InputAt(1));
1285 } 1281 }
1286 } 1282 }
1287 } 1283 }
1288 } 1284 }
1289 } 1285 }
OLDNEW
« src/types.cc ('K') | « src/types-inl.h ('k') | test/cctest/test-types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698