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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 CHECK_EQ(IrOpcode::kHeapConstant, result->opcode()); | 164 CHECK_EQ(IrOpcode::kHeapConstant, result->opcode()); |
165 Handle<Object> value = OpParameter<Unique<Object> >(result).handle(); | 165 Handle<Object> value = OpParameter<Unique<Object> >(result).handle(); |
166 CHECK_EQ(*expected, *value); | 166 CHECK_EQ(*expected, *value); |
167 } | 167 } |
168 }; | 168 }; |
169 | 169 |
170 static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(), | 170 static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(), |
171 Type::String()}; | 171 Type::String()}; |
172 | 172 |
173 | 173 |
174 static Type* kInt32Types[] = { | 174 static Type* kInt32Types[] = {Type::UnsignedSmall(), Type::Negative32(), |
175 Type::UnsignedSmall(), Type::NegativeSigned32(), | 175 Type::Unsigned31(), Type::SignedSmall(), |
176 Type::NonNegativeSigned32(), Type::SignedSmall(), | 176 Type::Signed32(), Type::Unsigned32(), |
177 Type::Signed32(), Type::Unsigned32(), | 177 Type::Integral32()}; |
178 Type::Integral32()}; | |
179 | 178 |
180 | 179 |
181 static Type* kNumberTypes[] = { | 180 static Type* kNumberTypes[] = { |
182 Type::UnsignedSmall(), Type::NegativeSigned32(), | 181 Type::UnsignedSmall(), Type::Negative32(), Type::Unsigned31(), |
183 Type::NonNegativeSigned32(), Type::SignedSmall(), | 182 Type::SignedSmall(), Type::Signed32(), Type::Unsigned32(), |
184 Type::Signed32(), Type::Unsigned32(), | 183 Type::Integral32(), Type::MinusZero(), Type::NaN(), |
185 Type::Integral32(), Type::MinusZero(), | 184 Type::OrderedNumber(), Type::PlainNumber(), Type::Number()}; |
186 Type::NaN(), Type::OrderedNumber(), | |
187 Type::PlainNumber(), Type::Number()}; | |
188 | 185 |
189 | 186 |
190 static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), | 187 static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), |
191 Type::Number(), Type::String(), Type::Object()}; | 188 Type::Number(), Type::String(), Type::Object()}; |
192 | 189 |
193 | 190 |
194 static Type* I32Type(bool is_signed) { | 191 static Type* I32Type(bool is_signed) { |
195 return is_signed ? Type::Signed32() : Type::Unsigned32(); | 192 return is_signed ? Type::Signed32() : Type::Unsigned32(); |
196 } | 193 } |
197 | 194 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 void set(int idx, const Operator* op, bool s) { | 301 void set(int idx, const Operator* op, bool s) { |
305 ops[idx] = op; | 302 ops[idx] = op; |
306 signedness[idx] = s; | 303 signedness[idx] = s; |
307 } | 304 } |
308 }; | 305 }; |
309 | 306 |
310 | 307 |
311 TEST(Int32BitwiseShifts) { | 308 TEST(Int32BitwiseShifts) { |
312 JSBitwiseShiftTypedLoweringTester R; | 309 JSBitwiseShiftTypedLoweringTester R; |
313 | 310 |
314 Type* types[] = {Type::SignedSmall(), Type::UnsignedSmall(), | 311 Type* types[] = { |
315 Type::NegativeSigned32(), Type::NonNegativeSigned32(), | 312 Type::SignedSmall(), Type::UnsignedSmall(), Type::Negative32(), |
316 Type::Unsigned32(), Type::Signed32(), | 313 Type::Unsigned31(), Type::Unsigned32(), Type::Signed32(), |
317 Type::MinusZero(), Type::NaN(), | 314 Type::MinusZero(), Type::NaN(), Type::Undefined(), |
318 Type::Undefined(), Type::Null(), | 315 Type::Null(), Type::Boolean(), Type::Number(), |
319 Type::Boolean(), Type::Number(), | 316 Type::PlainNumber(), Type::String()}; |
320 Type::PlainNumber(), Type::String()}; | |
321 | 317 |
322 for (size_t i = 0; i < arraysize(types); ++i) { | 318 for (size_t i = 0; i < arraysize(types); ++i) { |
323 Node* p0 = R.Parameter(types[i], 0); | 319 Node* p0 = R.Parameter(types[i], 0); |
324 | 320 |
325 for (size_t j = 0; j < arraysize(types); ++j) { | 321 for (size_t j = 0; j < arraysize(types); ++j) { |
326 Node* p1 = R.Parameter(types[j], 1); | 322 Node* p1 = R.Parameter(types[j], 1); |
327 | 323 |
328 for (int k = 0; k < R.kNumberOps; k += 2) { | 324 for (int k = 0; k < R.kNumberOps; k += 2) { |
329 Node* add = R.Binop(R.ops[k], p0, p1); | 325 Node* add = R.Binop(R.ops[k], p0, p1); |
330 Node* r = R.reduce(add); | 326 Node* r = R.reduce(add); |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 CHECK_EQ(p1, r->InputAt(0)); | 1271 CHECK_EQ(p1, r->InputAt(0)); |
1276 CHECK_EQ(p0, r->InputAt(1)); | 1272 CHECK_EQ(p0, r->InputAt(1)); |
1277 } else { | 1273 } else { |
1278 CHECK_EQ(p0, r->InputAt(0)); | 1274 CHECK_EQ(p0, r->InputAt(0)); |
1279 CHECK_EQ(p1, r->InputAt(1)); | 1275 CHECK_EQ(p1, r->InputAt(1)); |
1280 } | 1276 } |
1281 } | 1277 } |
1282 } | 1278 } |
1283 } | 1279 } |
1284 } | 1280 } |
OLD | NEW |