Index: src/crankshaft/hydrogen.cc |
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc |
index b869f27184c4f3a9d002d888349bfb23beb1d564..f4544e0e61e0c85980069f6f1135e9d0127d9169 100644 |
--- a/src/crankshaft/hydrogen.cc |
+++ b/src/crankshaft/hydrogen.cc |
@@ -10477,7 +10477,21 @@ void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) { |
DCHECK(current_block() != NULL); |
DCHECK(current_block()->HasPredecessor()); |
if (expr->is_jsruntime()) { |
- return Bailout(kCallToAJavaScriptRuntimeFunction); |
+ // The callee and the receiver both have to be pushed onto the operand stack |
+ // before arguments are being evaluated. |
+ HValue* function = AddLoadJSBuiltin(expr->context_index()); |
+ HValue* receiver = graph()->GetConstantUndefined(); |
+ Push(function); |
+ Push(receiver); |
+ |
+ int argument_count = expr->arguments()->length() + 1; // Count receiver. |
+ CHECK_ALIVE(VisitExpressions(expr->arguments())); |
+ PushArgumentsFromEnvironment(argument_count); |
+ HInstruction* call = NewCallFunction(function, argument_count, |
+ ConvertReceiverMode::kNullOrUndefined, |
+ TailCallMode::kDisallow); |
+ Drop(1); // Function |
+ return ast_context()->ReturnInstruction(call, expr->id()); |
} |
const Runtime::Function* function = expr->function(); |