Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 4e7b1a36ffebbe36a6ee8ad25224fb1d62f9d5c3..34b80828c0897851518335a5d4787e61a34116df 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -11310,13 +11310,17 @@ 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* elements = Add<HArgumentsElements>(false); |
- HArgumentsLength* result = New<HArgumentsLength>(elements); |
+ HInstruction* result = NULL; |
+ 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()); |
} |