Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 9007d0903b5b7d92f262ac3c6e70c22000247745..d6c1ec6d28871e1a75165d270bdc4ca3f4cdbeac 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -5530,7 +5530,21 @@ void HGraphBuilder::GenerateSwapElements(CallRuntime* call) { |
// Fast call for custom callbacks. |
void HGraphBuilder::GenerateCallFunction(CallRuntime* call) { |
- return Bailout("inlined runtime function: CallFunction"); |
+ // 1 ~ The function to call is not itself an argument to the call. |
+ int arg_count = call->arguments()->length() - 1; |
+ ASSERT(arg_count >= 1); // There's always at least a receiver. |
fschneider
2011/04/13 16:59:30
Can this also be >= 2 (receiver + function)?
|
+ |
+ for (int i = 0; i < arg_count; ++i) { |
+ CHECK_ALIVE(VisitArgument(call->arguments()->at(i))); |
+ } |
+ CHECK_ALIVE(VisitForValue(call->arguments()->last())); |
+ HValue* function = Pop(); |
+ HContext* context = new HContext; |
+ AddInstruction(context); |
+ HInvokeFunction* result = |
+ new(zone()) HInvokeFunction(context, function, arg_count); |
+ Drop(arg_count); |
+ ast_context()->ReturnInstruction(result, call->id()); |
} |