Revision: 22038
Author:   [email protected]
Date:     Thu Jun 26 11:55:31 2014 UTC
Log:      Reland "Allow inlining of functions containing %_ArgumentsLength."

The layout test failures were unrelated to this change.

[email protected]
[email protected]

Review URL: https://codereview.chromium.org/355993002
http://code.google.com/p/v8/source/detail?r=22038

Modified:
 /branches/bleeding_edge/src/ast.cc
 /branches/bleeding_edge/src/hydrogen.cc

=======================================
--- /branches/bleeding_edge/src/ast.cc  Wed Jun 25 17:21:44 2014 UTC
+++ /branches/bleeding_edge/src/ast.cc  Thu Jun 26 11:55:31 2014 UTC
@@ -1117,11 +1117,9 @@
     // 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);
   }
 }
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Wed Jun 25 17:21:44 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc     Thu Jun 26 11:55:31 2014 UTC
@@ -11310,13 +11310,17 @@

 // 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