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

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

Issue 2636903002: Assert that context creation doesn't throw (Closed)
Patch Set: Created 3 years, 11 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
« src/execution.h ('K') | « src/isolate.cc ('k') | 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 CHECK(error->IsNativeError()); 523 CHECK(error->IsNativeError());
524 } 524 }
525 525
526 526
527 void InnerTryCallTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) { 527 void InnerTryCallTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
528 CHECK(!args.GetIsolate()->IsExecutionTerminating()); 528 CHECK(!args.GetIsolate()->IsExecutionTerminating());
529 v8::Local<v8::Object> global = CcTest::global(); 529 v8::Local<v8::Object> global = CcTest::global();
530 v8::Local<v8::Function> loop = v8::Local<v8::Function>::Cast( 530 v8::Local<v8::Function> loop = v8::Local<v8::Function>::Cast(
531 global->Get(CcTest::isolate()->GetCurrentContext(), v8_str("loop")) 531 global->Get(CcTest::isolate()->GetCurrentContext(), v8_str("loop"))
532 .ToLocalChecked()); 532 .ToLocalChecked());
533 i::MaybeHandle<i::Object> result = 533 i::MaybeHandle<i::Object> exception;
534 i::Execution::TryCall(CcTest::i_isolate(), v8::Utils::OpenHandle((*loop)), 534 i::MaybeHandle<i::Object> result = i::Execution::TryCall(
535 v8::Utils::OpenHandle((*global)), 0, NULL, NULL); 535 CcTest::i_isolate(), v8::Utils::OpenHandle((*loop)),
536 v8::Utils::OpenHandle((*global)), 0, nullptr, &exception);
536 CHECK(result.is_null()); 537 CHECK(result.is_null());
537 // TryCall ignores terminate execution, but rerequests the interrupt. 538 // TryCall ignores terminate execution, but rerequests the interrupt.
538 CHECK(!args.GetIsolate()->IsExecutionTerminating()); 539 CHECK(!args.GetIsolate()->IsExecutionTerminating());
539 CHECK(CompileRun("1 + 1;").IsEmpty()); 540 CHECK(CompileRun("1 + 1;").IsEmpty());
540 } 541 }
541 542
542 543
543 TEST(TerminationInInnerTryCall) { 544 TEST(TerminationInInnerTryCall) {
544 v8::Isolate* isolate = CcTest::isolate(); 545 v8::Isolate* isolate = CcTest::isolate();
545 v8::HandleScope scope(isolate); 546 v8::HandleScope scope(isolate);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 CHECK(value->IsFunction()); 587 CHECK(value->IsFunction());
587 // The first stack check after terminate has been re-requested fails. 588 // The first stack check after terminate has been re-requested fails.
588 CHECK(CompileRun("1 + 1").IsEmpty()); 589 CHECK(CompileRun("1 + 1").IsEmpty());
589 CHECK(!isolate->IsExecutionTerminating()); 590 CHECK(!isolate->IsExecutionTerminating());
590 // V8 then recovers. 591 // V8 then recovers.
591 v8::Maybe<int32_t> result = CompileRun("2 + 2")->Int32Value( 592 v8::Maybe<int32_t> result = CompileRun("2 + 2")->Int32Value(
592 v8::Isolate::GetCurrent()->GetCurrentContext()); 593 v8::Isolate::GetCurrent()->GetCurrentContext());
593 CHECK_EQ(4, result.FromJust()); 594 CHECK_EQ(4, result.FromJust());
594 CHECK(!isolate->IsExecutionTerminating()); 595 CHECK(!isolate->IsExecutionTerminating());
595 } 596 }
OLDNEW
« src/execution.h ('K') | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698