Revision: 18391
Author:   vego...@chromium.org
Date:     Fri Dec 20 14:07:19 2013 UTC
Log:      Fix sporadic crash in the RequestInterruptTestWithNativeAccessor.

The test was broken. V8 currently does not correctly lookup NativeDataProperty accessors attached to the PrototypeTemplate of FunctionTemplate (Issue 3066). As the result while(obj.shouldContinue) loop was immediately exiting and the test would terminate while RequestInterruptTestBase::InterruptThread would be still starting up. As the result later InterruptThread would try to access members of the test object which was destroyed.

The test was fixed:

- instead of attaching accessor to PrototypeTemplate we attach it to InstanceTemplate; - an assertion was added to verify that we completed the test successfully due to interruptor firing not due to sporadic loop termination due to some unrelated bug.

R=hpa...@chromium.org

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

Modified:
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Fri Dec 20 11:35:53 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Fri Dec 20 14:07:19 2013 UTC
@@ -21048,6 +21048,10 @@
     TestBody();

     isolate_->ClearInterrupt();
+
+    // Verify we arrived here because interruptor was called
+    // not due to a bug causing us to exit the loop too early.
+    CHECK(!should_continue());
   }

   void WakeUpInterruptor() {
@@ -21146,11 +21150,11 @@
  public:
   virtual void TestBody() {
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_);
-    v8::Local<v8::Template> proto = t->PrototypeTemplate();
-    proto->SetNativeDataProperty(v8_str("shouldContinue"),
-                                 &ShouldContinueNativeGetter,
-                                 NULL,
-                                 v8::External::New(isolate_, this));
+    t->InstanceTemplate()->SetNativeDataProperty(
+        v8_str("shouldContinue"),
+        &ShouldContinueNativeGetter,
+        NULL,
+        v8::External::New(isolate_, this));
     env_->Global()->Set(v8_str("Klass"), t->GetFunction());

     CompileRun("var obj = new Klass; while (obj.shouldContinue) { }");

--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to