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

Side by Side Diff: test/cctest/compiler/test-machine-operator-reducer.cc

Issue 552653003: [turbofan] Fix the node matchers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address nit. 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
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 "test/cctest/cctest.h" 5 #include "test/cctest/cctest.h"
6 6
7 #include "src/base/utils/random-number-generator.h" 7 #include "src/base/utils/random-number-generator.h"
8 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/machine-operator-reducer.h" 10 #include "src/compiler/machine-operator-reducer.h"
(...skipping 12 matching lines...) Expand all
23 return common->Int32Constant(value); 23 return common->Int32Constant(value);
24 } 24 }
25 25
26 template <> 26 template <>
27 Operator* NewConstantOperator<double>(CommonOperatorBuilder* common, 27 Operator* NewConstantOperator<double>(CommonOperatorBuilder* common,
28 volatile double value) { 28 volatile double value) {
29 return common->Float64Constant(value); 29 return common->Float64Constant(value);
30 } 30 }
31 31
32 32
33 template <typename T>
34 T ValueOfOperator(const Operator* op);
35
36 template <>
37 int32_t ValueOfOperator<int32_t>(const Operator* op) {
38 CHECK_EQ(IrOpcode::kInt32Constant, op->opcode());
39 return OpParameter<int32_t>(op);
40 }
41
42 template <>
43 double ValueOfOperator<double>(const Operator* op) {
44 CHECK_EQ(IrOpcode::kFloat64Constant, op->opcode());
45 return OpParameter<double>(op);
46 }
47
48
33 class ReducerTester : public HandleAndZoneScope { 49 class ReducerTester : public HandleAndZoneScope {
34 public: 50 public:
35 explicit ReducerTester(int num_parameters = 0) 51 explicit ReducerTester(int num_parameters = 0)
36 : isolate(main_isolate()), 52 : isolate(main_isolate()),
37 binop(NULL), 53 binop(NULL),
38 unop(NULL), 54 unop(NULL),
39 machine(main_zone()), 55 machine(main_zone()),
40 common(main_zone()), 56 common(main_zone()),
41 graph(main_zone()), 57 graph(main_zone()),
42 typer(main_zone()), 58 typer(main_zone()),
(...skipping 11 matching lines...) Expand all
54 Graph graph; 70 Graph graph;
55 Typer typer; 71 Typer typer;
56 JSGraph jsgraph; 72 JSGraph jsgraph;
57 Node* maxuint32; 73 Node* maxuint32;
58 74
59 template <typename T> 75 template <typename T>
60 Node* Constant(volatile T value) { 76 Node* Constant(volatile T value) {
61 return graph.NewNode(NewConstantOperator<T>(&common, value)); 77 return graph.NewNode(NewConstantOperator<T>(&common, value));
62 } 78 }
63 79
80 template <typename T>
81 const T ValueOf(const Operator* op) {
82 return ValueOfOperator<T>(op);
83 }
84
64 // Check that the reduction of this binop applied to constants {a} and {b} 85 // Check that the reduction of this binop applied to constants {a} and {b}
65 // yields the {expect} value. 86 // yields the {expect} value.
66 template <typename T> 87 template <typename T>
67 void CheckFoldBinop(volatile T expect, volatile T a, volatile T b) { 88 void CheckFoldBinop(volatile T expect, volatile T a, volatile T b) {
68 CheckFoldBinop<T>(expect, Constant<T>(a), Constant<T>(b)); 89 CheckFoldBinop<T>(expect, Constant<T>(a), Constant<T>(b));
69 } 90 }
70 91
71 // Check that the reduction of this binop applied to {a} and {b} yields 92 // Check that the reduction of this binop applied to {a} and {b} yields
72 // the {expect} value. 93 // the {expect} value.
73 template <typename T> 94 template <typename T>
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 // TODO(titzer): test MachineOperatorReducer for Int64Mul 797 // TODO(titzer): test MachineOperatorReducer for Int64Mul
777 // TODO(titzer): test MachineOperatorReducer for Int64UMul 798 // TODO(titzer): test MachineOperatorReducer for Int64UMul
778 // TODO(titzer): test MachineOperatorReducer for Int64Div 799 // TODO(titzer): test MachineOperatorReducer for Int64Div
779 // TODO(titzer): test MachineOperatorReducer for Int64UDiv 800 // TODO(titzer): test MachineOperatorReducer for Int64UDiv
780 // TODO(titzer): test MachineOperatorReducer for Int64Mod 801 // TODO(titzer): test MachineOperatorReducer for Int64Mod
781 // TODO(titzer): test MachineOperatorReducer for Int64UMod 802 // TODO(titzer): test MachineOperatorReducer for Int64UMod
782 // TODO(titzer): test MachineOperatorReducer for Int64Neg 803 // TODO(titzer): test MachineOperatorReducer for Int64Neg
783 // TODO(titzer): test MachineOperatorReducer for ChangeInt32ToFloat64 804 // TODO(titzer): test MachineOperatorReducer for ChangeInt32ToFloat64
784 // TODO(titzer): test MachineOperatorReducer for ChangeFloat64ToInt32 805 // TODO(titzer): test MachineOperatorReducer for ChangeFloat64ToInt32
785 // TODO(titzer): test MachineOperatorReducer for Float64Compare 806 // TODO(titzer): test MachineOperatorReducer for Float64Compare
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-js-typed-lowering.cc ('k') | test/cctest/compiler/test-representation-change.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698