Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: test/cctest/compiler/test-js-typed-lowering.cc

Issue 591373003: Move test for reduction of Math.imul to unittest. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Benedikt. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/js-builtin-reducer-unittest.cc ('k') | testing/gtest-support.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(), 167 Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(),
168 Type::OtherUnsigned32(), Type::OtherSigned32(), Type::SignedSmall(), 168 Type::OtherUnsigned32(), Type::OtherSigned32(), Type::SignedSmall(),
169 Type::Signed32(), Type::Unsigned32(), Type::Integral32()}; 169 Type::Signed32(), Type::Unsigned32(), Type::Integral32()};
170 170
171 171
172 static Type* kNumberTypes[] = { 172 static Type* kNumberTypes[] = {
173 Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(), 173 Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(),
174 Type::OtherUnsigned32(), Type::OtherSigned32(), Type::SignedSmall(), 174 Type::OtherUnsigned32(), Type::OtherSigned32(), Type::SignedSmall(),
175 Type::Signed32(), Type::Unsigned32(), Type::Integral32(), 175 Type::Signed32(), Type::Unsigned32(), Type::Integral32(),
176 Type::MinusZero(), Type::NaN(), Type::OtherNumber(), 176 Type::MinusZero(), Type::NaN(), Type::OtherNumber(),
177 Type::Number()}; 177 Type::OrderedNumber(), Type::Number()};
178 178
179 179
180 static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), 180 static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(),
181 Type::Number(), Type::String(), Type::Object()}; 181 Type::Number(), Type::String(), Type::Object()};
182 182
183 183
184 static Type* I32Type(bool is_signed) { 184 static Type* I32Type(bool is_signed) {
185 return is_signed ? Type::Signed32() : Type::Unsigned32(); 185 return is_signed ? Type::Signed32() : Type::Unsigned32();
186 } 186 }
187 187
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 CHECK_EQ(IrOpcode::kPhi, r->opcode()); 1418 CHECK_EQ(IrOpcode::kPhi, r->opcode());
1419 CHECK(p0 == r->InputAt(0) || p1 == r->InputAt(0)); 1419 CHECK(p0 == r->InputAt(0) || p1 == r->InputAt(0));
1420 CHECK(p1 == r->InputAt(1) || p0 == r->InputAt(1)); 1420 CHECK(p1 == r->InputAt(1) || p0 == r->InputAt(1));
1421 } else { 1421 } else {
1422 CHECK_EQ(IrOpcode::kJSCallFunction, r->opcode()); 1422 CHECK_EQ(IrOpcode::kJSCallFunction, r->opcode());
1423 CHECK_EQ(call, r); 1423 CHECK_EQ(call, r);
1424 } 1424 }
1425 } 1425 }
1426 } 1426 }
1427 } 1427 }
1428
1429
1430 TEST(BuiltinMathImul) {
1431 JSTypedLoweringTester R;
1432
1433 for (size_t i = 0; i < arraysize(kNumberTypes); i++) {
1434 for (size_t j = 0; j < arraysize(kNumberTypes); j++) {
1435 Type* t0 = kNumberTypes[i];
1436 Node* p0 = R.Parameter(t0, 0);
1437 Type* t1 = kNumberTypes[j];
1438 Node* p1 = R.Parameter(t1, 1);
1439 Node* fun = R.HeapConstant(handle(R.isolate->context()->math_imul_fun()));
1440 Node* call = R.graph.NewNode(R.javascript.Call(4, NO_CALL_FUNCTION_FLAGS),
1441 fun, R.UndefinedConstant(), p0, p1);
1442 Node* r = R.reduce(call);
1443
1444 if (t0->Is(Type::Integral32()) && t1->Is(Type::Integral32())) {
1445 R.CheckPureBinop(R.machine.Int32Mul(), r);
1446 CHECK_EQ(p0, r->InputAt(0));
1447 CHECK_EQ(p1, r->InputAt(1));
1448 } else {
1449 CHECK_EQ(IrOpcode::kJSCallFunction, r->opcode());
1450 CHECK_EQ(call, r);
1451 }
1452 }
1453 }
1454 }
OLDNEW
« no previous file with comments | « src/compiler/js-builtin-reducer-unittest.cc ('k') | testing/gtest-support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698