Reland "Allow inlining of functions containing %_ArgumentsLength."

The layout test failures were unrelated to this change.

R=svenpanne@chromium.org
TBR=svenpanne@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22038 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2014-06-26 11:55:31 +00:00
parent 7f5c66b26b
commit 1824edd6bc
2 changed files with 13 additions and 11 deletions

View File

@ -1117,11 +1117,9 @@ void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
// optimize them. // optimize them.
add_flag(kDontInline); add_flag(kDontInline);
} else if (node->function()->intrinsic_type == Runtime::INLINE && } else if (node->function()->intrinsic_type == Runtime::INLINE &&
(node->raw_name()->IsOneByteEqualTo("_ArgumentsLength") || node->raw_name()->IsOneByteEqualTo("_Arguments")) {
node->raw_name()->IsOneByteEqualTo("_Arguments"))) { // Don't inline the %_Arguments because it's implementation will not work.
// Don't inline the %_ArgumentsLength or %_Arguments because their // There is no stack frame to get them from.
// implementation will not work. There is no stack frame to get them
// from.
add_flag(kDontInline); add_flag(kDontInline);
} }
} }

View File

@ -11310,13 +11310,17 @@ void HOptimizedGraphBuilder::GenerateIsConstructCall(CallRuntime* call) {
// Support for arguments.length and arguments[?]. // Support for arguments.length and arguments[?].
void HOptimizedGraphBuilder::GenerateArgumentsLength(CallRuntime* call) { void HOptimizedGraphBuilder::GenerateArgumentsLength(CallRuntime* call) {
// Our implementation of arguments (based on this stack frame or an
// adapter below it) does not work for inlined functions. This runtime
// function is blacklisted by AstNode::IsInlineable.
ASSERT(function_state()->outer() == NULL);
ASSERT(call->arguments()->length() == 0); ASSERT(call->arguments()->length() == 0);
HInstruction* elements = Add<HArgumentsElements>(false); HInstruction* result = NULL;
HArgumentsLength* result = New<HArgumentsLength>(elements); if (function_state()->outer() == NULL) {
HInstruction* elements = Add<HArgumentsElements>(false);
result = New<HArgumentsLength>(elements);
} else {
// Number of arguments without receiver.
int argument_count = environment()->
arguments_environment()->parameter_count() - 1;
result = New<HConstant>(argument_count);
}
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }