Refactored DirectCEntryStub::GenerateCall a bit to make it clearer what's going on...
authorsvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 16 Aug 2011 09:58:34 +0000 (09:58 +0000)
committersvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 16 Aug 2011 09:58:34 +0000 (09:58 +0000)
Review URL: http://codereview.chromium.org/7640016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8938 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/arm/code-stubs-arm.cc

index 995f0d9f4386d9bbaf21a4d3476a94e8628f3d2f..82fa8ceaf318a043620d0c67255c4dc344ba97fe 100644 (file)
@@ -6315,14 +6315,8 @@ void DirectCEntryStub::Generate(MacroAssembler* masm) {
 
 void DirectCEntryStub::GenerateCall(MacroAssembler* masm,
                                     ExternalReference function) {
-  __ mov(lr, Operand(reinterpret_cast<intptr_t>(GetCode().location()),
-                     RelocInfo::CODE_TARGET));
   __ mov(r2, Operand(function));
-  // Push return address (accessible to GC through exit frame pc).
-  // Note that using pc with str is deprecated.
-  __ add(ip, pc, Operand(4));
-  __ str(ip, MemOperand(sp, 0));
-  __ Jump(r2);  // Call the api function.
+  GenerateCall(masm, r2);
 }
 
 
@@ -6332,9 +6326,13 @@ void DirectCEntryStub::GenerateCall(MacroAssembler* masm,
                      RelocInfo::CODE_TARGET));
   // Push return address (accessible to GC through exit frame pc).
   // Note that using pc with str is deprecated.
-  __ add(ip, pc, Operand(4));
+  Label start;
+  __ bind(&start);
+  __ add(ip, pc, Operand(Assembler::kInstrSize));
   __ str(ip, MemOperand(sp, 0));
   __ Jump(target);  // Call the C++ function.
+  ASSERT_EQ(Assembler::kInstrSize + Assembler::kPcLoadDelta,
+            masm->SizeOfCodeGeneratedSince(&start));
 }