Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: src/arm64/code-stubs-arm64.cc

Issue 200023005: ARM64: Check size of code generated in ProfileEntryHookStub::MaybeCallEntryHook. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4891 matching lines...) Expand 10 before | Expand all | Expand 10 after
4902 if (function_mode_ == JS_FUNCTION_STUB_MODE) { 4902 if (function_mode_ == JS_FUNCTION_STUB_MODE) {
4903 __ Add(x1, x1, 1); 4903 __ Add(x1, x1, 1);
4904 } 4904 }
4905 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); 4905 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
4906 __ Drop(x1); 4906 __ Drop(x1);
4907 // Return to IC Miss stub, continuation still on stack. 4907 // Return to IC Miss stub, continuation still on stack.
4908 __ Ret(); 4908 __ Ret();
4909 } 4909 }
4910 4910
4911 4911
4912 // The entry hook is a "BumpSystemStackPointer" instruction (sub), followed by
4913 // a "Push lr" instruction, followed by a call.
4914 static const unsigned int kProfileEntryHookCallSize =
4915 Assembler::kCallSizeWithRelocation + (2 * kInstructionSize);
4916
4917
4912 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { 4918 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
4913 if (masm->isolate()->function_entry_hook() != NULL) { 4919 if (masm->isolate()->function_entry_hook() != NULL) {
4914 // TODO(all): This needs to be reliably consistent with
4915 // kReturnAddressDistanceFromFunctionStart in ::Generate.
4916 Assembler::BlockPoolsScope no_pools(masm);
4917 ProfileEntryHookStub stub; 4920 ProfileEntryHookStub stub;
4921 Assembler::BlockConstPoolScope no_const_pools(masm);
4922 Label entry_hook_call_start;
4923 __ Bind(&entry_hook_call_start);
4918 __ Push(lr); 4924 __ Push(lr);
4919 __ CallStub(&stub); 4925 __ CallStub(&stub);
4926 ASSERT(masm->SizeOfCodeGeneratedSince(&entry_hook_call_start) ==
4927 kProfileEntryHookCallSize);
4928
4920 __ Pop(lr); 4929 __ Pop(lr);
4921 } 4930 }
4922 } 4931 }
4923 4932
4924 4933
4925 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { 4934 void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
4926 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm); 4935 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm);
4927 // The entry hook is a "BumpSystemStackPointer" instruction (sub), followed by
4928 // a "Push lr" instruction, followed by a call.
4929 static const int kReturnAddressDistanceFromFunctionStart =
4930 Assembler::kCallSizeWithRelocation + (2 * kInstructionSize);
4931 4936
4932 // Save all kCallerSaved registers (including lr), since this can be called 4937 // Save all kCallerSaved registers (including lr), since this can be called
4933 // from anywhere. 4938 // from anywhere.
4934 // TODO(jbramley): What about FP registers? 4939 // TODO(jbramley): What about FP registers?
4935 __ PushCPURegList(kCallerSaved); 4940 __ PushCPURegList(kCallerSaved);
4936 ASSERT(kCallerSaved.IncludesAliasOf(lr)); 4941 ASSERT(kCallerSaved.IncludesAliasOf(lr));
4937 const int kNumSavedRegs = kCallerSaved.Count(); 4942 const int kNumSavedRegs = kCallerSaved.Count();
4938 4943
4939 // Compute the function's address as the first argument. 4944 // Compute the function's address as the first argument.
4940 __ Sub(x0, lr, kReturnAddressDistanceFromFunctionStart); 4945 __ Sub(x0, lr, kProfileEntryHookCallSize);
4941 4946
4942 #if V8_HOST_ARCH_ARM64 4947 #if V8_HOST_ARCH_ARM64
4943 uintptr_t entry_hook = 4948 uintptr_t entry_hook =
4944 reinterpret_cast<uintptr_t>(masm->isolate()->function_entry_hook()); 4949 reinterpret_cast<uintptr_t>(masm->isolate()->function_entry_hook());
4945 __ Mov(x10, entry_hook); 4950 __ Mov(x10, entry_hook);
4946 #else 4951 #else
4947 // Under the simulator we need to indirect the entry hook through a trampoline 4952 // Under the simulator we need to indirect the entry hook through a trampoline
4948 // function at a known address. 4953 // function at a known address.
4949 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); 4954 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline));
4950 __ Mov(x10, Operand(ExternalReference(&dispatcher, 4955 __ Mov(x10, Operand(ExternalReference(&dispatcher,
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
5726 MemOperand(fp, 6 * kPointerSize), 5731 MemOperand(fp, 6 * kPointerSize),
5727 NULL); 5732 NULL);
5728 } 5733 }
5729 5734
5730 5735
5731 #undef __ 5736 #undef __
5732 5737
5733 } } // namespace v8::internal 5738 } } // namespace v8::internal
5734 5739
5735 #endif // V8_TARGET_ARCH_ARM64 5740 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698