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/ast-numbering.h" |
7 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
8 #include "src/ast/ast-numbering.h" | |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
11 #include "src/compiler/all-nodes.h" | 11 #include "src/compiler/all-nodes.h" |
12 #include "src/compiler/ast-graph-builder.h" | 12 #include "src/compiler/ast-graph-builder.h" |
| 13 #include "src/compiler/ast-loop-assignment-analyzer.h" |
13 #include "src/compiler/common-operator.h" | 14 #include "src/compiler/common-operator.h" |
14 #include "src/compiler/graph-reducer.h" | 15 #include "src/compiler/graph-reducer.h" |
15 #include "src/compiler/js-operator.h" | 16 #include "src/compiler/js-operator.h" |
16 #include "src/compiler/node-matchers.h" | 17 #include "src/compiler/node-matchers.h" |
17 #include "src/compiler/node-properties.h" | 18 #include "src/compiler/node-properties.h" |
18 #include "src/compiler/operator-properties.h" | 19 #include "src/compiler/operator-properties.h" |
| 20 #include "src/compiler/type-hint-analyzer.h" |
19 #include "src/isolate-inl.h" | 21 #include "src/isolate-inl.h" |
20 #include "src/parsing/parser.h" | 22 #include "src/parsing/parser.h" |
21 #include "src/parsing/rewriter.h" | 23 #include "src/parsing/rewriter.h" |
22 | 24 |
23 namespace v8 { | 25 namespace v8 { |
24 namespace internal { | 26 namespace internal { |
25 namespace compiler { | 27 namespace compiler { |
26 | 28 |
27 #define TRACE(...) \ | 29 #define TRACE(...) \ |
28 do { \ | 30 do { \ |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 info_->AddInlinedFunction(shared_info); | 441 info_->AddInlinedFunction(shared_info); |
440 | 442 |
441 // ---------------------------------------------------------------- | 443 // ---------------------------------------------------------------- |
442 // After this point, we've made a decision to inline this function. | 444 // After this point, we've made a decision to inline this function. |
443 // We shall not bailout from inlining if we got here. | 445 // We shall not bailout from inlining if we got here. |
444 | 446 |
445 TRACE("Inlining %s into %s\n", | 447 TRACE("Inlining %s into %s\n", |
446 shared_info->DebugName()->ToCString().get(), | 448 shared_info->DebugName()->ToCString().get(), |
447 info_->shared_info()->DebugName()->ToCString().get()); | 449 info_->shared_info()->DebugName()->ToCString().get()); |
448 | 450 |
| 451 // Run the loop assignment analyzer on the inlinee. |
| 452 AstLoopAssignmentAnalyzer loop_assignment_analyzer(&zone, &info); |
| 453 LoopAssignmentAnalysis* loop_assignment = loop_assignment_analyzer.Analyze(); |
| 454 |
| 455 // Run the type hint analyzer on the inlinee. |
| 456 TypeHintAnalyzer type_hint_analyzer(&zone); |
| 457 TypeHintAnalysis* type_hint_analysis = |
| 458 type_hint_analyzer.Analyze(handle(shared_info->code(), info.isolate())); |
| 459 |
449 // TODO(mstarzinger): We could use the temporary zone for the graph because | 460 // TODO(mstarzinger): We could use the temporary zone for the graph because |
450 // nodes are copied. This however leads to Zone-Types being allocated in the | 461 // nodes are copied. This however leads to Zone-Types being allocated in the |
451 // wrong zone and makes the engine explode at high speeds. Explosion bad! | 462 // wrong zone and makes the engine explode at high speeds. Explosion bad! |
452 Graph graph(jsgraph_->zone()); | 463 Graph graph(jsgraph_->zone()); |
453 JSGraph jsgraph(info.isolate(), &graph, jsgraph_->common(), | 464 JSGraph jsgraph(info.isolate(), &graph, jsgraph_->common(), |
454 jsgraph_->javascript(), jsgraph_->simplified(), | 465 jsgraph_->javascript(), jsgraph_->simplified(), |
455 jsgraph_->machine()); | 466 jsgraph_->machine()); |
456 AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph); | 467 AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph, loop_assignment, |
| 468 type_hint_analysis); |
457 graph_builder.CreateGraph(false); | 469 graph_builder.CreateGraph(false); |
458 | 470 |
459 CopyVisitor visitor(&graph, jsgraph_->graph(), &zone); | 471 CopyVisitor visitor(&graph, jsgraph_->graph(), &zone); |
460 visitor.CopyGraph(); | 472 visitor.CopyGraph(); |
461 | 473 |
462 Node* start = visitor.GetCopy(graph.start()); | 474 Node* start = visitor.GetCopy(graph.start()); |
463 Node* end = visitor.GetCopy(graph.end()); | 475 Node* end = visitor.GetCopy(graph.end()); |
464 Node* frame_state = call.frame_state_after(); | 476 Node* frame_state = call.frame_state_after(); |
465 Node* new_target = jsgraph_->UndefinedConstant(); | 477 Node* new_target = jsgraph_->UndefinedConstant(); |
466 | 478 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 node, frame_state, call.formal_arguments(), | 566 node, frame_state, call.formal_arguments(), |
555 FrameStateType::kArgumentsAdaptor, shared_info); | 567 FrameStateType::kArgumentsAdaptor, shared_info); |
556 } | 568 } |
557 | 569 |
558 return InlineCall(node, new_target, context, frame_state, start, end); | 570 return InlineCall(node, new_target, context, frame_state, start, end); |
559 } | 571 } |
560 | 572 |
561 } // namespace compiler | 573 } // namespace compiler |
562 } // namespace internal | 574 } // namespace internal |
563 } // namespace v8 | 575 } // namespace v8 |
OLD | NEW |