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

Side by Side Diff: test/cctest/test-thread-termination.cc

Issue 2342443003: [DO NOT COMMIT] IsExecutionTerminating test (Closed)
Patch Set: Created 4 years, 3 months 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
« 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 CreateGlobalTemplate(CcTest::isolate(), Signal, DoLoop); 194 CreateGlobalTemplate(CcTest::isolate(), Signal, DoLoop);
195 v8::Local<v8::Context> context = 195 v8::Local<v8::Context> context =
196 v8::Context::New(CcTest::isolate(), NULL, global); 196 v8::Context::New(CcTest::isolate(), NULL, global);
197 v8::Context::Scope context_scope(context); 197 v8::Context::Scope context_scope(context);
198 CHECK(!CcTest::isolate()->IsExecutionTerminating()); 198 CHECK(!CcTest::isolate()->IsExecutionTerminating());
199 // Run a loop that will be infinite if thread termination does not work. 199 // Run a loop that will be infinite if thread termination does not work.
200 v8::MaybeLocal<v8::Value> result = 200 v8::MaybeLocal<v8::Value> result =
201 CompileRun(CcTest::isolate()->GetCurrentContext(), 201 CompileRun(CcTest::isolate()->GetCurrentContext(),
202 "try { loop(); fail(); } catch(e) { fail(); }"); 202 "try { loop(); fail(); } catch(e) { fail(); }");
203 CHECK(result.IsEmpty()); 203 CHECK(result.IsEmpty());
204 CHECK(CcTest::isolate()->IsExecutionTerminating());
204 thread.Join(); 205 thread.Join();
205 delete semaphore; 206 delete semaphore;
206 semaphore = NULL; 207 semaphore = NULL;
207 } 208 }
208 209
209 // Test that execution can be terminated from within JSON.stringify. 210 // Test that execution can be terminated from within JSON.stringify.
210 TEST(TerminateJsonStringify) { 211 TEST(TerminateJsonStringify) {
211 semaphore = new v8::base::Semaphore(0); 212 semaphore = new v8::base::Semaphore(0);
212 TerminatorThread thread(CcTest::i_isolate()); 213 TerminatorThread thread(CcTest::i_isolate());
213 thread.Start(); 214 thread.Start();
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 CHECK(value->IsFunction()); 586 CHECK(value->IsFunction());
586 // The first stack check after terminate has been re-requested fails. 587 // The first stack check after terminate has been re-requested fails.
587 CHECK(CompileRun("1 + 1").IsEmpty()); 588 CHECK(CompileRun("1 + 1").IsEmpty());
588 CHECK(!isolate->IsExecutionTerminating()); 589 CHECK(!isolate->IsExecutionTerminating());
589 // V8 then recovers. 590 // V8 then recovers.
590 v8::Maybe<int32_t> result = CompileRun("2 + 2")->Int32Value( 591 v8::Maybe<int32_t> result = CompileRun("2 + 2")->Int32Value(
591 v8::Isolate::GetCurrent()->GetCurrentContext()); 592 v8::Isolate::GetCurrent()->GetCurrentContext());
592 CHECK_EQ(4, result.FromJust()); 593 CHECK_EQ(4, result.FromJust());
593 CHECK(!isolate->IsExecutionTerminating()); 594 CHECK(!isolate->IsExecutionTerminating());
594 } 595 }
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