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/v8.h" | 5 #include "src/v8.h" |
6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/compiler/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 static Type* I32Type(bool is_signed) { | 179 static Type* I32Type(bool is_signed) { |
180 return is_signed ? Type::Signed32() : Type::Unsigned32(); | 180 return is_signed ? Type::Signed32() : Type::Unsigned32(); |
181 } | 181 } |
182 | 182 |
183 | 183 |
184 static IrOpcode::Value NumberToI32(bool is_signed) { | 184 static IrOpcode::Value NumberToI32(bool is_signed) { |
185 return is_signed ? IrOpcode::kNumberToInt32 : IrOpcode::kNumberToUint32; | 185 return is_signed ? IrOpcode::kNumberToInt32 : IrOpcode::kNumberToUint32; |
186 } | 186 } |
187 | 187 |
188 | 188 |
| 189 // TODO(turbofan): Lowering of StringAdd is disabled for now. |
| 190 #if 0 |
189 TEST(StringBinops) { | 191 TEST(StringBinops) { |
190 JSTypedLoweringTester R; | 192 JSTypedLoweringTester R; |
191 | 193 |
192 for (size_t i = 0; i < arraysize(kStringTypes); ++i) { | 194 for (size_t i = 0; i < arraysize(kStringTypes); ++i) { |
193 Node* p0 = R.Parameter(kStringTypes[i], 0); | 195 Node* p0 = R.Parameter(kStringTypes[i], 0); |
194 | 196 |
195 for (size_t j = 0; j < arraysize(kStringTypes); ++j) { | 197 for (size_t j = 0; j < arraysize(kStringTypes); ++j) { |
196 Node* p1 = R.Parameter(kStringTypes[j], 1); | 198 Node* p1 = R.Parameter(kStringTypes[j], 1); |
197 | 199 |
198 Node* add = R.Binop(R.javascript.Add(), p0, p1); | 200 Node* add = R.Binop(R.javascript.Add(), p0, p1); |
199 Node* r = R.reduce(add); | 201 Node* r = R.reduce(add); |
200 | 202 |
201 R.CheckPureBinop(IrOpcode::kStringAdd, r); | 203 R.CheckPureBinop(IrOpcode::kStringAdd, r); |
202 CHECK_EQ(p0, r->InputAt(0)); | 204 CHECK_EQ(p0, r->InputAt(0)); |
203 CHECK_EQ(p1, r->InputAt(1)); | 205 CHECK_EQ(p1, r->InputAt(1)); |
204 } | 206 } |
205 } | 207 } |
206 } | 208 } |
| 209 #endif |
207 | 210 |
208 | 211 |
209 TEST(AddNumber1) { | 212 TEST(AddNumber1) { |
210 JSTypedLoweringTester R; | 213 JSTypedLoweringTester R; |
211 for (size_t i = 0; i < arraysize(kNumberTypes); ++i) { | 214 for (size_t i = 0; i < arraysize(kNumberTypes); ++i) { |
212 Node* p0 = R.Parameter(kNumberTypes[i], 0); | 215 Node* p0 = R.Parameter(kNumberTypes[i], 0); |
213 Node* p1 = R.Parameter(kNumberTypes[i], 1); | 216 Node* p1 = R.Parameter(kNumberTypes[i], 1); |
214 Node* add = R.Binop(R.javascript.Add(), p0, p1); | 217 Node* add = R.Binop(R.javascript.Add(), p0, p1); |
215 Node* r = R.reduce(add); | 218 Node* r = R.reduce(add); |
216 | 219 |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 CHECK_EQ(p1, r->InputAt(0)); | 1367 CHECK_EQ(p1, r->InputAt(0)); |
1365 CHECK_EQ(p0, r->InputAt(1)); | 1368 CHECK_EQ(p0, r->InputAt(1)); |
1366 } else { | 1369 } else { |
1367 CHECK_EQ(p0, r->InputAt(0)); | 1370 CHECK_EQ(p0, r->InputAt(0)); |
1368 CHECK_EQ(p1, r->InputAt(1)); | 1371 CHECK_EQ(p1, r->InputAt(1)); |
1369 } | 1372 } |
1370 } | 1373 } |
1371 } | 1374 } |
1372 } | 1375 } |
1373 } | 1376 } |
OLD | NEW |