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

Unified Diff: src/hydrogen.cc

Issue 9221011: Collect AstNode type information (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback (embedded AstProperties and AstConstructionVisitor) Created 8 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« src/ast.h ('K') | « src/heap.cc ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index a27360a3fd868b428ccbe4d7388f083cb914a18a..cbb635548e4cdb93074a8f4d73492e5646058e54 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4798,8 +4798,8 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) {
// Do a quick check on source code length to avoid parsing large
// inlining candidates.
- if ((FLAG_limit_inlining && target->shared()->SourceSize() > kMaxSourceSize)
- || target->shared()->SourceSize() > kUnlimitedMaxSourceSize) {
+ if ((FLAG_limit_inlining && target_shared->SourceSize() > kMaxSourceSize)
+ || target_shared->SourceSize() > kUnlimitedMaxSourceSize) {
TraceInline(target, caller, "target text too big");
return false;
}
@@ -4809,6 +4809,17 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) {
TraceInline(target, caller, "target not inlineable");
return false;
}
+ if (target_shared->dont_inline() || target_shared->dont_crankshaft()) {
+ TraceInline(target, caller, "target contains unsupported syntax [early]");
+ return false;
+ }
+
+ int nodes_added = target_shared->ast_node_count();
+ if ((FLAG_limit_inlining && nodes_added > kMaxInlinedSize) ||
+ nodes_added > kUnlimitedMaxInlinedSize) {
+ TraceInline(target, caller, "target AST is too large [early]");
+ return false;
+ }
#if !defined(V8_TARGET_ARCH_IA32)
// Target must be able to use caller's context.
@@ -4853,8 +4864,6 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) {
return false;
}
- int count_before = AstNode::Count();
-
// Parse and allocate variables.
CompilationInfo target_info(target);
if (!ParserApi::Parse(&target_info, kNoParsingFlags) ||
@@ -4874,11 +4883,17 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) {
}
FunctionLiteral* function = target_info.function();
- // Count the number of AST nodes added by inlining this call.
- int nodes_added = AstNode::Count() - count_before;
+ // The following conditions must be checked again after re-parsing, because
+ // earlier the information might not have been complete due to lazy parsing.
+ nodes_added = function->ast_node_count();
if ((FLAG_limit_inlining && nodes_added > kMaxInlinedSize) ||
nodes_added > kUnlimitedMaxInlinedSize) {
- TraceInline(target, caller, "target AST is too large");
+ TraceInline(target, caller, "target AST is too large [late]");
+ return false;
+ }
+ AstProperties::Flags* flags(function->flags());
+ if (flags->Contains(kDontInline) || flags->Contains(kDontCrankshaft)) {
+ TraceInline(target, caller, "target contains unsupported syntax [late]");
return false;
}
@@ -4897,13 +4912,6 @@ bool HGraphBuilder::TryInline(Call* expr, bool drop_extra) {
return false;
}
}
- // All statements in the body must be inlineable.
- for (int i = 0, count = function->body()->length(); i < count; ++i) {
- if (!function->body()->at(i)->IsInlineable()) {
- TraceInline(target, caller, "target contains unsupported syntax");
- return false;
- }
- }
// Generate the deoptimization data for the unoptimized version of
// the target function if we don't already have it.
« src/ast.h ('K') | « src/heap.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698