OLD | NEW |
---|---|
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-inlining.h" | 5 #include "src/compiler/js-inlining.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
10 #include "src/compiler/all-nodes.h" | 10 #include "src/compiler/all-nodes.h" |
11 #include "src/compiler/ast-graph-builder.h" | 11 #include "src/compiler/ast-graph-builder.h" |
12 #include "src/compiler/common-operator.h" | 12 #include "src/compiler/common-operator.h" |
13 #include "src/compiler/graph-visualizer.h" | 13 #include "src/compiler/graph-visualizer.h" |
14 #include "src/compiler/js-operator.h" | 14 #include "src/compiler/js-operator.h" |
15 #include "src/compiler/node-matchers.h" | 15 #include "src/compiler/node-matchers.h" |
16 #include "src/compiler/node-properties.h" | 16 #include "src/compiler/node-properties.h" |
17 #include "src/compiler/operator-properties.h" | |
17 #include "src/compiler/simplified-operator.h" | 18 #include "src/compiler/simplified-operator.h" |
18 #include "src/compiler/typer.h" | 19 #include "src/compiler/typer.h" |
19 #include "src/full-codegen.h" | 20 #include "src/full-codegen.h" |
20 #include "src/parser.h" | 21 #include "src/parser.h" |
21 #include "src/rewriter.h" | 22 #include "src/rewriter.h" |
22 #include "src/scopes.h" | 23 #include "src/scopes.h" |
23 | 24 |
24 namespace v8 { | 25 namespace v8 { |
25 namespace internal { | 26 namespace internal { |
26 namespace compiler { | 27 namespace compiler { |
(...skipping 15 matching lines...) Expand all Loading... | |
42 return call_->InputAt(static_cast<int>(2 + index)); | 43 return call_->InputAt(static_cast<int>(2 + index)); |
43 } | 44 } |
44 | 45 |
45 size_t formal_arguments() { | 46 size_t formal_arguments() { |
46 // {value_inputs} includes jsfunction and receiver. | 47 // {value_inputs} includes jsfunction and receiver. |
47 size_t value_inputs = call_->op()->ValueInputCount(); | 48 size_t value_inputs = call_->op()->ValueInputCount(); |
48 DCHECK_GE(call_->InputCount(), 2); | 49 DCHECK_GE(call_->InputCount(), 2); |
49 return value_inputs - 2; | 50 return value_inputs - 2; |
50 } | 51 } |
51 | 52 |
52 Node* frame_state() { return NodeProperties::GetFrameStateInput(call_); } | 53 Node* frame_state() { return NodeProperties::GetFrameStateInput(call_, 0); } |
53 | 54 |
54 private: | 55 private: |
55 Node* call_; | 56 Node* call_; |
56 }; | 57 }; |
57 | 58 |
58 | 59 |
59 namespace { | 60 namespace { |
60 | 61 |
61 // A facade on a JSFunction's graph to facilitate inlining. It assumes the | 62 // A facade on a JSFunction's graph to facilitate inlining. It assumes the |
62 // that the function graph has only one return statement, and provides | 63 // that the function graph has only one return statement, and provides |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 if (FLAG_turbo_deoptimization) { | 369 if (FLAG_turbo_deoptimization) { |
369 Node* outer_frame_state = call.frame_state(); | 370 Node* outer_frame_state = call.frame_state(); |
370 // Insert argument adaptor frame if required. | 371 // Insert argument adaptor frame if required. |
371 if (call.formal_arguments() != inlinee.formal_parameters()) { | 372 if (call.formal_arguments() != inlinee.formal_parameters()) { |
372 outer_frame_state = | 373 outer_frame_state = |
373 CreateArgumentsAdaptorFrameState(&call, function, info.zone()); | 374 CreateArgumentsAdaptorFrameState(&call, function, info.zone()); |
374 } | 375 } |
375 | 376 |
376 for (Node* node : visitor.copies()) { | 377 for (Node* node : visitor.copies()) { |
377 if (node && node->opcode() == IrOpcode::kFrameState) { | 378 if (node && node->opcode() == IrOpcode::kFrameState) { |
379 DCHECK(OperatorProperties::GetFrameStateInputCount(node->op()) == 1); | |
Benedikt Meurer
2015/03/09 05:32:34
DCHECK_EQ?
Jarin
2015/03/09 07:47:11
Done.
| |
378 AddClosureToFrameState(node, function); | 380 AddClosureToFrameState(node, function); |
379 NodeProperties::ReplaceFrameStateInput(node, outer_frame_state); | 381 NodeProperties::ReplaceFrameStateInput(node, 0, outer_frame_state); |
380 } | 382 } |
381 } | 383 } |
382 } | 384 } |
383 | 385 |
384 return inlinee.InlineAtCall(jsgraph_, node); | 386 return inlinee.InlineAtCall(jsgraph_, node); |
385 } | 387 } |
386 | 388 |
387 } // namespace compiler | 389 } // namespace compiler |
388 } // namespace internal | 390 } // namespace internal |
389 } // namespace v8 | 391 } // namespace v8 |
OLD | NEW |