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

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

Issue 590993003: Extend JSBuiltinReducer to cover Math.max as well. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-js-typed-lowering.cc
diff --git a/test/cctest/compiler/test-js-typed-lowering.cc b/test/cctest/compiler/test-js-typed-lowering.cc
index d2c018f74002a05227edf857a8d1b1032edc6180..5dc32fb52785b68dd18aebbae86b769ed5cdcf75 100644
--- a/test/cctest/compiler/test-js-typed-lowering.cc
+++ b/test/cctest/compiler/test-js-typed-lowering.cc
@@ -1385,6 +1385,48 @@ TEST(Int32Comparisons) {
}
+TEST(BuiltinMathMax) {
+ JSTypedLoweringTester R;
+
+ Node* fun = R.HeapConstant(handle(R.isolate->context()->math_max_fun()));
+ Node* call = R.graph.NewNode(R.javascript.Call(2, NO_CALL_FUNCTION_FLAGS),
+ fun, R.UndefinedConstant());
+ Node* r = R.reduce(call);
+ R.CheckNumberConstant(-V8_INFINITY, r);
+
+ for (size_t i = 0; i < arraysize(kNumberTypes); i++) {
+ Type* t0 = kNumberTypes[i];
+ Node* p0 = R.Parameter(t0, 0);
+ Node* call = R.graph.NewNode(R.javascript.Call(3, NO_CALL_FUNCTION_FLAGS),
+ fun, R.UndefinedConstant(), p0);
+ Node* r = R.reduce(call);
+ CHECK_EQ(IrOpcode::kParameter, r->opcode());
+ CHECK_EQ(p0, r);
+ }
+
+ for (size_t i = 0; i < arraysize(kNumberTypes); i++) {
+ for (size_t j = 0; j < arraysize(kNumberTypes); j++) {
+ Type* t0 = kNumberTypes[i];
+ Node* p0 = R.Parameter(t0, 0);
+ Type* t1 = kNumberTypes[j];
+ Node* p1 = R.Parameter(t1, 1);
+ Node* call = R.graph.NewNode(R.javascript.Call(4, NO_CALL_FUNCTION_FLAGS),
+ fun, R.UndefinedConstant(), p0, p1);
+ Node* r = R.reduce(call);
+
+ if (t0->Is(Type::Integral32()) && t1->Is(Type::Integral32())) {
+ CHECK_EQ(IrOpcode::kPhi, r->opcode());
+ CHECK(p0 == r->InputAt(0) || p1 == r->InputAt(0));
+ CHECK(p1 == r->InputAt(1) || p0 == r->InputAt(1));
+ } else {
+ CHECK_EQ(IrOpcode::kJSCallFunction, r->opcode());
+ CHECK_EQ(call, r);
+ }
+ }
+ }
+}
+
+
TEST(BuiltinMathImul) {
JSTypedLoweringTester R;
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698