| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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[] = { |
| 170 Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(), | 170 Type::UnsignedSmall(), Type::NegativeSigned32(), |
| 171 Type::OtherUnsigned32(), Type::OtherSigned32(), Type::SignedSmall(), | 171 Type::NonNegativeSigned32(), Type::SignedSmall(), |
| 172 Type::Signed32(), Type::Unsigned32(), Type::Integral32()}; | 172 Type::Signed32(), Type::Unsigned32(), |
| 173 Type::Integral32()}; |
| 173 | 174 |
| 174 | 175 |
| 175 static Type* kNumberTypes[] = { | 176 static Type* kNumberTypes[] = { |
| 176 Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(), | 177 Type::UnsignedSmall(), Type::NegativeSigned32(), |
| 177 Type::OtherUnsigned32(), Type::OtherSigned32(), Type::SignedSmall(), | 178 Type::NonNegativeSigned32(), Type::SignedSmall(), |
| 178 Type::Signed32(), Type::Unsigned32(), Type::Integral32(), | 179 Type::Signed32(), Type::Unsigned32(), |
| 179 Type::MinusZero(), Type::NaN(), Type::OtherNumber(), | 180 Type::Integral32(), Type::MinusZero(), |
| 180 Type::OrderedNumber(), Type::Number()}; | 181 Type::NaN(), Type::OrderedNumber(), |
| 182 Type::PlainNumber(), Type::Number()}; |
| 181 | 183 |
| 182 | 184 |
| 183 static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), | 185 static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), |
| 184 Type::Number(), Type::String(), Type::Object()}; | 186 Type::Number(), Type::String(), Type::Object()}; |
| 185 | 187 |
| 186 | 188 |
| 187 static Type* I32Type(bool is_signed) { | 189 static Type* I32Type(bool is_signed) { |
| 188 return is_signed ? Type::Signed32() : Type::Unsigned32(); | 190 return is_signed ? Type::Signed32() : Type::Unsigned32(); |
| 189 } | 191 } |
| 190 | 192 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 void set(int idx, const Operator* op, bool s) { | 299 void set(int idx, const Operator* op, bool s) { |
| 298 ops[idx] = op; | 300 ops[idx] = op; |
| 299 signedness[idx] = s; | 301 signedness[idx] = s; |
| 300 } | 302 } |
| 301 }; | 303 }; |
| 302 | 304 |
| 303 | 305 |
| 304 TEST(Int32BitwiseShifts) { | 306 TEST(Int32BitwiseShifts) { |
| 305 JSBitwiseShiftTypedLoweringTester R; | 307 JSBitwiseShiftTypedLoweringTester R; |
| 306 | 308 |
| 307 Type* types[] = { | 309 Type* types[] = {Type::SignedSmall(), Type::UnsignedSmall(), |
| 308 Type::SignedSmall(), Type::UnsignedSmall(), Type::OtherSigned32(), | 310 Type::NegativeSigned32(), Type::NonNegativeSigned32(), |
| 309 Type::Unsigned32(), Type::Signed32(), Type::MinusZero(), | 311 Type::Unsigned32(), Type::Signed32(), |
| 310 Type::NaN(), Type::OtherNumber(), Type::Undefined(), | 312 Type::MinusZero(), Type::NaN(), |
| 311 Type::Null(), Type::Boolean(), Type::Number(), | 313 Type::Undefined(), Type::Null(), |
| 312 Type::String()}; | 314 Type::Boolean(), Type::Number(), |
| 315 Type::PlainNumber(), Type::String()}; |
| 313 | 316 |
| 314 for (size_t i = 0; i < arraysize(types); ++i) { | 317 for (size_t i = 0; i < arraysize(types); ++i) { |
| 315 Node* p0 = R.Parameter(types[i], 0); | 318 Node* p0 = R.Parameter(types[i], 0); |
| 316 | 319 |
| 317 for (size_t j = 0; j < arraysize(types); ++j) { | 320 for (size_t j = 0; j < arraysize(types); ++j) { |
| 318 Node* p1 = R.Parameter(types[j], 1); | 321 Node* p1 = R.Parameter(types[j], 1); |
| 319 | 322 |
| 320 for (int k = 0; k < R.kNumberOps; k += 2) { | 323 for (int k = 0; k < R.kNumberOps; k += 2) { |
| 321 Node* add = R.Binop(R.ops[k], p0, p1); | 324 Node* add = R.Binop(R.ops[k], p0, p1); |
| 322 Node* r = R.reduce(add); | 325 Node* r = R.reduce(add); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 ops[idx] = op; | 365 ops[idx] = op; |
| 363 signedness[idx] = s; | 366 signedness[idx] = s; |
| 364 } | 367 } |
| 365 }; | 368 }; |
| 366 | 369 |
| 367 | 370 |
| 368 TEST(Int32BitwiseBinops) { | 371 TEST(Int32BitwiseBinops) { |
| 369 JSBitwiseTypedLoweringTester R; | 372 JSBitwiseTypedLoweringTester R; |
| 370 | 373 |
| 371 Type* types[] = { | 374 Type* types[] = { |
| 372 Type::SignedSmall(), Type::UnsignedSmall(), Type::Unsigned32(), | 375 Type::SignedSmall(), Type::UnsignedSmall(), Type::Unsigned32(), |
| 373 Type::Signed32(), Type::MinusZero(), Type::NaN(), | 376 Type::Signed32(), Type::MinusZero(), Type::NaN(), |
| 374 Type::OtherNumber(), Type::Undefined(), Type::Null(), | 377 Type::OrderedNumber(), Type::PlainNumber(), Type::Undefined(), |
| 375 Type::Boolean(), Type::Number(), Type::String()}; | 378 Type::Null(), Type::Boolean(), Type::Number(), |
| 379 Type::String()}; |
| 376 | 380 |
| 377 for (size_t i = 0; i < arraysize(types); ++i) { | 381 for (size_t i = 0; i < arraysize(types); ++i) { |
| 378 Node* p0 = R.Parameter(types[i], 0); | 382 Node* p0 = R.Parameter(types[i], 0); |
| 379 | 383 |
| 380 for (size_t j = 0; j < arraysize(types); ++j) { | 384 for (size_t j = 0; j < arraysize(types); ++j) { |
| 381 Node* p1 = R.Parameter(types[j], 1); | 385 Node* p1 = R.Parameter(types[j], 1); |
| 382 | 386 |
| 383 for (int k = 0; k < R.kNumberOps; k += 2) { | 387 for (int k = 0; k < R.kNumberOps; k += 2) { |
| 384 Node* add = R.Binop(R.ops[k], p0, p1); | 388 Node* add = R.Binop(R.ops[k], p0, p1); |
| 385 Node* r = R.reduce(add); | 389 Node* r = R.reduce(add); |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 CHECK_EQ(p1, r->InputAt(0)); | 1298 CHECK_EQ(p1, r->InputAt(0)); |
| 1295 CHECK_EQ(p0, r->InputAt(1)); | 1299 CHECK_EQ(p0, r->InputAt(1)); |
| 1296 } else { | 1300 } else { |
| 1297 CHECK_EQ(p0, r->InputAt(0)); | 1301 CHECK_EQ(p0, r->InputAt(0)); |
| 1298 CHECK_EQ(p1, r->InputAt(1)); | 1302 CHECK_EQ(p1, r->InputAt(1)); |
| 1299 } | 1303 } |
| 1300 } | 1304 } |
| 1301 } | 1305 } |
| 1302 } | 1306 } |
| 1303 } | 1307 } |
| OLD | NEW |