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

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

Issue 675493002: Move AST node counting to post-pass (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix nits 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.cc ('k') | src/full-codegen.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 JSInliner* inliner_; 52 JSInliner* inliner_;
53 }; 53 };
54 54
55 55
56 void JSInliner::Inline() { 56 void JSInliner::Inline() {
57 InlinerVisitor visitor(this); 57 InlinerVisitor visitor(this);
58 jsgraph_->graph()->VisitNodeInputsFromEnd(&visitor); 58 jsgraph_->graph()->VisitNodeInputsFromEnd(&visitor);
59 } 59 }
60 60
61 61
62 // TODO(sigurds) Find a home for this function and reuse it everywhere (esp. in
63 // test cases, where similar code is currently duplicated).
64 static void Parse(Handle<JSFunction> function, CompilationInfoWithZone* info) {
65 CHECK(Parser::Parse(info));
66 CHECK(Rewriter::Rewrite(info));
67 CHECK(Scope::Analyze(info));
68 CHECK(AstNumbering::Renumber(info->function(), info->zone()));
69 CHECK(Compiler::EnsureDeoptimizationSupport(info));
70 }
71
72
73 // 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
74 // that the function graph has only one return statement, and provides 63 // that the function graph has only one return statement, and provides
75 // {UnifyReturn} to convert a function graph to that end. 64 // {UnifyReturn} to convert a function graph to that end.
76 class Inlinee { 65 class Inlinee {
77 public: 66 public:
78 Inlinee(Node* start, Node* end) : start_(start), end_(end) {} 67 Inlinee(Node* start, Node* end) : start_(start), end_(end) {}
79 68
80 // Returns the last regular control node, that is 69 // Returns the last regular control node, that is
81 // the last control node before the end node. 70 // the last control node before the end node.
82 Node* end_block() { return NodeProperties::GetControlInput(unique_return()); } 71 Node* end_block() { return NodeProperties::GetControlInput(unique_return()); }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if (FLAG_trace_turbo_inlining) { 367 if (FLAG_trace_turbo_inlining) {
379 SmartArrayPointer<char> name = 368 SmartArrayPointer<char> name =
380 function->shared()->DebugName()->ToCString(); 369 function->shared()->DebugName()->ToCString();
381 PrintF("Not Inlining %s into %s because inlinee is native\n", name.get(), 370 PrintF("Not Inlining %s into %s because inlinee is native\n", name.get(),
382 info_->shared_info()->DebugName()->ToCString().get()); 371 info_->shared_info()->DebugName()->ToCString().get());
383 } 372 }
384 return; 373 return;
385 } 374 }
386 375
387 CompilationInfoWithZone info(function); 376 CompilationInfoWithZone info(function);
388 Parse(function, &info); 377 CHECK(Compiler::ParseAndAnalyze(&info));
378 CHECK(Compiler::EnsureDeoptimizationSupport(&info));
389 379
390 if (info.scope()->arguments() != NULL && info.strict_mode() != STRICT) { 380 if (info.scope()->arguments() != NULL && info.strict_mode() != STRICT) {
391 // For now do not inline functions that use their arguments array. 381 // For now do not inline functions that use their arguments array.
392 SmartArrayPointer<char> name = function->shared()->DebugName()->ToCString(); 382 SmartArrayPointer<char> name = function->shared()->DebugName()->ToCString();
393 if (FLAG_trace_turbo_inlining) { 383 if (FLAG_trace_turbo_inlining) {
394 PrintF( 384 PrintF(
395 "Not Inlining %s into %s because inlinee uses arguments " 385 "Not Inlining %s into %s because inlinee uses arguments "
396 "array\n", 386 "array\n",
397 name.get(), info_->shared_info()->DebugName()->ToCString().get()); 387 name.get(), info_->shared_info()->DebugName()->ToCString().get());
398 } 388 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 info_->shared_info()->DebugName()->ToCString().get()); 488 info_->shared_info()->DebugName()->ToCString().get());
499 } 489 }
500 NodeProperties::ReplaceWithValue(call_node, r.first, r.second); 490 NodeProperties::ReplaceWithValue(call_node, r.first, r.second);
501 call_node->RemoveAllInputs(); 491 call_node->RemoveAllInputs();
502 DCHECK_EQ(0, call_node->UseCount()); 492 DCHECK_EQ(0, call_node->UseCount());
503 } 493 }
504 } 494 }
505 } 495 }
506 } 496 }
507 } // namespace v8::internal::compiler 497 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698