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

Side by Side Diff: src/compiler/js-inlining.cc

Issue 686213002: Inline trivial OperatorProperties methods. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | src/compiler/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/ast.h" 5 #include "src/ast.h"
6 #include "src/ast-numbering.h" 6 #include "src/ast-numbering.h"
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/ast-graph-builder.h" 8 #include "src/compiler/ast-graph-builder.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/generic-node-inl.h" 10 #include "src/compiler/generic-node-inl.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void Inlinee::UnifyReturn(JSGraph* jsgraph) { 112 void Inlinee::UnifyReturn(JSGraph* jsgraph) {
113 Graph* graph = jsgraph->graph(); 113 Graph* graph = jsgraph->graph();
114 114
115 Node* final_merge = NodeProperties::GetControlInput(graph->end(), 0); 115 Node* final_merge = NodeProperties::GetControlInput(graph->end(), 0);
116 if (final_merge->opcode() == IrOpcode::kReturn) { 116 if (final_merge->opcode() == IrOpcode::kReturn) {
117 // nothing to do 117 // nothing to do
118 return; 118 return;
119 } 119 }
120 DCHECK_EQ(IrOpcode::kMerge, final_merge->opcode()); 120 DCHECK_EQ(IrOpcode::kMerge, final_merge->opcode());
121 121
122 int predecessors = 122 int predecessors = final_merge->op()->ControlInputCount();
123 OperatorProperties::GetControlInputCount(final_merge->op());
124 123
125 const Operator* op_phi = jsgraph->common()->Phi(kMachAnyTagged, predecessors); 124 const Operator* op_phi = jsgraph->common()->Phi(kMachAnyTagged, predecessors);
126 const Operator* op_ephi = jsgraph->common()->EffectPhi(predecessors); 125 const Operator* op_ephi = jsgraph->common()->EffectPhi(predecessors);
127 126
128 NodeVector values(jsgraph->zone()); 127 NodeVector values(jsgraph->zone());
129 NodeVector effects(jsgraph->zone()); 128 NodeVector effects(jsgraph->zone());
130 // Iterate over all control flow predecessors, 129 // Iterate over all control flow predecessors,
131 // which must be return statements. 130 // which must be return statements.
132 InputIter iter = final_merge->inputs().begin(); 131 InputIter iter = final_merge->inputs().begin();
133 while (iter != final_merge->inputs().end()) { 132 while (iter != final_merge->inputs().end()) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 SimplifiedOperatorBuilder simplified(jsgraph->zone()); 237 SimplifiedOperatorBuilder simplified(jsgraph->zone());
239 Node* context = jsgraph->graph()->NewNode( 238 Node* context = jsgraph->graph()->NewNode(
240 simplified.LoadField(AccessBuilder::ForJSFunctionContext()), 239 simplified.LoadField(AccessBuilder::ForJSFunctionContext()),
241 NodeProperties::GetValueInput(call, 0), 240 NodeProperties::GetValueInput(call, 0),
242 NodeProperties::GetEffectInput(call), control); 241 NodeProperties::GetEffectInput(call), control);
243 242
244 // Context is last argument. 243 // Context is last argument.
245 int inlinee_context_index = static_cast<int>(total_parameters()) - 1; 244 int inlinee_context_index = static_cast<int>(total_parameters()) - 1;
246 // {inliner_inputs} counts JSFunction, Receiver, arguments, but not 245 // {inliner_inputs} counts JSFunction, Receiver, arguments, but not
247 // context, effect, control. 246 // context, effect, control.
248 int inliner_inputs = OperatorProperties::GetValueInputCount(call->op()); 247 int inliner_inputs = call->op()->ValueInputCount();
249 // Iterate over all uses of the start node. 248 // Iterate over all uses of the start node.
250 UseIter iter = start_->uses().begin(); 249 UseIter iter = start_->uses().begin();
251 while (iter != start_->uses().end()) { 250 while (iter != start_->uses().end()) {
252 Node* use = *iter; 251 Node* use = *iter;
253 switch (use->opcode()) { 252 switch (use->opcode()) {
254 case IrOpcode::kParameter: { 253 case IrOpcode::kParameter: {
255 int index = 1 + OpParameter<int>(use->op()); 254 int index = 1 + OpParameter<int>(use->op());
256 if (index < inliner_inputs && index < inlinee_context_index) { 255 if (index < inliner_inputs && index < inlinee_context_index) {
257 // There is an input from the call, and the index is a value 256 // There is an input from the call, and the index is a value
258 // projection but not the context, so rewire the input. 257 // projection but not the context, so rewire the input.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 300
302 Node* receiver() { return call_->InputAt(1); } 301 Node* receiver() { return call_->InputAt(1); }
303 302
304 Node* formal_argument(size_t index) { 303 Node* formal_argument(size_t index) {
305 DCHECK(index < formal_arguments()); 304 DCHECK(index < formal_arguments());
306 return call_->InputAt(static_cast<int>(2 + index)); 305 return call_->InputAt(static_cast<int>(2 + index));
307 } 306 }
308 307
309 size_t formal_arguments() { 308 size_t formal_arguments() {
310 // {value_inputs} includes jsfunction and receiver. 309 // {value_inputs} includes jsfunction and receiver.
311 size_t value_inputs = OperatorProperties::GetValueInputCount(call_->op()); 310 size_t value_inputs = call_->op()->ValueInputCount();
312 DCHECK_GE(call_->InputCount(), 2); 311 DCHECK_GE(call_->InputCount(), 2);
313 return value_inputs - 2; 312 return value_inputs - 2;
314 } 313 }
315 314
316 Node* frame_state() { return NodeProperties::GetFrameStateInput(call_); } 315 Node* frame_state() { return NodeProperties::GetFrameStateInput(call_); }
317 316
318 private: 317 private:
319 Node* call_; 318 Node* call_;
320 }; 319 };
321 320
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 explicit JSCallRuntimeAccessor(Node* call) : call_(call) { 433 explicit JSCallRuntimeAccessor(Node* call) : call_(call) {
435 DCHECK_EQ(IrOpcode::kJSCallRuntime, call->opcode()); 434 DCHECK_EQ(IrOpcode::kJSCallRuntime, call->opcode());
436 } 435 }
437 436
438 Node* formal_argument(size_t index) { 437 Node* formal_argument(size_t index) {
439 DCHECK(index < formal_arguments()); 438 DCHECK(index < formal_arguments());
440 return call_->InputAt(static_cast<int>(index)); 439 return call_->InputAt(static_cast<int>(index));
441 } 440 }
442 441
443 size_t formal_arguments() { 442 size_t formal_arguments() {
444 size_t value_inputs = OperatorProperties::GetValueInputCount(call_->op()); 443 size_t value_inputs = call_->op()->ValueInputCount();
445 return value_inputs; 444 return value_inputs;
446 } 445 }
447 446
448 Node* frame_state() const { 447 Node* frame_state() const {
449 return NodeProperties::GetFrameStateInput(call_); 448 return NodeProperties::GetFrameStateInput(call_);
450 } 449 }
451 Node* context() const { return NodeProperties::GetContextInput(call_); } 450 Node* context() const { return NodeProperties::GetContextInput(call_); }
452 Node* control() const { return NodeProperties::GetControlInput(call_); } 451 Node* control() const { return NodeProperties::GetControlInput(call_); }
453 Node* effect() const { return NodeProperties::GetEffectInput(call_); } 452 Node* effect() const { return NodeProperties::GetEffectInput(call_); }
454 453
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 info_->shared_info()->DebugName()->ToCString().get()); 488 info_->shared_info()->DebugName()->ToCString().get());
490 } 489 }
491 NodeProperties::ReplaceWithValue(call_node, r.first, r.second); 490 NodeProperties::ReplaceWithValue(call_node, r.first, r.second);
492 call_node->RemoveAllInputs(); 491 call_node->RemoveAllInputs();
493 DCHECK_EQ(0, call_node->UseCount()); 492 DCHECK_EQ(0, call_node->UseCount());
494 } 493 }
495 } 494 }
496 } 495 }
497 } 496 }
498 } // namespace v8::internal::compiler 497 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698