| Index: src/x64/fast-codegen-x64.cc
|
| ===================================================================
|
| --- src/x64/fast-codegen-x64.cc (revision 3370)
|
| +++ src/x64/fast-codegen-x64.cc (working copy)
|
| @@ -1252,9 +1252,13 @@
|
| void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
| Comment cmnt(masm_, "[ CallRuntime");
|
| ZoneList<Expression*>* args = expr->arguments();
|
| - Runtime::Function* function = expr->function();
|
|
|
| - ASSERT(function != NULL);
|
| + if (expr->is_jsruntime()) {
|
| + // Prepare for calling JS runtime function.
|
| + __ Push(expr->name());
|
| + __ movq(rax, CodeGenerator::GlobalObject());
|
| + __ push(FieldOperand(rax, GlobalObject::kBuiltinsOffset));
|
| + }
|
|
|
| // Push the arguments ("left-to-right").
|
| int arg_count = args->length();
|
| @@ -1263,8 +1267,19 @@
|
| ASSERT_EQ(Expression::kValue, args->at(i)->context());
|
| }
|
|
|
| - __ CallRuntime(function, arg_count);
|
| - Move(expr->context(), rax);
|
| + if (expr->is_jsruntime()) {
|
| + // Call the JS runtime function.
|
| + Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count,
|
| + NOT_IN_LOOP);
|
| + __ call(ic, RelocInfo::CODE_TARGET);
|
| + // Restore context register.
|
| + __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
|
| + // Discard the function left on TOS.
|
| + DropAndMove(expr->context(), rax);
|
| + } else {
|
| + __ CallRuntime(expr->function(), arg_count);
|
| + Move(expr->context(), rax);
|
| + }
|
| }
|
|
|
| void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|
|