Faster invocation for most of API calls.
authorantonm@chromium.org <antonm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 11 Mar 2011 13:25:01 +0000 (13:25 +0000)
committerantonm@chromium.org <antonm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 11 Mar 2011 13:25:01 +0000 (13:25 +0000)
For most of API calls we generate better stub which is faster than invocation
via builtin, so use IC instead of direct call in Hydrogen.

Review URL: http://codereview.chromium.org/6672026

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7149 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen.cc

index 25a6db3ac178c12cf2b32f1351dc008502e7bb6f..6cb2b240a95b61103609b49d4f2532282985591d 100644 (file)
@@ -4267,10 +4267,12 @@ void HGraphBuilder::VisitCall(Call* expr) {
       }
 
       if (HasCustomCallGenerator(expr->target()) ||
+          CallOptimization(*expr->target()).is_simple_api_call() ||
           expr->check_type() != RECEIVER_MAP_CHECK) {
         // When the target has a custom call IC generator, use the IC,
-        // because it is likely to generate better code. Also use the
-        // IC when a primitive receiver check is required.
+        // because it is likely to generate better code.  Similarly, we
+        // generate better call stubs for some API functions.
+        // Also use the IC when a primitive receiver check is required.
         HContext* context = new HContext;
         AddInstruction(context);
         call = PreProcessCall(new HCallNamed(context, name, argument_count));