Reviewers: Sven Panne,

Description:
Reland "Allow inlining of functions containing %_ArgumentsLength."

The layout test failures were unrelated to this change.

[email protected]

Please review this at https://codereview.chromium.org/355993002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+13, -11 lines):
  M src/ast.cc
  M src/hydrogen.cc


Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index 53d27999ea073768fd0f879121cddf7964974732..bf16b9c076b8786ce1cb4a2eecf4963f79d70fe9 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -1117,11 +1117,9 @@ void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
     // optimize them.
     add_flag(kDontInline);
   } else if (node->function()->intrinsic_type == Runtime::INLINE &&
-             (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.
+             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.
     add_flag(kDontInline);
   }
 }
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 6ae1466d62de54427cc9992af757099705339594..d447bbc9f76cbcb6d16990ed22233d11b154e1d1 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());
 }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to