Fix threading problems in test-api when running on simulator

Sampler can retrieve current simulator for profiled isolate from its ThreadLocalTop without calls to Isolate::FindPerThreadDataForThread which sometimes leads to acquring same mutex second time.

BUG=v8:2874
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/25053002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17047 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yurys@chromium.org 2013-10-01 13:54:53 +00:00
parent 54b3745503
commit b3c440f8da
5 changed files with 1 additions and 25 deletions

View File

@ -120,11 +120,7 @@ void ThreadLocalTop::InitializeInternal() {
void ThreadLocalTop::Initialize() {
InitializeInternal();
#ifdef USE_SIMULATOR
#if V8_TARGET_ARCH_ARM
simulator_ = Simulator::current(isolate_);
#elif V8_TARGET_ARCH_MIPS
simulator_ = Simulator::current(isolate_);
#endif
#endif
thread_id_ = ThreadId::Current();
}
@ -1670,11 +1666,7 @@ char* Isolate::RestoreThread(char* from) {
// This might be just paranoia, but it seems to be needed in case a
// thread_local_top_ is restored on a separate OS thread.
#ifdef USE_SIMULATOR
#if V8_TARGET_ARCH_ARM
thread_local_top()->simulator_ = Simulator::current(this);
#elif V8_TARGET_ARCH_MIPS
thread_local_top()->simulator_ = Simulator::current(this);
#endif
#endif
ASSERT(context() == NULL || context()->IsContext());
return from + sizeof(ThreadLocalTop);

View File

@ -273,10 +273,8 @@ class ThreadLocalTop BASE_EMBEDDED {
Address handler_; // try-blocks are chained through the stack
#ifdef USE_SIMULATOR
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS
Simulator* simulator_;
#endif
#endif // USE_SIMULATOR
Address js_entry_sp_; // the stack pointer of the bottom JS entry frame
// the external callback we're currently in

View File

@ -216,11 +216,7 @@ class Sampler::PlatformData : public PlatformDataCommon {
class SimulatorHelper {
public:
inline bool Init(Sampler* sampler, Isolate* isolate) {
ThreadId thread_id = sampler->platform_data()->profiled_thread_id();
Isolate::PerIsolateThreadData* per_thread_data = isolate->
FindPerThreadDataForThread(thread_id);
if (!per_thread_data) return false;
simulator_ = per_thread_data->simulator();
simulator_ = isolate->thread_local_top()->simulator_;
// Check if there is active simulator.
return simulator_ != NULL;
}

View File

@ -82,9 +82,6 @@
'test-serialize/DeserializeFromSecondSerializationAndRunScript2': [SKIP],
'test-serialize/DeserializeAndRunScript2': [SKIP],
'test-serialize/DeserializeFromSecondSerialization': [SKIP],
# BUG(2874): Threading problems.
'test-api/*': [PASS, FLAKY],
}], # 'arch == arm'
##############################################################################
['arch == mipsel', {

View File

@ -77,19 +77,12 @@ using ::v8::V8;
using ::v8::Value;
// TODO(bmeurer): Don't run profiled tests when using the simulator.
// This is a temporary work-around, until the profiler is fixed.
#if USE_SIMULATOR
#define THREADED_PROFILED_TEST(Name) \
THREADED_TEST(Name)
#else
#define THREADED_PROFILED_TEST(Name) \
static void Test##Name(); \
TEST(Name##WithProfiler) { \
RunWithProfiler(&Test##Name); \
} \
THREADED_TEST(Name)
#endif
void RunWithProfiler(void (*test)()) {