Revision: 17047
Author:   [email protected]
Date:     Tue Oct  1 13:54:53 2013 UTC
Log:      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
[email protected]

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

Modified:
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/isolate.h
 /branches/bleeding_edge/src/sampler.cc
 /branches/bleeding_edge/test/cctest/cctest.status
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/src/isolate.cc      Mon Sep 30 14:06:43 2013 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Tue Oct  1 13:54:53 2013 UTC
@@ -120,11 +120,7 @@
 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 @@
   // 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);
=======================================
--- /branches/bleeding_edge/src/isolate.h       Mon Sep 30 14:06:43 2013 UTC
+++ /branches/bleeding_edge/src/isolate.h       Tue Oct  1 13:54:53 2013 UTC
@@ -273,10 +273,8 @@
   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
=======================================
--- /branches/bleeding_edge/src/sampler.cc      Thu Aug 29 14:03:38 2013 UTC
+++ /branches/bleeding_edge/src/sampler.cc      Tue Oct  1 13:54:53 2013 UTC
@@ -216,11 +216,7 @@
 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;
   }
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.status Tue Sep 24 12:08:33 2013 UTC +++ /branches/bleeding_edge/test/cctest/cctest.status Tue Oct 1 13:54:53 2013 UTC
@@ -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', {
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Tue Oct 1 09:56:04 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Tue Oct 1 13:54:53 2013 UTC
@@ -77,19 +77,12 @@
 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)()) {

--
--
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/groups/opt_out.

Reply via email to