From 7be2555151c63ec5e0ec23da980bd302b5baa9ed Mon Sep 17 00:00:00 2001 From: bmeurer Date: Wed, 16 Sep 2015 23:31:12 -0700 Subject: [PATCH] Revert "[profiler] Make no frame region detection code more robust", "Fix ASAN after r30777" and "Fix MSAN warning after r30777 (try 2)" This reverts commits 12c7bc9a226859c3200609495689592a675a21af, cb0b3592258173c4d20e1500cbd5731e15b9e8b1, and a6e00c6a9f5a8abf2747293d7452dd0cf572c99e, because they introduced weird flaky crashes in random places now at least in the arm simulator, where it see that quite often now on different change sets, i.e. see http://build.chromium.org/p/tryserver.v8/builders/v8_linux_arm_rel/builds/8138/steps/Check%20%28flakes%29/logs/LoadICFastApi_DirectC.. and https://chromegw.corp.google.com/i/client.v8/builders/V8%20Linux%20-%20mipsel%20-%20sim/builds/2566/steps/Check%20%28flakes%29/logs/LoadICFastApi_DirectC.. for example. TBR=alph@chromium.org BUG=chromium:529931 NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true LOG=N Review URL: https://codereview.chromium.org/1354573002 Cr-Commit-Position: refs/heads/master@{#30786} --- src/sampler.cc | 68 -------------------------------------------------- 1 file changed, 68 deletions(-) diff --git a/src/sampler.cc b/src/sampler.cc index 5a7aac71b..4e669ca6d 100644 --- a/src/sampler.cc +++ b/src/sampler.cc @@ -173,69 +173,6 @@ class PlatformDataCommon : public Malloced { ThreadId profiled_thread_id_; }; - -bool IsSamePage(byte* ptr1, byte* ptr2) { - const uint32_t kPageSize = 4096; - uintptr_t mask = ~static_cast(kPageSize - 1); - return (reinterpret_cast(ptr1) & mask) == - (reinterpret_cast(ptr2) & mask); -} - - -// Check if the code at specified address could potentially be a -// frame setup code. -bool IsNoFrameRegion(Address address) { - struct Pattern { - int bytes_count; - byte bytes[8]; - int offsets[4]; - }; - byte* pc = reinterpret_cast(address); - static Pattern patterns[] = { -#if V8_HOST_ARCH_IA32 - // push %ebp - // mov %esp,%ebp - {3, {0x55, 0x89, 0xe5}, {0, 1, -1}}, - // pop %ebp - // ret N - {2, {0x5d, 0xc2}, {0, 1, -1}}, - // pop %ebp - // ret - {2, {0x5d, 0xc3}, {0, 1, -1}}, -#elif V8_HOST_ARCH_X64 - // pushq %rbp - // movq %rsp,%rbp - {4, {0x55, 0x48, 0x89, 0xe5}, {0, 1, -1}}, - // popq %rbp - // ret N - {2, {0x5d, 0xc2}, {0, 1, -1}}, - // popq %rbp - // ret - {2, {0x5d, 0xc3}, {0, 1, -1}}, -#endif - {0, {}, {}} - }; - for (Pattern* pattern = patterns; pattern->bytes_count; ++pattern) { - for (int* offset_ptr = pattern->offsets; *offset_ptr != -1; ++offset_ptr) { - int offset = *offset_ptr; - if (!offset || IsSamePage(pc, pc - offset)) { - MSAN_MEMORY_IS_INITIALIZED(pc - offset, pattern->bytes_count); - if (!memcmp(pc - offset, pattern->bytes, pattern->bytes_count)) - return true; - } else { - // It is not safe to examine bytes on another page as it might not be - // allocated thus causing a SEGFAULT. - // Check the pattern part that's on the same page and - // pessimistically assume it could be the entire pattern match. - MSAN_MEMORY_IS_INITIALIZED(pc, pattern->bytes_count - offset); - if (!memcmp(pc, pattern->bytes + offset, pattern->bytes_count - offset)) - return true; - } - } - } - return false; -} - } // namespace #if defined(USE_SIGNALS) @@ -655,11 +592,6 @@ DISABLE_ASAN void TickSample::Init(Isolate* isolate, Address js_entry_sp = isolate->js_entry_sp(); if (js_entry_sp == 0) return; // Not executing JS now. - if (pc && IsNoFrameRegion(pc)) { - pc = 0; - return; - } - ExternalCallbackScope* scope = isolate->external_callback_scope(); Address handler = Isolate::handler(isolate->thread_local_top()); // If there is a handler on top of the external callback scope then -- 2.34.1