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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 1191243003: [turbofan] Factor out the function specific part from the frame state operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweaks Created 5 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/js-type-feedback.cc ('k') | test/cctest/compiler/test-js-typed-lowering.cc » ('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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compiler/access-builder.h" 6 #include "src/compiler/access-builder.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/js-typed-lowering.h" 8 #include "src/compiler/js-typed-lowering.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // Avoid introducing too many eager ToString() operations. 245 // Avoid introducing too many eager ToString() operations.
246 Reduction reduced = lowering_->ReduceJSToStringInput(node); 246 Reduction reduced = lowering_->ReduceJSToStringInput(node);
247 if (reduced.Changed()) return reduced.replacement(); 247 if (reduced.Changed()) return reduced.replacement();
248 Node* n = graph()->NewNode(javascript()->ToString(), node, context(), 248 Node* n = graph()->NewNode(javascript()->ToString(), node, context(),
249 effect(), control()); 249 effect(), control());
250 update_effect(n); 250 update_effect(n);
251 return n; 251 return n;
252 } 252 }
253 253
254 Node* CreateFrameStateForLeftInput(Node* frame_state) { 254 Node* CreateFrameStateForLeftInput(Node* frame_state) {
255 FrameStateCallInfo state_info = 255 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state);
256 OpParameter<FrameStateCallInfo>(frame_state);
257 256
258 if (state_info.bailout_id() == BailoutId::None()) { 257 if (state_info.bailout_id() == BailoutId::None()) {
259 // Dummy frame state => just leave it as is. 258 // Dummy frame state => just leave it as is.
260 return frame_state; 259 return frame_state;
261 } 260 }
262 261
263 // If the frame state is already the right one, just return it. 262 // If the frame state is already the right one, just return it.
264 if (state_info.state_combine().kind() == OutputFrameStateCombine::kPokeAt && 263 if (state_info.state_combine().kind() == OutputFrameStateCombine::kPokeAt &&
265 state_info.state_combine().GetOffsetToPokeAt() == 1) { 264 state_info.state_combine().GetOffsetToPokeAt() == 1) {
266 return frame_state; 265 return frame_state;
267 } 266 }
268 267
269 // Here, we smash the result of the conversion into the slot just below 268 // Here, we smash the result of the conversion into the slot just below
270 // the stack top. This is the slot that full code uses to store the 269 // the stack top. This is the slot that full code uses to store the
271 // left operand. 270 // left operand.
272 const Operator* op = jsgraph()->common()->FrameState( 271 const Operator* op = jsgraph()->common()->FrameState(
273 state_info.type(), state_info.bailout_id(), 272 state_info.bailout_id(), OutputFrameStateCombine::PokeAt(1),
274 OutputFrameStateCombine::PokeAt(1), state_info.shared_info()); 273 state_info.function_info());
275 274
276 return graph()->NewNode(op, 275 return graph()->NewNode(op,
277 frame_state->InputAt(kFrameStateParametersInput), 276 frame_state->InputAt(kFrameStateParametersInput),
278 frame_state->InputAt(kFrameStateLocalsInput), 277 frame_state->InputAt(kFrameStateLocalsInput),
279 frame_state->InputAt(kFrameStateStackInput), 278 frame_state->InputAt(kFrameStateStackInput),
280 frame_state->InputAt(kFrameStateContextInput), 279 frame_state->InputAt(kFrameStateContextInput),
281 frame_state->InputAt(kFrameStateFunctionInput), 280 frame_state->InputAt(kFrameStateFunctionInput),
282 frame_state->InputAt(kFrameStateOuterStateInput)); 281 frame_state->InputAt(kFrameStateOuterStateInput));
283 } 282 }
284 283
285 Node* CreateFrameStateForRightInput(Node* frame_state, Node* converted_left) { 284 Node* CreateFrameStateForRightInput(Node* frame_state, Node* converted_left) {
286 FrameStateCallInfo state_info = 285 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state);
287 OpParameter<FrameStateCallInfo>(frame_state);
288 286
289 if (state_info.bailout_id() == BailoutId::None()) { 287 if (state_info.bailout_id() == BailoutId::None()) {
290 // Dummy frame state => just leave it as is. 288 // Dummy frame state => just leave it as is.
291 return frame_state; 289 return frame_state;
292 } 290 }
293 291
294 // Create a frame state that stores the result of the operation to the 292 // Create a frame state that stores the result of the operation to the
295 // top of the stack (i.e., the slot used for the right operand). 293 // top of the stack (i.e., the slot used for the right operand).
296 const Operator* op = jsgraph()->common()->FrameState( 294 const Operator* op = jsgraph()->common()->FrameState(
297 state_info.type(), state_info.bailout_id(), 295 state_info.bailout_id(), OutputFrameStateCombine::PokeAt(0),
298 OutputFrameStateCombine::PokeAt(0), state_info.shared_info()); 296 state_info.function_info());
299 297
300 // Change the left operand {converted_left} on the expression stack. 298 // Change the left operand {converted_left} on the expression stack.
301 Node* stack = frame_state->InputAt(2); 299 Node* stack = frame_state->InputAt(2);
302 DCHECK_EQ(stack->opcode(), IrOpcode::kStateValues); 300 DCHECK_EQ(stack->opcode(), IrOpcode::kStateValues);
303 DCHECK_GE(stack->InputCount(), 2); 301 DCHECK_GE(stack->InputCount(), 2);
304 302
305 // TODO(jarin) Allocate in a local zone or a reusable buffer. 303 // TODO(jarin) Allocate in a local zone or a reusable buffer.
306 NodeVector new_values(stack->InputCount(), zone()); 304 NodeVector new_values(stack->InputCount(), zone());
307 for (int i = 0; i < stack->InputCount(); i++) { 305 for (int i = 0; i < stack->InputCount(); i++) {
308 if (i == stack->InputCount() - 2) { 306 if (i == stack->InputCount() - 2) {
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 } 1706 }
1709 1707
1710 1708
1711 MachineOperatorBuilder* JSTypedLowering::machine() const { 1709 MachineOperatorBuilder* JSTypedLowering::machine() const {
1712 return jsgraph()->machine(); 1710 return jsgraph()->machine();
1713 } 1711 }
1714 1712
1715 } // namespace compiler 1713 } // namespace compiler
1716 } // namespace internal 1714 } // namespace internal
1717 } // namespace v8 1715 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-type-feedback.cc ('k') | test/cctest/compiler/test-js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698