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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | test/mjsunit/asm/math-fround.js » ('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/compiler/graph-unittest.h" 5 #include "src/compiler/graph-unittest.h"
6 #include "src/compiler/js-builtin-reducer.h" 6 #include "src/compiler/js-builtin-reducer.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/node-properties-inl.h" 8 #include "src/compiler/node-properties-inl.h"
9 #include "src/compiler/typer.h" 9 #include "src/compiler/typer.h"
10 #include "testing/gmock-support.h" 10 #include "testing/gmock-support.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ASSERT_TRUE(r.Changed()); 165 ASSERT_TRUE(r.Changed());
166 EXPECT_THAT(r.replacement(), IsInt32Mul(p0, p1)); 166 EXPECT_THAT(r.replacement(), IsInt32Mul(p0, p1));
167 } else { 167 } else {
168 ASSERT_FALSE(r.Changed()); 168 ASSERT_FALSE(r.Changed());
169 EXPECT_EQ(IrOpcode::kJSCallFunction, call->opcode()); 169 EXPECT_EQ(IrOpcode::kJSCallFunction, call->opcode());
170 } 170 }
171 } 171 }
172 } 172 }
173 } 173 }
174 174
175
176 // -----------------------------------------------------------------------------
177 // Math.fround
178
179
180 TEST_F(JSBuiltinReducerTest, MathFround) {
181 Handle<Object> m =
182 JSObject::GetProperty(isolate()->global_object(),
183 isolate()->factory()->NewStringFromAsciiChecked(
184 "Math")).ToHandleChecked();
185 Handle<JSFunction> f = Handle<JSFunction>::cast(
186 JSObject::GetProperty(m, isolate()->factory()->NewStringFromAsciiChecked(
187 "fround")).ToHandleChecked());
188
189 TRACED_FOREACH(Type*, t0, kNumberTypes) {
190 Node* p0 = Parameter(t0, 0);
191 Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f));
192 Node* call = graph()->NewNode(javascript()->Call(3, NO_CALL_FUNCTION_FLAGS),
193 fun, UndefinedConstant(), p0);
194 Reduction r = Reduce(call);
195
196 ASSERT_TRUE(r.Changed());
197 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0));
198 }
199 }
200
175 } // namespace compiler 201 } // namespace compiler
176 } // namespace internal 202 } // namespace internal
177 } // namespace v8 203 } // namespace v8
OLDNEW
« 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