@@ -46,21 +46,6 @@ bool PCIsInCodePages(size_t code_pages_length, const MemoryRange* code_pages,
4646 return it->start <= pc && pc < CalculateEnd (it->start , it->length_in_bytes );
4747}
4848
49- bool IsInJSEntryRange (const UnwindState& unwind_state, void * pc) {
50- return PCIsInCodeRange (unwind_state.js_entry_stub .code , pc) ||
51- PCIsInCodeRange (unwind_state.js_construct_entry_stub .code , pc) ||
52- PCIsInCodeRange (unwind_state.js_run_microtasks_entry_stub .code , pc);
53- }
54-
55- bool IsInUnsafeJSEntryRange (const UnwindState& unwind_state, void * pc) {
56- return IsInJSEntryRange (unwind_state, pc);
57-
58- // TODO(petermarshall): We can be more precise by checking whether we are
59- // in JSEntry but after frame setup and before frame teardown, in which case
60- // we are safe to unwind the stack. For now, we bail out if the PC is anywhere
61- // within JSEntry.
62- }
63-
6449bool IsInJSEntryRange (const JSEntryStubs& entry_stubs, void * pc) {
6550 return PCIsInCodeRange (entry_stubs.js_entry_stub .code , pc) ||
6651 PCIsInCodeRange (entry_stubs.js_construct_entry_stub .code , pc) ||
@@ -80,19 +65,6 @@ i::Address Load(i::Address address) {
8065 return *reinterpret_cast <i::Address*>(address);
8166}
8267
83- void * GetReturnAddressFromFP (void * fp, void * pc,
84- const v8::UnwindState& unwind_state) {
85- int caller_pc_offset = i::CommonFrameConstants::kCallerPCOffset ;
86- #ifdef V8_TARGET_ARCH_ARM64
87- if (IsInJSEntryRange (unwind_state, pc)) {
88- caller_pc_offset = i::EntryFrameConstants::kDirectCallerPCOffset ;
89- }
90- #endif
91- i::Address ret_addr =
92- Load (reinterpret_cast <i::Address>(fp) + caller_pc_offset);
93- return reinterpret_cast <void *>(i::PointerAuthentication::StripPAC (ret_addr));
94- }
95-
9668void * GetReturnAddressFromFP (void * fp, void * pc,
9769 const JSEntryStubs& entry_stubs) {
9870 int caller_pc_offset = i::CommonFrameConstants::kCallerPCOffset ;
@@ -106,18 +78,6 @@ void* GetReturnAddressFromFP(void* fp, void* pc,
10678 return reinterpret_cast <void *>(i::PointerAuthentication::StripPAC (ret_addr));
10779}
10880
109- void * GetCallerFPFromFP (void * fp, void * pc,
110- const v8::UnwindState& unwind_state) {
111- int caller_fp_offset = i::CommonFrameConstants::kCallerFPOffset ;
112- #ifdef V8_TARGET_ARCH_ARM64
113- if (IsInJSEntryRange (unwind_state, pc)) {
114- caller_fp_offset = i::EntryFrameConstants::kDirectCallerFPOffset ;
115- }
116- #endif
117- return reinterpret_cast <void *>(
118- Load (reinterpret_cast <i::Address>(fp) + caller_fp_offset));
119- }
120-
12181void * GetCallerFPFromFP (void * fp, void * pc, const JSEntryStubs& entry_stubs) {
12282 int caller_fp_offset = i::CommonFrameConstants::kCallerFPOffset ;
12383#ifdef V8_TARGET_ARCH_ARM64
@@ -129,18 +89,6 @@ void* GetCallerFPFromFP(void* fp, void* pc, const JSEntryStubs& entry_stubs) {
12989 Load (reinterpret_cast <i::Address>(fp) + caller_fp_offset));
13090}
13191
132- void * GetCallerSPFromFP (void * fp, void * pc,
133- const v8::UnwindState& unwind_state) {
134- int caller_sp_offset = i::CommonFrameConstants::kCallerSPOffset ;
135- #ifdef V8_TARGET_ARCH_ARM64
136- if (IsInJSEntryRange (unwind_state, pc)) {
137- caller_sp_offset = i::EntryFrameConstants::kDirectCallerSPOffset ;
138- }
139- #endif
140- return reinterpret_cast <void *>(reinterpret_cast <i::Address>(fp) +
141- caller_sp_offset);
142- }
143-
14492void * GetCallerSPFromFP (void * fp, void * pc, const JSEntryStubs& entry_stubs) {
14593 int caller_sp_offset = i::CommonFrameConstants::kCallerSPOffset ;
14694#ifdef V8_TARGET_ARCH_ARM64
@@ -159,46 +107,6 @@ bool AddressIsInStack(const void* address, const void* stack_base,
159107
160108} // namespace
161109
162- bool Unwinder::TryUnwindV8Frames (const UnwindState& unwind_state,
163- RegisterState* register_state,
164- const void * stack_base) {
165- const void * stack_top = register_state->sp ;
166-
167- void * pc = register_state->pc ;
168- if (PCIsInV8 (unwind_state, pc) && !IsInUnsafeJSEntryRange (unwind_state, pc)) {
169- void * current_fp = register_state->fp ;
170- if (!AddressIsInStack (current_fp, stack_base, stack_top)) return false ;
171-
172- // Peek at the return address that the caller pushed. If it's in V8, then we
173- // assume the caller frame is a JS frame and continue to unwind.
174- void * next_pc = GetReturnAddressFromFP (current_fp, pc, unwind_state);
175- while (PCIsInV8 (unwind_state, next_pc)) {
176- current_fp = GetCallerFPFromFP (current_fp, pc, unwind_state);
177- if (!AddressIsInStack (current_fp, stack_base, stack_top)) return false ;
178- pc = next_pc;
179- next_pc = GetReturnAddressFromFP (current_fp, pc, unwind_state);
180- }
181-
182- void * final_sp = GetCallerSPFromFP (current_fp, pc, unwind_state);
183- if (!AddressIsInStack (final_sp, stack_base, stack_top)) return false ;
184- register_state->sp = final_sp;
185-
186- // We don't check that the final FP value is within the stack bounds because
187- // this is just the rbp value that JSEntryStub pushed. On platforms like
188- // Win64 this is not used as a dedicated FP register, and could contain
189- // anything.
190- void * final_fp = GetCallerFPFromFP (current_fp, pc, unwind_state);
191- register_state->fp = final_fp;
192-
193- register_state->pc = next_pc;
194-
195- // Link register no longer valid after unwinding.
196- register_state->lr = nullptr ;
197- return true ;
198- }
199- return false ;
200- }
201-
202110bool Unwinder::TryUnwindV8Frames (const JSEntryStubs& entry_stubs,
203111 size_t code_pages_length,
204112 const MemoryRange* code_pages,
@@ -242,11 +150,6 @@ bool Unwinder::TryUnwindV8Frames(const JSEntryStubs& entry_stubs,
242150 return false ;
243151}
244152
245- bool Unwinder::PCIsInV8 (const UnwindState& unwind_state, void * pc) {
246- return pc && (PCIsInCodeRange (unwind_state.code_range , pc) ||
247- PCIsInCodeRange (unwind_state.embedded_code_range , pc));
248- }
249-
250153bool Unwinder::PCIsInV8 (size_t code_pages_length, const MemoryRange* code_pages,
251154 void * pc) {
252155 return pc && PCIsInCodePages (code_pages_length, code_pages, pc);
0 commit comments