diff --git a/src/ast.cc b/src/ast.cc index bf16b9c076..53d27999ea 100644 --- a/src/ast.cc +++ b/src/ast.cc @@ -1117,9 +1117,11 @@ void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { // optimize them. add_flag(kDontInline); } else if (node->function()->intrinsic_type == Runtime::INLINE && - node->raw_name()->IsOneByteEqualTo("_Arguments")) { - // Don't inline the %_Arguments because it's implementation will not work. - // There is no stack frame to get them from. + (node->raw_name()->IsOneByteEqualTo("_ArgumentsLength") || + node->raw_name()->IsOneByteEqualTo("_Arguments"))) { + // Don't inline the %_ArgumentsLength or %_Arguments because their + // implementation will not work. There is no stack frame to get them + // from. add_flag(kDontInline); } } diff --git a/src/hydrogen.cc b/src/hydrogen.cc index d447bbc9f7..6ae1466d62 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -11310,17 +11310,13 @@ void HOptimizedGraphBuilder::GenerateIsConstructCall(CallRuntime* call) { // Support for arguments.length and arguments[?]. 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); - HInstruction* result = NULL; - if (function_state()->outer() == NULL) { - HInstruction* elements = Add(false); - result = New(elements); - } else { - // Number of arguments without receiver. - int argument_count = environment()-> - arguments_environment()->parameter_count() - 1; - result = New(argument_count); - } + HInstruction* elements = Add(false); + HArgumentsLength* result = New(elements); return ast_context()->ReturnInstruction(result, call->id()); }