| OLD | NEW |
| 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 Loading... |
| 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> exception; |
| 533 i::MaybeHandle<i::Object> result = | 534 i::MaybeHandle<i::Object> result = |
| 534 i::Execution::TryCall(CcTest::i_isolate(), v8::Utils::OpenHandle((*loop)), | 535 i::Execution::TryCall(CcTest::i_isolate(), v8::Utils::OpenHandle((*loop)), |
| 535 v8::Utils::OpenHandle((*global)), 0, NULL, NULL); | 536 v8::Utils::OpenHandle((*global)), 0, nullptr, |
| 537 i::Execution::MessageHandling::kReport, &exception); |
| 536 CHECK(result.is_null()); | 538 CHECK(result.is_null()); |
| 537 // TryCall ignores terminate execution, but rerequests the interrupt. | 539 // TryCall ignores terminate execution, but rerequests the interrupt. |
| 538 CHECK(!args.GetIsolate()->IsExecutionTerminating()); | 540 CHECK(!args.GetIsolate()->IsExecutionTerminating()); |
| 539 CHECK(CompileRun("1 + 1;").IsEmpty()); | 541 CHECK(CompileRun("1 + 1;").IsEmpty()); |
| 540 } | 542 } |
| 541 | 543 |
| 542 | 544 |
| 543 TEST(TerminationInInnerTryCall) { | 545 TEST(TerminationInInnerTryCall) { |
| 544 v8::Isolate* isolate = CcTest::isolate(); | 546 v8::Isolate* isolate = CcTest::isolate(); |
| 545 v8::HandleScope scope(isolate); | 547 v8::HandleScope scope(isolate); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 CHECK(value->IsFunction()); | 588 CHECK(value->IsFunction()); |
| 587 // The first stack check after terminate has been re-requested fails. | 589 // The first stack check after terminate has been re-requested fails. |
| 588 CHECK(CompileRun("1 + 1").IsEmpty()); | 590 CHECK(CompileRun("1 + 1").IsEmpty()); |
| 589 CHECK(!isolate->IsExecutionTerminating()); | 591 CHECK(!isolate->IsExecutionTerminating()); |
| 590 // V8 then recovers. | 592 // V8 then recovers. |
| 591 v8::Maybe<int32_t> result = CompileRun("2 + 2")->Int32Value( | 593 v8::Maybe<int32_t> result = CompileRun("2 + 2")->Int32Value( |
| 592 v8::Isolate::GetCurrent()->GetCurrentContext()); | 594 v8::Isolate::GetCurrent()->GetCurrentContext()); |
| 593 CHECK_EQ(4, result.FromJust()); | 595 CHECK_EQ(4, result.FromJust()); |
| 594 CHECK(!isolate->IsExecutionTerminating()); | 596 CHECK(!isolate->IsExecutionTerminating()); |
| 595 } | 597 } |
| OLD | NEW |