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

Side by Side Diff: test/unittests/compiler/js-context-relaxation-unittest.cc

Issue 1709493002: [turbofan] Remove language mode from JSCall operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_strong-remove-2
Patch Set: Rebased. Created 4 years, 10 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 | « test/unittests/compiler/js-builtin-reducer-unittest.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-context-relaxation.h" 5 #include "src/compiler/js-context-relaxation.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "test/unittests/compiler/graph-unittest.h" 7 #include "test/unittests/compiler/graph-unittest.h"
8 #include "test/unittests/compiler/node-test-utils.h" 8 #include "test/unittests/compiler/node-test-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 TEST_F(JSContextRelaxationTest, 76 TEST_F(JSContextRelaxationTest,
77 RelaxJSCallFunctionShallowFrameStateChainNoCrossCtx) { 77 RelaxJSCallFunctionShallowFrameStateChainNoCrossCtx) {
78 Node* const input0 = Parameter(0); 78 Node* const input0 = Parameter(0);
79 Node* const input1 = Parameter(1); 79 Node* const input1 = Parameter(1);
80 Node* const context = Parameter(2); 80 Node* const context = Parameter(2);
81 Node* const outer_context = Parameter(3); 81 Node* const outer_context = Parameter(3);
82 Node* const frame_state = 82 Node* const frame_state =
83 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT); 83 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
84 Node* const effect = graph()->start(); 84 Node* const effect = graph()->start();
85 Node* const control = graph()->start(); 85 Node* const control = graph()->start();
86 Node* node = graph()->NewNode( 86 Node* node = graph()->NewNode(javascript()->CallFunction(2, VectorSlotPair()),
87 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, 87 input0, input1, context, frame_state,
88 context, frame_state, frame_state, effect, control); 88 frame_state, effect, control);
89 Reduction const r = Reduce(node); 89 Reduction const r = Reduce(node);
90 EXPECT_TRUE(r.Changed()); 90 EXPECT_TRUE(r.Changed());
91 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); 91 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node));
92 } 92 }
93 93
94 TEST_F(JSContextRelaxationTest, 94 TEST_F(JSContextRelaxationTest,
95 RelaxJSCallFunctionShallowFrameStateChainCrossCtx) { 95 RelaxJSCallFunctionShallowFrameStateChainCrossCtx) {
96 Node* const input0 = Parameter(0); 96 Node* const input0 = Parameter(0);
97 Node* const input1 = Parameter(1); 97 Node* const input1 = Parameter(1);
98 Node* const context = Parameter(2); 98 Node* const context = Parameter(2);
99 Node* const outer_context = Parameter(3); 99 Node* const outer_context = Parameter(3);
100 Node* const frame_state = 100 Node* const frame_state =
101 ShallowFrameStateChain(outer_context, CALL_CHANGES_NATIVE_CONTEXT); 101 ShallowFrameStateChain(outer_context, CALL_CHANGES_NATIVE_CONTEXT);
102 Node* const effect = graph()->start(); 102 Node* const effect = graph()->start();
103 Node* const control = graph()->start(); 103 Node* const control = graph()->start();
104 Node* node = graph()->NewNode( 104 Node* node = graph()->NewNode(javascript()->CallFunction(2, VectorSlotPair()),
105 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, 105 input0, input1, context, frame_state,
106 context, frame_state, frame_state, effect, control); 106 frame_state, effect, control);
107 Reduction const r = Reduce(node); 107 Reduction const r = Reduce(node);
108 EXPECT_FALSE(r.Changed()); 108 EXPECT_FALSE(r.Changed());
109 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); 109 EXPECT_EQ(context, NodeProperties::GetContextInput(node));
110 } 110 }
111 111
112 TEST_F(JSContextRelaxationTest, 112 TEST_F(JSContextRelaxationTest,
113 RelaxJSCallFunctionDeepFrameStateChainNoCrossCtx) { 113 RelaxJSCallFunctionDeepFrameStateChainNoCrossCtx) {
114 Node* const input0 = Parameter(0); 114 Node* const input0 = Parameter(0);
115 Node* const input1 = Parameter(1); 115 Node* const input1 = Parameter(1);
116 Node* const context = Parameter(2); 116 Node* const context = Parameter(2);
117 Node* const outer_context = Parameter(3); 117 Node* const outer_context = Parameter(3);
118 Node* const frame_state = 118 Node* const frame_state =
119 DeepFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT); 119 DeepFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
120 Node* const effect = graph()->start(); 120 Node* const effect = graph()->start();
121 Node* const control = graph()->start(); 121 Node* const control = graph()->start();
122 Node* node = graph()->NewNode( 122 Node* node = graph()->NewNode(javascript()->CallFunction(2, VectorSlotPair()),
123 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, 123 input0, input1, context, frame_state,
124 context, frame_state, frame_state, effect, control); 124 frame_state, effect, control);
125 Reduction const r = Reduce(node); 125 Reduction const r = Reduce(node);
126 EXPECT_TRUE(r.Changed()); 126 EXPECT_TRUE(r.Changed());
127 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); 127 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node));
128 } 128 }
129 129
130 TEST_F(JSContextRelaxationTest, 130 TEST_F(JSContextRelaxationTest,
131 RelaxJSCallFunctionDeepFrameStateChainCrossCtx) { 131 RelaxJSCallFunctionDeepFrameStateChainCrossCtx) {
132 Node* const input0 = Parameter(0); 132 Node* const input0 = Parameter(0);
133 Node* const input1 = Parameter(1); 133 Node* const input1 = Parameter(1);
134 Node* const context = Parameter(2); 134 Node* const context = Parameter(2);
135 Node* const outer_context = Parameter(3); 135 Node* const outer_context = Parameter(3);
136 Node* const frame_state = 136 Node* const frame_state =
137 DeepFrameStateChain(outer_context, CALL_CHANGES_NATIVE_CONTEXT); 137 DeepFrameStateChain(outer_context, CALL_CHANGES_NATIVE_CONTEXT);
138 Node* const effect = graph()->start(); 138 Node* const effect = graph()->start();
139 Node* const control = graph()->start(); 139 Node* const control = graph()->start();
140 Node* node = graph()->NewNode( 140 Node* node = graph()->NewNode(javascript()->CallFunction(2, VectorSlotPair()),
141 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, 141 input0, input1, context, frame_state,
142 context, frame_state, frame_state, effect, control); 142 frame_state, effect, control);
143 Reduction const r = Reduce(node); 143 Reduction const r = Reduce(node);
144 EXPECT_FALSE(r.Changed()); 144 EXPECT_FALSE(r.Changed());
145 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); 145 EXPECT_EQ(context, NodeProperties::GetContextInput(node));
146 } 146 }
147 147
148 TEST_F(JSContextRelaxationTest, 148 TEST_F(JSContextRelaxationTest,
149 RelaxJSCallFunctionDeepContextChainFullRelaxForCatch) { 149 RelaxJSCallFunctionDeepContextChainFullRelaxForCatch) {
150 Node* const input0 = Parameter(0); 150 Node* const input0 = Parameter(0);
151 Node* const input1 = Parameter(1); 151 Node* const input1 = Parameter(1);
152 Node* const context = Parameter(2); 152 Node* const context = Parameter(2);
153 Node* const outer_context = Parameter(3); 153 Node* const outer_context = Parameter(3);
154 const Operator* op = javascript()->CreateCatchContext(Handle<String>()); 154 const Operator* op = javascript()->CreateCatchContext(Handle<String>());
155 Node* const effect = graph()->start(); 155 Node* const effect = graph()->start();
156 Node* const control = graph()->start(); 156 Node* const control = graph()->start();
157 Node* nested_context = graph()->NewNode( 157 Node* nested_context = graph()->NewNode(
158 op, graph()->start(), graph()->start(), outer_context, effect, control); 158 op, graph()->start(), graph()->start(), outer_context, effect, control);
159 Node* const frame_state_2 = 159 Node* const frame_state_2 =
160 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 160 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
161 Node* node = graph()->NewNode( 161 Node* node = graph()->NewNode(javascript()->CallFunction(2, VectorSlotPair()),
162 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, 162 input0, input1, context, frame_state_2,
163 context, frame_state_2, frame_state_2, effect, control); 163 frame_state_2, effect, control);
164 Reduction const r = Reduce(node); 164 Reduction const r = Reduce(node);
165 EXPECT_TRUE(r.Changed()); 165 EXPECT_TRUE(r.Changed());
166 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); 166 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node));
167 } 167 }
168 168
169 169
170 TEST_F(JSContextRelaxationTest, 170 TEST_F(JSContextRelaxationTest,
171 RelaxJSCallFunctionDeepContextChainFullRelaxForWith) { 171 RelaxJSCallFunctionDeepContextChainFullRelaxForWith) {
172 Node* const input0 = Parameter(0); 172 Node* const input0 = Parameter(0);
173 Node* const input1 = Parameter(1); 173 Node* const input1 = Parameter(1);
174 Node* const context = Parameter(2); 174 Node* const context = Parameter(2);
175 Node* const outer_context = Parameter(3); 175 Node* const outer_context = Parameter(3);
176 const Operator* op = javascript()->CreateWithContext(); 176 const Operator* op = javascript()->CreateWithContext();
177 Node* const effect = graph()->start(); 177 Node* const effect = graph()->start();
178 Node* const control = graph()->start(); 178 Node* const control = graph()->start();
179 Node* nested_context = graph()->NewNode( 179 Node* nested_context = graph()->NewNode(
180 op, graph()->start(), graph()->start(), outer_context, effect, control); 180 op, graph()->start(), graph()->start(), outer_context, effect, control);
181 Node* const frame_state_2 = 181 Node* const frame_state_2 =
182 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 182 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
183 Node* node = graph()->NewNode( 183 Node* node = graph()->NewNode(javascript()->CallFunction(2, VectorSlotPair()),
184 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, 184 input0, input1, context, frame_state_2,
185 context, frame_state_2, frame_state_2, effect, control); 185 frame_state_2, effect, control);
186 Reduction const r = Reduce(node); 186 Reduction const r = Reduce(node);
187 EXPECT_TRUE(r.Changed()); 187 EXPECT_TRUE(r.Changed());
188 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); 188 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node));
189 } 189 }
190 190
191 191
192 TEST_F(JSContextRelaxationTest, 192 TEST_F(JSContextRelaxationTest,
193 RelaxJSCallFunctionDeepContextChainFullRelaxForBlock) { 193 RelaxJSCallFunctionDeepContextChainFullRelaxForBlock) {
194 Node* const input0 = Parameter(0); 194 Node* const input0 = Parameter(0);
195 Node* const input1 = Parameter(1); 195 Node* const input1 = Parameter(1);
196 Node* const context = Parameter(2); 196 Node* const context = Parameter(2);
197 Node* const outer_context = Parameter(3); 197 Node* const outer_context = Parameter(3);
198 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::null(); 198 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::null();
199 const Operator* op = javascript()->CreateBlockContext(scope_info); 199 const Operator* op = javascript()->CreateBlockContext(scope_info);
200 Node* const effect = graph()->start(); 200 Node* const effect = graph()->start();
201 Node* const control = graph()->start(); 201 Node* const control = graph()->start();
202 Node* nested_context = 202 Node* nested_context =
203 graph()->NewNode(op, graph()->start(), outer_context, effect, control); 203 graph()->NewNode(op, graph()->start(), outer_context, effect, control);
204 Node* const frame_state_2 = 204 Node* const frame_state_2 =
205 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 205 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
206 Node* node = graph()->NewNode( 206 Node* node = graph()->NewNode(javascript()->CallFunction(2, VectorSlotPair()),
207 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, 207 input0, input1, context, frame_state_2,
208 context, frame_state_2, frame_state_2, effect, control); 208 frame_state_2, effect, control);
209 Reduction const r = Reduce(node); 209 Reduction const r = Reduce(node);
210 EXPECT_TRUE(r.Changed()); 210 EXPECT_TRUE(r.Changed());
211 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); 211 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node));
212 } 212 }
213 213
214 214
215 TEST_F(JSContextRelaxationTest, 215 TEST_F(JSContextRelaxationTest,
216 RelaxJSCallFunctionDeepContextChainPartialRelaxForScript) { 216 RelaxJSCallFunctionDeepContextChainPartialRelaxForScript) {
217 Node* const input0 = Parameter(0); 217 Node* const input0 = Parameter(0);
218 Node* const input1 = Parameter(1); 218 Node* const input1 = Parameter(1);
219 Node* const context = Parameter(2); 219 Node* const context = Parameter(2);
220 Node* const outer_context = Parameter(3); 220 Node* const outer_context = Parameter(3);
221 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::null(); 221 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::null();
222 const Operator* op = javascript()->CreateScriptContext(scope_info); 222 const Operator* op = javascript()->CreateScriptContext(scope_info);
223 Node* const frame_state_1 = 223 Node* const frame_state_1 =
224 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT); 224 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
225 Node* const effect = graph()->start(); 225 Node* const effect = graph()->start();
226 Node* const control = graph()->start(); 226 Node* const control = graph()->start();
227 Node* nested_context = graph()->NewNode(op, graph()->start(), outer_context, 227 Node* nested_context = graph()->NewNode(op, graph()->start(), outer_context,
228 frame_state_1, effect, control); 228 frame_state_1, effect, control);
229 Node* const frame_state_2 = 229 Node* const frame_state_2 =
230 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 230 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
231 Node* node = graph()->NewNode( 231 Node* node = graph()->NewNode(javascript()->CallFunction(2, VectorSlotPair()),
232 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, 232 input0, input1, context, frame_state_2,
233 context, frame_state_2, frame_state_2, effect, control); 233 frame_state_2, effect, control);
234 Reduction const r = Reduce(node); 234 Reduction const r = Reduce(node);
235 EXPECT_TRUE(r.Changed()); 235 EXPECT_TRUE(r.Changed());
236 EXPECT_EQ(nested_context, NodeProperties::GetContextInput(node)); 236 EXPECT_EQ(nested_context, NodeProperties::GetContextInput(node));
237 } 237 }
238 238
239 239
240 TEST_F(JSContextRelaxationTest, 240 TEST_F(JSContextRelaxationTest,
241 RelaxJSCallFunctionDeepContextChainPartialRelaxForModule) { 241 RelaxJSCallFunctionDeepContextChainPartialRelaxForModule) {
242 Node* const input0 = Parameter(0); 242 Node* const input0 = Parameter(0);
243 Node* const input1 = Parameter(1); 243 Node* const input1 = Parameter(1);
244 Node* const context = Parameter(2); 244 Node* const context = Parameter(2);
245 Node* const outer_context = Parameter(3); 245 Node* const outer_context = Parameter(3);
246 const Operator* op = javascript()->CreateModuleContext(); 246 const Operator* op = javascript()->CreateModuleContext();
247 Node* const effect = graph()->start(); 247 Node* const effect = graph()->start();
248 Node* const control = graph()->start(); 248 Node* const control = graph()->start();
249 Node* nested_context = graph()->NewNode( 249 Node* nested_context = graph()->NewNode(
250 op, graph()->start(), graph()->start(), outer_context, effect, control); 250 op, graph()->start(), graph()->start(), outer_context, effect, control);
251 Node* const frame_state_2 = 251 Node* const frame_state_2 =
252 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 252 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
253 Node* node = graph()->NewNode( 253 Node* node = graph()->NewNode(javascript()->CallFunction(2, VectorSlotPair()),
254 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, 254 input0, input1, context, frame_state_2,
255 context, frame_state_2, frame_state_2, effect, control); 255 frame_state_2, effect, control);
256 Reduction const r = Reduce(node); 256 Reduction const r = Reduce(node);
257 EXPECT_TRUE(r.Changed()); 257 EXPECT_TRUE(r.Changed());
258 EXPECT_EQ(nested_context, NodeProperties::GetContextInput(node)); 258 EXPECT_EQ(nested_context, NodeProperties::GetContextInput(node));
259 } 259 }
260 260
261 261
262 TEST_F(JSContextRelaxationTest, 262 TEST_F(JSContextRelaxationTest,
263 RelaxJSCallFunctionDeepContextChainPartialNoRelax) { 263 RelaxJSCallFunctionDeepContextChainPartialNoRelax) {
264 Node* const input0 = Parameter(0); 264 Node* const input0 = Parameter(0);
265 Node* const input1 = Parameter(1); 265 Node* const input1 = Parameter(1);
266 Node* const context = Parameter(2); 266 Node* const context = Parameter(2);
267 Node* const outer_context = Parameter(3); 267 Node* const outer_context = Parameter(3);
268 const Operator* op = javascript()->CreateFunctionContext(0); 268 const Operator* op = javascript()->CreateFunctionContext(0);
269 Node* const effect = graph()->start(); 269 Node* const effect = graph()->start();
270 Node* const control = graph()->start(); 270 Node* const control = graph()->start();
271 Node* nested_context = 271 Node* nested_context =
272 graph()->NewNode(op, graph()->start(), outer_context, effect, control); 272 graph()->NewNode(op, graph()->start(), outer_context, effect, control);
273 Node* const frame_state_2 = 273 Node* const frame_state_2 =
274 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 274 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
275 Node* node = graph()->NewNode( 275 Node* node = graph()->NewNode(javascript()->CallFunction(2, VectorSlotPair()),
276 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, 276 input0, input1, context, frame_state_2,
277 context, frame_state_2, frame_state_2, effect, control); 277 frame_state_2, effect, control);
278 Reduction const r = Reduce(node); 278 Reduction const r = Reduce(node);
279 EXPECT_FALSE(r.Changed()); 279 EXPECT_FALSE(r.Changed());
280 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); 280 EXPECT_EQ(context, NodeProperties::GetContextInput(node));
281 } 281 }
282 282
283 } // namespace compiler 283 } // namespace compiler
284 } // namespace internal 284 } // namespace internal
285 } // namespace v8 285 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-builtin-reducer-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698