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

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

Issue 2025573003: [turbofan] Remove eager frame state from call nodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_turbofan-checkpoint-1
Patch Set: Rebased. Created 4 years, 6 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
« no previous file with comments | « src/compiler/operator-properties.cc ('k') | no next file » | 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/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.h" 7 #include "src/compiler/node-properties.h"
8 #include "src/compiler/simplified-operator.h" 8 #include "src/compiler/simplified-operator.h"
9 #include "src/compiler/typer.h" 9 #include "src/compiler/typer.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 TEST_F(JSBuiltinReducerTest, MathMax0) { 80 TEST_F(JSBuiltinReducerTest, MathMax0) {
81 Node* function = MathFunction("max"); 81 Node* function = MathFunction("max");
82 82
83 Node* effect = graph()->start(); 83 Node* effect = graph()->start();
84 Node* control = graph()->start(); 84 Node* control = graph()->start();
85 Node* context = UndefinedConstant(); 85 Node* context = UndefinedConstant();
86 Node* frame_state = graph()->start(); 86 Node* frame_state = graph()->start();
87 Node* call = graph()->NewNode(javascript()->CallFunction(2), function, 87 Node* call = graph()->NewNode(javascript()->CallFunction(2), function,
88 UndefinedConstant(), context, frame_state, 88 UndefinedConstant(), context, frame_state,
89 frame_state, effect, control); 89 effect, control);
90 Reduction r = Reduce(call); 90 Reduction r = Reduce(call);
91 91
92 ASSERT_TRUE(r.Changed()); 92 ASSERT_TRUE(r.Changed());
93 EXPECT_THAT(r.replacement(), IsNumberConstant(-V8_INFINITY)); 93 EXPECT_THAT(r.replacement(), IsNumberConstant(-V8_INFINITY));
94 } 94 }
95 95
96 96
97 TEST_F(JSBuiltinReducerTest, MathMax1) { 97 TEST_F(JSBuiltinReducerTest, MathMax1) {
98 Node* function = MathFunction("max"); 98 Node* function = MathFunction("max");
99 99
100 Node* effect = graph()->start(); 100 Node* effect = graph()->start();
101 Node* control = graph()->start(); 101 Node* control = graph()->start();
102 Node* context = UndefinedConstant(); 102 Node* context = UndefinedConstant();
103 Node* frame_state = graph()->start(); 103 Node* frame_state = graph()->start();
104 TRACED_FOREACH(Type*, t0, kNumberTypes) { 104 TRACED_FOREACH(Type*, t0, kNumberTypes) {
105 Node* p0 = Parameter(t0, 0); 105 Node* p0 = Parameter(t0, 0);
106 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 106 Node* call = graph()->NewNode(javascript()->CallFunction(3), function,
107 UndefinedConstant(), p0, context, frame_state, 107 UndefinedConstant(), p0, context, frame_state,
108 frame_state, effect, control); 108 effect, control);
109 Reduction r = Reduce(call); 109 Reduction r = Reduce(call);
110 110
111 ASSERT_TRUE(r.Changed()); 111 ASSERT_TRUE(r.Changed());
112 EXPECT_THAT(r.replacement(), p0); 112 EXPECT_THAT(r.replacement(), p0);
113 } 113 }
114 } 114 }
115 115
116 116
117 TEST_F(JSBuiltinReducerTest, MathMax2) { 117 TEST_F(JSBuiltinReducerTest, MathMax2) {
118 Node* function = MathFunction("max"); 118 Node* function = MathFunction("max");
119 119
120 Node* effect = graph()->start(); 120 Node* effect = graph()->start();
121 Node* control = graph()->start(); 121 Node* control = graph()->start();
122 Node* context = UndefinedConstant(); 122 Node* context = UndefinedConstant();
123 Node* frame_state = graph()->start(); 123 Node* frame_state = graph()->start();
124 TRACED_FOREACH(Type*, t0, kIntegral32Types) { 124 TRACED_FOREACH(Type*, t0, kIntegral32Types) {
125 TRACED_FOREACH(Type*, t1, kIntegral32Types) { 125 TRACED_FOREACH(Type*, t1, kIntegral32Types) {
126 Node* p0 = Parameter(t0, 0); 126 Node* p0 = Parameter(t0, 0);
127 Node* p1 = Parameter(t1, 1); 127 Node* p1 = Parameter(t1, 1);
128 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 128 Node* call = graph()->NewNode(javascript()->CallFunction(4), function,
129 UndefinedConstant(), p0, p1, context, 129 UndefinedConstant(), p0, p1, context,
130 frame_state, frame_state, effect, control); 130 frame_state, effect, control);
131 Reduction r = Reduce(call); 131 Reduction r = Reduce(call);
132 132
133 ASSERT_TRUE(r.Changed()); 133 ASSERT_TRUE(r.Changed());
134 EXPECT_THAT(r.replacement(), IsSelect(MachineRepresentation::kNone, 134 EXPECT_THAT(r.replacement(), IsSelect(MachineRepresentation::kNone,
135 IsNumberLessThan(p1, p0), p0, p1)); 135 IsNumberLessThan(p1, p0), p0, p1));
136 } 136 }
137 } 137 }
138 } 138 }
139 139
140 140
141 // ----------------------------------------------------------------------------- 141 // -----------------------------------------------------------------------------
142 // Math.imul 142 // Math.imul
143 143
144 144
145 TEST_F(JSBuiltinReducerTest, MathImul) { 145 TEST_F(JSBuiltinReducerTest, MathImul) {
146 Node* function = MathFunction("imul"); 146 Node* function = MathFunction("imul");
147 147
148 Node* effect = graph()->start(); 148 Node* effect = graph()->start();
149 Node* control = graph()->start(); 149 Node* control = graph()->start();
150 Node* context = UndefinedConstant(); 150 Node* context = UndefinedConstant();
151 Node* frame_state = graph()->start(); 151 Node* frame_state = graph()->start();
152 TRACED_FOREACH(Type*, t0, kNumberTypes) { 152 TRACED_FOREACH(Type*, t0, kNumberTypes) {
153 TRACED_FOREACH(Type*, t1, kNumberTypes) { 153 TRACED_FOREACH(Type*, t1, kNumberTypes) {
154 Node* p0 = Parameter(t0, 0); 154 Node* p0 = Parameter(t0, 0);
155 Node* p1 = Parameter(t1, 1); 155 Node* p1 = Parameter(t1, 1);
156 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 156 Node* call = graph()->NewNode(javascript()->CallFunction(4), function,
157 UndefinedConstant(), p0, p1, context, 157 UndefinedConstant(), p0, p1, context,
158 frame_state, frame_state, effect, control); 158 frame_state, effect, control);
159 Reduction r = Reduce(call); 159 Reduction r = Reduce(call);
160 160
161 ASSERT_TRUE(r.Changed()); 161 ASSERT_TRUE(r.Changed());
162 EXPECT_THAT(r.replacement(), 162 EXPECT_THAT(r.replacement(),
163 IsNumberImul(IsNumberToUint32(p0), IsNumberToUint32(p1))); 163 IsNumberImul(IsNumberToUint32(p0), IsNumberToUint32(p1)));
164 } 164 }
165 } 165 }
166 } 166 }
167 167
168 168
169 // ----------------------------------------------------------------------------- 169 // -----------------------------------------------------------------------------
170 // Math.fround 170 // Math.fround
171 171
172 172
173 TEST_F(JSBuiltinReducerTest, MathFround) { 173 TEST_F(JSBuiltinReducerTest, MathFround) {
174 Node* function = MathFunction("fround"); 174 Node* function = MathFunction("fround");
175 175
176 Node* effect = graph()->start(); 176 Node* effect = graph()->start();
177 Node* control = graph()->start(); 177 Node* control = graph()->start();
178 Node* context = UndefinedConstant(); 178 Node* context = UndefinedConstant();
179 Node* frame_state = graph()->start(); 179 Node* frame_state = graph()->start();
180 TRACED_FOREACH(Type*, t0, kNumberTypes) { 180 TRACED_FOREACH(Type*, t0, kNumberTypes) {
181 Node* p0 = Parameter(t0, 0); 181 Node* p0 = Parameter(t0, 0);
182 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 182 Node* call = graph()->NewNode(javascript()->CallFunction(3), function,
183 UndefinedConstant(), p0, context, frame_state, 183 UndefinedConstant(), p0, context, frame_state,
184 frame_state, effect, control); 184 effect, control);
185 Reduction r = Reduce(call); 185 Reduction r = Reduce(call);
186 186
187 ASSERT_TRUE(r.Changed()); 187 ASSERT_TRUE(r.Changed());
188 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0)); 188 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0));
189 } 189 }
190 } 190 }
191 191
192 } // namespace compiler 192 } // namespace compiler
193 } // namespace internal 193 } // namespace internal
194 } // namespace v8 194 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/operator-properties.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698