Revision: 20265
Author:   [email protected]
Date:     Wed Mar 26 09:39:09 2014 UTC
Log: ARM64: Check size of code generated in ProfileEntryHookStub::MaybeCallEntryHook.

[email protected]

Review URL: https://codereview.chromium.org/200023005
http://code.google.com/p/v8/source/detail?r=20265

Modified:
 /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc

=======================================
--- /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Wed Mar 26 08:55:19 2014 UTC +++ /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Wed Mar 26 09:39:09 2014 UTC
@@ -4907,16 +4907,25 @@
   // Return to IC Miss stub, continuation still on stack.
   __ Ret();
 }
+
+
+// The entry hook is a "BumpSystemStackPointer" instruction (sub), followed by
+// a "Push lr" instruction, followed by a call.
+static const unsigned int kProfileEntryHookCallSize =
+    Assembler::kCallSizeWithRelocation + (2 * kInstructionSize);


 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
   if (masm->isolate()->function_entry_hook() != NULL) {
-    // TODO(all): This needs to be reliably consistent with
-    // kReturnAddressDistanceFromFunctionStart in ::Generate.
-    Assembler::BlockPoolsScope no_pools(masm);
     ProfileEntryHookStub stub;
+    Assembler::BlockConstPoolScope no_const_pools(masm);
+    Label entry_hook_call_start;
+    __ Bind(&entry_hook_call_start);
     __ Push(lr);
     __ CallStub(&stub);
+    ASSERT(masm->SizeOfCodeGeneratedSince(&entry_hook_call_start) ==
+           kProfileEntryHookCallSize);
+
     __ Pop(lr);
   }
 }
@@ -4924,10 +4933,6 @@

 void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
   MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm);
- // The entry hook is a "BumpSystemStackPointer" instruction (sub), followed by
-  // a "Push lr" instruction, followed by a call.
-  static const int kReturnAddressDistanceFromFunctionStart =
-      Assembler::kCallSizeWithRelocation + (2 * kInstructionSize);

// Save all kCallerSaved registers (including lr), since this can be called
   // from anywhere.
@@ -4937,7 +4942,7 @@
   const int kNumSavedRegs = kCallerSaved.Count();

   // Compute the function's address as the first argument.
-  __ Sub(x0, lr, kReturnAddressDistanceFromFunctionStart);
+  __ Sub(x0, lr, kProfileEntryHookCallSize);

 #if V8_HOST_ARCH_ARM64
   uintptr_t entry_hook =

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to