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...) Expand 10 before | Expand all | Expand 10 after 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::UnsignedSmall(), Type::Negative32(), |
170 Type::UnsignedSmall(), Type::NegativeSigned32(), | 170 Type::Unsigned31(), Type::SignedSmall(), |
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::UnsignedSmall(), Type::Negative32(), Type::Unsigned31(), |
178 Type::NonNegativeSigned32(), Type::SignedSmall(), | 177 Type::SignedSmall(), 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...) Expand 10 before | Expand all | Expand 10 after 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[] = { |
310 Type::NegativeSigned32(), Type::NonNegativeSigned32(), | 307 Type::SignedSmall(), Type::UnsignedSmall(), Type::Negative32(), |
311 Type::Unsigned32(), Type::Signed32(), | 308 Type::Unsigned31(), Type::Unsigned32(), Type::Signed32(), |
312 Type::MinusZero(), Type::NaN(), | 309 Type::MinusZero(), Type::NaN(), Type::Undefined(), |
313 Type::Undefined(), Type::Null(), | 310 Type::Null(), Type::Boolean(), Type::Number(), |
314 Type::Boolean(), Type::Number(), | 311 Type::PlainNumber(), Type::String()}; |
315 Type::PlainNumber(), Type::String()}; | |
316 | 312 |
317 for (size_t i = 0; i < arraysize(types); ++i) { | 313 for (size_t i = 0; i < arraysize(types); ++i) { |
318 Node* p0 = R.Parameter(types[i], 0); | 314 Node* p0 = R.Parameter(types[i], 0); |
319 | 315 |
320 for (size_t j = 0; j < arraysize(types); ++j) { | 316 for (size_t j = 0; j < arraysize(types); ++j) { |
321 Node* p1 = R.Parameter(types[j], 1); | 317 Node* p1 = R.Parameter(types[j], 1); |
322 | 318 |
323 for (int k = 0; k < R.kNumberOps; k += 2) { | 319 for (int k = 0; k < R.kNumberOps; k += 2) { |
324 Node* add = R.Binop(R.ops[k], p0, p1); | 320 Node* add = R.Binop(R.ops[k], p0, p1); |
325 Node* r = R.reduce(add); | 321 Node* r = R.reduce(add); |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 CHECK_EQ(p1, r->InputAt(0)); | 1253 CHECK_EQ(p1, r->InputAt(0)); |
1258 CHECK_EQ(p0, r->InputAt(1)); | 1254 CHECK_EQ(p0, r->InputAt(1)); |
1259 } else { | 1255 } else { |
1260 CHECK_EQ(p0, r->InputAt(0)); | 1256 CHECK_EQ(p0, r->InputAt(0)); |
1261 CHECK_EQ(p1, r->InputAt(1)); | 1257 CHECK_EQ(p1, r->InputAt(1)); |
1262 } | 1258 } |
1263 } | 1259 } |
1264 } | 1260 } |
1265 } | 1261 } |
1266 } | 1262 } |
OLD | NEW |