Allow inlining of functions containing function literals.

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

Review URL: https://codereview.chromium.org/10702036

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13945 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3d2dc897
......@@ -1040,6 +1040,7 @@ REGULAR_NODE(Conditional)
REGULAR_NODE(Literal)
REGULAR_NODE(ObjectLiteral)
REGULAR_NODE(RegExpLiteral)
REGULAR_NODE(FunctionLiteral)
REGULAR_NODE(Assignment)
REGULAR_NODE(Throw)
REGULAR_NODE(Property)
......@@ -1071,7 +1072,6 @@ DONT_OPTIMIZE_NODE(DebuggerStatement)
DONT_OPTIMIZE_NODE(SharedFunctionInfoLiteral)
DONT_INLINE_NODE(ArrayLiteral) // TODO(1322): Allow materialized literals.
DONT_INLINE_NODE(FunctionLiteral)
DONT_SELFOPTIMIZE_NODE(DoWhileStatement)
DONT_SELFOPTIMIZE_NODE(WhileStatement)
......
......@@ -87,3 +87,24 @@ TestRegExpLiteral("-b", "reg", "exp", "-expreg");
%OptimizeFunctionOnNextCall(TestRegExpLiteral);
TestRegExpLiteral("ab", "reg", "exp", "regexpexpreg");
TestRegExpLiteral("ab", 12345, 54321, "6666666666");
function f2(b, c) {
var closure = function(b, c) { return b + c; }
var value = b + c;
return closure;
}
function f1(a, b, c) {
return a + f2(b, c)(b, c);
}
function TestFunctionLiteral(a, b, c, expected) {
var result = f1(a, b, c);
assertEquals(expected, result, "TestFunctionLiteral");
}
TestFunctionLiteral(1, 2, 3, 6);
TestFunctionLiteral(4, 5, 6, 15);
%OptimizeFunctionOnNextCall(TestFunctionLiteral);
TestFunctionLiteral(7, 8, 9, 24);
TestFunctionLiteral("a", "b", "c", "abc");
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