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 #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 148 matching lines...) Loading... | |
159 CHECK_EQ(IrOpcode::kHeapConstant, result->opcode()); | 159 CHECK_EQ(IrOpcode::kHeapConstant, result->opcode()); |
160 Handle<Object> value = OpParameter<Unique<Object> >(result).handle(); | 160 Handle<Object> value = OpParameter<Unique<Object> >(result).handle(); |
161 CHECK_EQ(*expected, *value); | 161 CHECK_EQ(*expected, *value); |
162 } | 162 } |
163 }; | 163 }; |
164 | 164 |
165 static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(), | 165 static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(), |
166 Type::String()}; | 166 Type::String()}; |
167 | 167 |
168 | 168 |
169 static Type* kInt32Types[] = { | 169 static Type* kInt32Types[] = {Type::Unsigned30(), Type::Negative32(), |
rossberg
2015/01/15 15:15:12
Why can't you use the Small types any longer?
Jarin
2015/01/16 16:28:39
Done.
| |
170 Type::UnsignedSmall(), Type::NegativeSigned32(), | 170 Type::Unsigned31(), Type::Signed31(), |
171 Type::NonNegativeSigned32(), Type::SignedSmall(), | 171 Type::Signed32(), Type::Unsigned32(), |
172 Type::Signed32(), Type::Unsigned32(), | 172 Type::Integral32()}; |
173 Type::Integral32()}; | |
174 | 173 |
175 | 174 |
176 static Type* kNumberTypes[] = { | 175 static Type* kNumberTypes[] = { |
177 Type::UnsignedSmall(), Type::NegativeSigned32(), | 176 Type::Unsigned30(), Type::Negative32(), Type::Unsigned31(), |
178 Type::NonNegativeSigned32(), Type::SignedSmall(), | 177 Type::Signed31(), Type::Signed32(), Type::Unsigned32(), |
179 Type::Signed32(), Type::Unsigned32(), | 178 Type::Integral32(), Type::MinusZero(), Type::NaN(), |
180 Type::Integral32(), Type::MinusZero(), | 179 Type::OrderedNumber(), Type::PlainNumber(), Type::Number()}; |
181 Type::NaN(), Type::OrderedNumber(), | |
182 Type::PlainNumber(), Type::Number()}; | |
183 | 180 |
184 | 181 |
185 static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), | 182 static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), |
186 Type::Number(), Type::String(), Type::Object()}; | 183 Type::Number(), Type::String(), Type::Object()}; |
187 | 184 |
188 | 185 |
189 static Type* I32Type(bool is_signed) { | 186 static Type* I32Type(bool is_signed) { |
190 return is_signed ? Type::Signed32() : Type::Unsigned32(); | 187 return is_signed ? Type::Signed32() : Type::Unsigned32(); |
191 } | 188 } |
192 | 189 |
(...skipping 106 matching lines...) Loading... | |
299 void set(int idx, const Operator* op, bool s) { | 296 void set(int idx, const Operator* op, bool s) { |
300 ops[idx] = op; | 297 ops[idx] = op; |
301 signedness[idx] = s; | 298 signedness[idx] = s; |
302 } | 299 } |
303 }; | 300 }; |
304 | 301 |
305 | 302 |
306 TEST(Int32BitwiseShifts) { | 303 TEST(Int32BitwiseShifts) { |
307 JSBitwiseShiftTypedLoweringTester R; | 304 JSBitwiseShiftTypedLoweringTester R; |
308 | 305 |
309 Type* types[] = {Type::SignedSmall(), Type::UnsignedSmall(), | 306 Type* types[] = {Type::Signed31(), Type::Unsigned30(), Type::Negative32(), |
310 Type::NegativeSigned32(), Type::NonNegativeSigned32(), | 307 Type::Unsigned31(), Type::Unsigned32(), Type::Signed32(), |
311 Type::Unsigned32(), Type::Signed32(), | 308 Type::MinusZero(), Type::NaN(), Type::Undefined(), |
312 Type::MinusZero(), Type::NaN(), | 309 Type::Null(), Type::Boolean(), Type::Number(), |
313 Type::Undefined(), Type::Null(), | 310 Type::PlainNumber(), Type::String()}; |
314 Type::Boolean(), Type::Number(), | |
315 Type::PlainNumber(), Type::String()}; | |
316 | 311 |
317 for (size_t i = 0; i < arraysize(types); ++i) { | 312 for (size_t i = 0; i < arraysize(types); ++i) { |
318 Node* p0 = R.Parameter(types[i], 0); | 313 Node* p0 = R.Parameter(types[i], 0); |
319 | 314 |
320 for (size_t j = 0; j < arraysize(types); ++j) { | 315 for (size_t j = 0; j < arraysize(types); ++j) { |
321 Node* p1 = R.Parameter(types[j], 1); | 316 Node* p1 = R.Parameter(types[j], 1); |
322 | 317 |
323 for (int k = 0; k < R.kNumberOps; k += 2) { | 318 for (int k = 0; k < R.kNumberOps; k += 2) { |
324 Node* add = R.Binop(R.ops[k], p0, p1); | 319 Node* add = R.Binop(R.ops[k], p0, p1); |
325 Node* r = R.reduce(add); | 320 Node* r = R.reduce(add); |
(...skipping 39 matching lines...) Loading... | |
365 ops[idx] = op; | 360 ops[idx] = op; |
366 signedness[idx] = s; | 361 signedness[idx] = s; |
367 } | 362 } |
368 }; | 363 }; |
369 | 364 |
370 | 365 |
371 TEST(Int32BitwiseBinops) { | 366 TEST(Int32BitwiseBinops) { |
372 JSBitwiseTypedLoweringTester R; | 367 JSBitwiseTypedLoweringTester R; |
373 | 368 |
374 Type* types[] = { | 369 Type* types[] = { |
375 Type::SignedSmall(), Type::UnsignedSmall(), Type::Unsigned32(), | 370 Type::Signed31(), Type::Unsigned30(), Type::Unsigned32(), |
376 Type::Signed32(), Type::MinusZero(), Type::NaN(), | 371 Type::Signed32(), Type::MinusZero(), Type::NaN(), |
377 Type::OrderedNumber(), Type::PlainNumber(), Type::Undefined(), | 372 Type::OrderedNumber(), Type::PlainNumber(), Type::Undefined(), |
378 Type::Null(), Type::Boolean(), Type::Number(), | 373 Type::Null(), Type::Boolean(), Type::Number(), |
379 Type::String()}; | 374 Type::String()}; |
380 | 375 |
381 for (size_t i = 0; i < arraysize(types); ++i) { | 376 for (size_t i = 0; i < arraysize(types); ++i) { |
382 Node* p0 = R.Parameter(types[i], 0); | 377 Node* p0 = R.Parameter(types[i], 0); |
383 | 378 |
384 for (size_t j = 0; j < arraysize(types); ++j) { | 379 for (size_t j = 0; j < arraysize(types); ++j) { |
385 Node* p1 = R.Parameter(types[j], 1); | 380 Node* p1 = R.Parameter(types[j], 1); |
386 | 381 |
387 for (int k = 0; k < R.kNumberOps; k += 2) { | 382 for (int k = 0; k < R.kNumberOps; k += 2) { |
388 Node* add = R.Binop(R.ops[k], p0, p1); | 383 Node* add = R.Binop(R.ops[k], p0, p1); |
(...skipping 471 matching lines...) Loading... | |
860 Node* r = n->InputAt(0); | 855 Node* r = n->InputAt(0); |
861 R->CheckPureBinop(expected, r); | 856 R->CheckPureBinop(expected, r); |
862 } | 857 } |
863 } | 858 } |
864 } | 859 } |
865 | 860 |
866 | 861 |
867 TEST(EqualityForNumbers) { | 862 TEST(EqualityForNumbers) { |
868 JSTypedLoweringTester R; | 863 JSTypedLoweringTester R; |
869 | 864 |
870 Type* simple_number_types[] = {Type::UnsignedSmall(), Type::SignedSmall(), | 865 Type* simple_number_types[] = {Type::Unsigned30(), Type::Signed31(), |
871 Type::Signed32(), Type::Unsigned32(), | 866 Type::Signed32(), Type::Unsigned32(), |
872 Type::Number()}; | 867 Type::Number()}; |
873 | 868 |
874 | 869 |
875 for (size_t i = 0; i < arraysize(simple_number_types); ++i) { | 870 for (size_t i = 0; i < arraysize(simple_number_types); ++i) { |
876 Node* p0 = R.Parameter(simple_number_types[i], 0); | 871 Node* p0 = R.Parameter(simple_number_types[i], 0); |
877 | 872 |
878 for (size_t j = 0; j < arraysize(simple_number_types); ++j) { | 873 for (size_t j = 0; j < arraysize(simple_number_types); ++j) { |
879 Node* p1 = R.Parameter(simple_number_types[j], 1); | 874 Node* p1 = R.Parameter(simple_number_types[j], 1); |
880 | 875 |
(...skipping 376 matching lines...) Loading... | |
1257 CHECK_EQ(p1, r->InputAt(0)); | 1252 CHECK_EQ(p1, r->InputAt(0)); |
1258 CHECK_EQ(p0, r->InputAt(1)); | 1253 CHECK_EQ(p0, r->InputAt(1)); |
1259 } else { | 1254 } else { |
1260 CHECK_EQ(p0, r->InputAt(0)); | 1255 CHECK_EQ(p0, r->InputAt(0)); |
1261 CHECK_EQ(p1, r->InputAt(1)); | 1256 CHECK_EQ(p1, r->InputAt(1)); |
1262 } | 1257 } |
1263 } | 1258 } |
1264 } | 1259 } |
1265 } | 1260 } |
1266 } | 1261 } |
OLD | NEW |