Allow inlining of functions containing function literals.

R=fschneider@chromium.org,vegorov@chromium.org
BUG=v8:1322
TEST=mjsunit/compiler/inline-literals

Review URL: https://chromiumcodereview.appspot.com/9453007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10811 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a1f3c940
......@@ -1010,6 +1010,7 @@ INCREASE_NODE_COUNT(ReturnStatement)
INCREASE_NODE_COUNT(Conditional)
INCREASE_NODE_COUNT(Literal)
INCREASE_NODE_COUNT(ObjectLiteral)
INCREASE_NODE_COUNT(FunctionLiteral)
INCREASE_NODE_COUNT(Assignment)
INCREASE_NODE_COUNT(Throw)
INCREASE_NODE_COUNT(Property)
......@@ -1085,12 +1086,6 @@ void AstConstructionVisitor::VisitDebuggerStatement(DebuggerStatement* node) {
}
void AstConstructionVisitor::VisitFunctionLiteral(FunctionLiteral* node) {
increase_node_count();
add_flag(kDontInline);
}
void AstConstructionVisitor::VisitSharedFunctionInfoLiteral(
SharedFunctionInfoLiteral* node) {
increase_node_count();
......
......@@ -45,6 +45,26 @@ function TestObjectLiteral(a, b, c) {
TestObjectLiteral(1, 2, 3);
TestObjectLiteral(1, 2, 3);
%OptimizeFunctionOnNextCall(TestObjectLiteral);
%OptimizeFunctionOnNextCall(o1);
TestObjectLiteral(1, 2, 3);
TestObjectLiteral('a', 'b', 'c');
function f2() {
return function(b, c) { return b + c; };
}
function f1(a, b, c) {
return a + f2()(b, c);
}
function TestFunctionLiteral(a, b, c) {
var expected = a + b + c;
var result = f1(a, b, c);
assertEquals(expected, result, "TestFunctionLiteral");
}
TestFunctionLiteral(1, 2, 3);
TestFunctionLiteral(1, 2, 3);
%OptimizeFunctionOnNextCall(f1);
TestFunctionLiteral(1, 2, 3);
TestFunctionLiteral('a', 'b', 'c');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment