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

Unified Diff: src/compiler/js-builtin-reducer-unittest.cc

Issue 594183004: Extend JSBuiltinReducer to cover Math.fround as well. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | test/mjsunit/asm/math-fround.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-builtin-reducer-unittest.cc
diff --git a/src/compiler/js-builtin-reducer-unittest.cc b/src/compiler/js-builtin-reducer-unittest.cc
index 51561d0732665f15e067c6d3c7b29ee742621ffc..598a553f4e79ace4fd147d051b4efbb8dbfcaa51 100644
--- a/src/compiler/js-builtin-reducer-unittest.cc
+++ b/src/compiler/js-builtin-reducer-unittest.cc
@@ -172,6 +172,32 @@ TEST_F(JSBuiltinReducerTest, MathImul) {
}
}
+
+// -----------------------------------------------------------------------------
+// Math.fround
+
+
+TEST_F(JSBuiltinReducerTest, MathFround) {
+ Handle<Object> m =
+ JSObject::GetProperty(isolate()->global_object(),
+ isolate()->factory()->NewStringFromAsciiChecked(
+ "Math")).ToHandleChecked();
+ Handle<JSFunction> f = Handle<JSFunction>::cast(
+ JSObject::GetProperty(m, isolate()->factory()->NewStringFromAsciiChecked(
+ "fround")).ToHandleChecked());
+
+ TRACED_FOREACH(Type*, t0, kNumberTypes) {
+ Node* p0 = Parameter(t0, 0);
+ Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f));
+ Node* call = graph()->NewNode(javascript()->Call(3, NO_CALL_FUNCTION_FLAGS),
+ fun, UndefinedConstant(), p0);
+ Reduction r = Reduce(call);
+
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0));
+ }
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | test/mjsunit/asm/math-fround.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698