Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: test/cctest/test-api.cc

Issue 109653010: Fix sporadic crash in the RequestInterruptTestWithNativeAccessor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 21030 matching lines...) Expand 10 before | Expand all | Expand 10 after
21041 21041
21042 void RunTest() { 21042 void RunTest() {
21043 InterruptThread i_thread(this); 21043 InterruptThread i_thread(this);
21044 i_thread.Start(); 21044 i_thread.Start();
21045 21045
21046 v8::HandleScope handle_scope(isolate_); 21046 v8::HandleScope handle_scope(isolate_);
21047 21047
21048 TestBody(); 21048 TestBody();
21049 21049
21050 isolate_->ClearInterrupt(); 21050 isolate_->ClearInterrupt();
21051
21052 // Verify we arrived here because interruptor was called
21053 // not due to a bug causing us to exit the loop too early.
21054 CHECK(!should_continue());
21051 } 21055 }
21052 21056
21053 void WakeUpInterruptor() { 21057 void WakeUpInterruptor() {
21054 sem_.Signal(); 21058 sem_.Signal();
21055 } 21059 }
21056 21060
21057 bool should_continue() const { return should_continue_; } 21061 bool should_continue() const { return should_continue_; }
21058 21062
21059 bool ShouldContinue() { 21063 bool ShouldContinue() {
21060 if (warmup_ > 0) { 21064 if (warmup_ > 0) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
21139 21143
21140 CompileRun("var obj = new Klass; while (obj.shouldContinue) { }"); 21144 CompileRun("var obj = new Klass; while (obj.shouldContinue) { }");
21141 } 21145 }
21142 }; 21146 };
21143 21147
21144 21148
21145 class RequestInterruptTestWithNativeAccessor : public RequestInterruptTestBase { 21149 class RequestInterruptTestWithNativeAccessor : public RequestInterruptTestBase {
21146 public: 21150 public:
21147 virtual void TestBody() { 21151 virtual void TestBody() {
21148 v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_); 21152 v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_);
21149 v8::Local<v8::Template> proto = t->PrototypeTemplate(); 21153 t->InstanceTemplate()->SetNativeDataProperty(
21150 proto->SetNativeDataProperty(v8_str("shouldContinue"), 21154 v8_str("shouldContinue"),
21151 &ShouldContinueNativeGetter, 21155 &ShouldContinueNativeGetter,
21152 NULL, 21156 NULL,
21153 v8::External::New(isolate_, this)); 21157 v8::External::New(isolate_, this));
21154 env_->Global()->Set(v8_str("Klass"), t->GetFunction()); 21158 env_->Global()->Set(v8_str("Klass"), t->GetFunction());
21155 21159
21156 CompileRun("var obj = new Klass; while (obj.shouldContinue) { }"); 21160 CompileRun("var obj = new Klass; while (obj.shouldContinue) { }");
21157 } 21161 }
21158 21162
21159 private: 21163 private:
21160 static void ShouldContinueNativeGetter( 21164 static void ShouldContinueNativeGetter(
21161 Local<String> property, 21165 Local<String> property,
21162 const v8::PropertyCallbackInfo<v8::Value>& info) { 21166 const v8::PropertyCallbackInfo<v8::Value>& info) {
21163 RequestInterruptTestBase* test = 21167 RequestInterruptTestBase* test =
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
21326 } 21330 }
21327 for (int i = 0; i < runs; i++) { 21331 for (int i = 0; i < runs; i++) {
21328 Local<String> expected; 21332 Local<String> expected;
21329 if (i != 0) { 21333 if (i != 0) {
21330 CHECK_EQ(v8_str("escape value"), values[i]); 21334 CHECK_EQ(v8_str("escape value"), values[i]);
21331 } else { 21335 } else {
21332 CHECK(values[i].IsEmpty()); 21336 CHECK(values[i].IsEmpty());
21333 } 21337 }
21334 } 21338 }
21335 } 21339 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698