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

Side by Side Diff: test/unittests/compiler/js-builtin-reducer-unittest.cc

Issue 819103002: [turbofan] Minor cleanup to reduce code duplication. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 12 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
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/js-builtin-reducer.h" 5 #include "src/compiler/js-builtin-reducer.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/node-properties-inl.h" 7 #include "src/compiler/node-properties-inl.h"
8 #include "src/compiler/typer.h" 8 #include "src/compiler/typer.h"
9 #include "test/unittests/compiler/graph-unittest.h" 9 #include "test/unittests/compiler/graph-unittest.h"
10 #include "test/unittests/compiler/node-test-utils.h" 10 #include "test/unittests/compiler/node-test-utils.h"
(...skipping 11 matching lines...) Expand all
22 22
23 protected: 23 protected:
24 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = 24 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags =
25 MachineOperatorBuilder::Flag::kNoFlags) { 25 MachineOperatorBuilder::Flag::kNoFlags) {
26 MachineOperatorBuilder machine(zone(), kMachPtr, flags); 26 MachineOperatorBuilder machine(zone(), kMachPtr, flags);
27 JSGraph jsgraph(graph(), common(), javascript(), &machine); 27 JSGraph jsgraph(graph(), common(), javascript(), &machine);
28 JSBuiltinReducer reducer(&jsgraph); 28 JSBuiltinReducer reducer(&jsgraph);
29 return reducer.Reduce(node); 29 return reducer.Reduce(node);
30 } 30 }
31 31
32 Node* Parameter(Type* t, int32_t index = 0) {
33 Node* n = graph()->NewNode(common()->Parameter(index), graph()->start());
34 NodeProperties::SetBounds(n, Bounds(Type::None(), t));
35 return n;
36 }
37
38 Handle<JSFunction> MathFunction(const char* name) { 32 Handle<JSFunction> MathFunction(const char* name) {
39 Handle<Object> m = 33 Handle<Object> m =
40 JSObject::GetProperty(isolate()->global_object(), 34 JSObject::GetProperty(isolate()->global_object(),
41 isolate()->factory()->NewStringFromAsciiChecked( 35 isolate()->factory()->NewStringFromAsciiChecked(
42 "Math")).ToHandleChecked(); 36 "Math")).ToHandleChecked();
43 Handle<JSFunction> f = Handle<JSFunction>::cast( 37 Handle<JSFunction> f = Handle<JSFunction>::cast(
44 JSObject::GetProperty( 38 JSObject::GetProperty(
45 m, isolate()->factory()->NewStringFromAsciiChecked(name)) 39 m, isolate()->factory()->NewStringFromAsciiChecked(name))
46 .ToHandleChecked()); 40 .ToHandleChecked());
47 return f; 41 return f;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 graph()->NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), 291 graph()->NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS),
298 fun, UndefinedConstant(), p0); 292 fun, UndefinedConstant(), p0);
299 Reduction r = Reduce(call, MachineOperatorBuilder::Flag::kNoFlags); 293 Reduction r = Reduce(call, MachineOperatorBuilder::Flag::kNoFlags);
300 294
301 ASSERT_FALSE(r.Changed()); 295 ASSERT_FALSE(r.Changed());
302 } 296 }
303 } 297 }
304 } // namespace compiler 298 } // namespace compiler
305 } // namespace internal 299 } // namespace internal
306 } // namespace v8 300 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/graph-unittest.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698