Index: src/compiler/arm/code-generator-arm.cc |
diff --git a/src/compiler/arm/code-generator-arm.cc b/src/compiler/arm/code-generator-arm.cc |
index bc11f5a7b5c72f056fe6906b75a988dc6ef298a3..0bb0aaa0cc24e774a5826a494119fb1f063fef36 100644 |
--- a/src/compiler/arm/code-generator-arm.cc |
+++ b/src/compiler/arm/code-generator-arm.cc |
@@ -156,9 +156,13 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
break; |
} |
case kArchCallJSFunction: { |
- // TODO(jarin) The load of the context should be separated from the call. |
Register func = i.InputRegister(0); |
- __ ldr(cp, FieldMemOperand(func, JSFunction::kContextOffset)); |
+ if (FLAG_debug_code) { |
+ // Check the function's context matches the context argument. |
+ __ ldr(kScratchReg, FieldMemOperand(func, JSFunction::kContextOffset)); |
+ __ cmp(cp, kScratchReg); |
+ __ Assert(eq, kWrongFunctionContext); |
+ } |
__ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
__ Call(ip); |
AddSafepointAndDeopt(instr); |
@@ -682,7 +686,7 @@ void CodeGenerator::AssembleReturn() { |
} else { |
__ LeaveFrame(StackFrame::MANUAL); |
int pop_count = |
- descriptor->IsJSFunctionCall() ? descriptor->ParameterCount() : 0; |
+ descriptor->IsJSFunctionCall() ? descriptor->JSParamCount() : 0; |
__ Drop(pop_count); |
__ Ret(); |
} |