Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index f9adf49b8ff2920b22553400f554f963d39fa6ab..aaef0a5f79510d67a3936826b6fedcb37dddc3a2 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -8748,8 +8748,16 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) { |
graph()->MarkRecursive(); |
} |
- call = PreProcessCall(new(zone()) HCallKnownGlobal(expr->target(), |
+ if (CallStubCompiler::HasCustomCallGenerator(expr->target())) { |
+ // When the target has a custom call IC generator, use the IC, |
+ // because it is likely to generate better code. |
+ HValue* context = environment()->LookupContext(); |
+ call = PreProcessCall( |
+ new(zone()) HCallNamed(context, var->name(), argument_count)); |
+ } else { |
+ call = PreProcessCall(new(zone()) HCallKnownGlobal(expr->target(), |
argument_count)); |
+ } |
} else { |
HValue* context = environment()->LookupContext(); |
HGlobalObject* receiver = new(zone()) HGlobalObject(context); |