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

Side by Side Diff: src/compiler/js-call-reducer.cc

Issue 2692753004: [turbofan] escape analysis supports arguments object and rest elements (Closed)
Patch Set: handle the case where Deoptimizer::function_ is a Smi Created 3 years, 9 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/instruction-selector.cc ('k') | src/compiler/js-create-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 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-call-reducer.h" 5 #include "src/compiler/js-call-reducer.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (type == CreateArgumentsType::kMappedArguments) { 129 if (type == CreateArgumentsType::kMappedArguments) {
130 // Mapped arguments (sloppy mode) cannot be handled if they are aliased. 130 // Mapped arguments (sloppy mode) cannot be handled if they are aliased.
131 if (formal_parameter_count != 0) return NoChange(); 131 if (formal_parameter_count != 0) return NoChange();
132 } else if (type == CreateArgumentsType::kRestParameter) { 132 } else if (type == CreateArgumentsType::kRestParameter) {
133 start_index = formal_parameter_count; 133 start_index = formal_parameter_count;
134 } 134 }
135 // Check if are applying to inlined arguments or to the arguments of 135 // Check if are applying to inlined arguments or to the arguments of
136 // the outermost function. 136 // the outermost function.
137 Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput); 137 Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
138 if (outer_state->opcode() != IrOpcode::kFrameState) { 138 if (outer_state->opcode() != IrOpcode::kFrameState) {
139 // TODO(jarin,bmeurer): Support the NewUnmappedArgumentsElement and
140 // NewRestParameterElements in the EscapeAnalysis and Deoptimizer
141 // instead, then we don't need this hack.
142 // Only works with zero formal parameters because of lacking deoptimizer
143 // support.
144 if (type != CreateArgumentsType::kRestParameter &&
145 formal_parameter_count == 0) {
146 // There are no other uses of the {arg_array} except in StateValues,
147 // so we just replace {arg_array} with a marker for the Deoptimizer
148 // that this refers to the arguments object.
149 Node* arguments = graph()->NewNode(common()->ArgumentsObjectState());
150 ReplaceWithValue(arg_array, arguments);
151 }
152
153 // Reduce {node} to a JSCallForwardVarargs operation, which just 139 // Reduce {node} to a JSCallForwardVarargs operation, which just
154 // re-pushes the incoming arguments and calls the {target}. 140 // re-pushes the incoming arguments and calls the {target}.
155 node->RemoveInput(0); // Function.prototype.apply 141 node->RemoveInput(0); // Function.prototype.apply
156 node->RemoveInput(2); // arguments 142 node->RemoveInput(2); // arguments
157 NodeProperties::ChangeOp(node, javascript()->CallForwardVarargs( 143 NodeProperties::ChangeOp(node, javascript()->CallForwardVarargs(
158 start_index, p.tail_call_mode())); 144 start_index, p.tail_call_mode()));
159 return Changed(node); 145 return Changed(node);
160 } 146 }
161 // Get to the actual frame state from which to extract the arguments; 147 // Get to the actual frame state from which to extract the arguments;
162 // we can only optimize this in case the {node} was already inlined into 148 // we can only optimize this in case the {node} was already inlined into
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 return jsgraph()->javascript(); 813 return jsgraph()->javascript();
828 } 814 }
829 815
830 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { 816 SimplifiedOperatorBuilder* JSCallReducer::simplified() const {
831 return jsgraph()->simplified(); 817 return jsgraph()->simplified();
832 } 818 }
833 819
834 } // namespace compiler 820 } // namespace compiler
835 } // namespace internal 821 } // namespace internal
836 } // namespace v8 822 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/js-create-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698