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

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

Issue 678033002: Revert "Move AST node counting to post-pass" (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.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
62 // A facade on a JSFunction's graph to facilitate inlining. It assumes the 73 // A facade on a JSFunction's graph to facilitate inlining. It assumes the
63 // that the function graph has only one return statement, and provides 74 // that the function graph has only one return statement, and provides
64 // {UnifyReturn} to convert a function graph to that end. 75 // {UnifyReturn} to convert a function graph to that end.
65 class Inlinee { 76 class Inlinee {
66 public: 77 public:
67 Inlinee(Node* start, Node* end) : start_(start), end_(end) {} 78 Inlinee(Node* start, Node* end) : start_(start), end_(end) {}
68 79
69 // Returns the last regular control node, that is 80 // Returns the last regular control node, that is
70 // the last control node before the end node. 81 // the last control node before the end node.
71 Node* end_block() { return NodeProperties::GetControlInput(unique_return()); } 82 Node* end_block() { return NodeProperties::GetControlInput(unique_return()); }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 if (FLAG_trace_turbo_inlining) { 378 if (FLAG_trace_turbo_inlining) {
368 SmartArrayPointer<char> name = 379 SmartArrayPointer<char> name =
369 function->shared()->DebugName()->ToCString(); 380 function->shared()->DebugName()->ToCString();
370 PrintF("Not Inlining %s into %s because inlinee is native\n", name.get(), 381 PrintF("Not Inlining %s into %s because inlinee is native\n", name.get(),
371 info_->shared_info()->DebugName()->ToCString().get()); 382 info_->shared_info()->DebugName()->ToCString().get());
372 } 383 }
373 return; 384 return;
374 } 385 }
375 386
376 CompilationInfoWithZone info(function); 387 CompilationInfoWithZone info(function);
377 CHECK(Compiler::ParseAndAnalyze(&info)); 388 Parse(function, &info);
378 CHECK(Compiler::EnsureDeoptimizationSupport(&info));
379 389
380 if (info.scope()->arguments() != NULL && info.strict_mode() != STRICT) { 390 if (info.scope()->arguments() != NULL && info.strict_mode() != STRICT) {
381 // For now do not inline functions that use their arguments array. 391 // For now do not inline functions that use their arguments array.
382 SmartArrayPointer<char> name = function->shared()->DebugName()->ToCString(); 392 SmartArrayPointer<char> name = function->shared()->DebugName()->ToCString();
383 if (FLAG_trace_turbo_inlining) { 393 if (FLAG_trace_turbo_inlining) {
384 PrintF( 394 PrintF(
385 "Not Inlining %s into %s because inlinee uses arguments " 395 "Not Inlining %s into %s because inlinee uses arguments "
386 "array\n", 396 "array\n",
387 name.get(), info_->shared_info()->DebugName()->ToCString().get()); 397 name.get(), info_->shared_info()->DebugName()->ToCString().get());
388 } 398 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 info_->shared_info()->DebugName()->ToCString().get()); 498 info_->shared_info()->DebugName()->ToCString().get());
489 } 499 }
490 NodeProperties::ReplaceWithValue(call_node, r.first, r.second); 500 NodeProperties::ReplaceWithValue(call_node, r.first, r.second);
491 call_node->RemoveAllInputs(); 501 call_node->RemoveAllInputs();
492 DCHECK_EQ(0, call_node->UseCount()); 502 DCHECK_EQ(0, call_node->UseCount());
493 } 503 }
494 } 504 }
495 } 505 }
496 } 506 }
497 } // namespace v8::internal::compiler 507 } // 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