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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 } | 500 } |
501 | 501 |
502 | 502 |
503 void InnerTryCallTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) { | 503 void InnerTryCallTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) { |
504 CHECK(!args.GetIsolate()->IsExecutionTerminating()); | 504 CHECK(!args.GetIsolate()->IsExecutionTerminating()); |
505 v8::Local<v8::Object> global = CcTest::global(); | 505 v8::Local<v8::Object> global = CcTest::global(); |
506 v8::Local<v8::Function> loop = v8::Local<v8::Function>::Cast( | 506 v8::Local<v8::Function> loop = v8::Local<v8::Function>::Cast( |
507 global->Get(CcTest::isolate()->GetCurrentContext(), v8_str("loop")) | 507 global->Get(CcTest::isolate()->GetCurrentContext(), v8_str("loop")) |
508 .ToLocalChecked()); | 508 .ToLocalChecked()); |
509 i::MaybeHandle<i::Object> result = | 509 i::MaybeHandle<i::Object> result = |
510 i::Execution::TryCall(v8::Utils::OpenHandle((*loop)), | 510 i::Execution::TryCall(CcTest::i_isolate(), v8::Utils::OpenHandle((*loop)), |
511 v8::Utils::OpenHandle((*global)), 0, NULL, NULL); | 511 v8::Utils::OpenHandle((*global)), 0, NULL, NULL); |
512 CHECK(result.is_null()); | 512 CHECK(result.is_null()); |
513 // TryCall ignores terminate execution, but rerequests the interrupt. | 513 // TryCall ignores terminate execution, but rerequests the interrupt. |
514 CHECK(!args.GetIsolate()->IsExecutionTerminating()); | 514 CHECK(!args.GetIsolate()->IsExecutionTerminating()); |
515 CHECK(CompileRun("1 + 1;").IsEmpty()); | 515 CHECK(CompileRun("1 + 1;").IsEmpty()); |
516 } | 516 } |
517 | 517 |
518 | 518 |
519 TEST(TerminationInInnerTryCall) { | 519 TEST(TerminationInInnerTryCall) { |
520 v8::Isolate* isolate = CcTest::isolate(); | 520 v8::Isolate* isolate = CcTest::isolate(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 CHECK(value->IsFunction()); | 562 CHECK(value->IsFunction()); |
563 // The first stack check after terminate has been re-requested fails. | 563 // The first stack check after terminate has been re-requested fails. |
564 CHECK(CompileRun("1 + 1").IsEmpty()); | 564 CHECK(CompileRun("1 + 1").IsEmpty()); |
565 CHECK(!isolate->IsExecutionTerminating()); | 565 CHECK(!isolate->IsExecutionTerminating()); |
566 // V8 then recovers. | 566 // V8 then recovers. |
567 v8::Maybe<int32_t> result = CompileRun("2 + 2")->Int32Value( | 567 v8::Maybe<int32_t> result = CompileRun("2 + 2")->Int32Value( |
568 v8::Isolate::GetCurrent()->GetCurrentContext()); | 568 v8::Isolate::GetCurrent()->GetCurrentContext()); |
569 CHECK_EQ(4, result.FromJust()); | 569 CHECK_EQ(4, result.FromJust()); |
570 CHECK(!isolate->IsExecutionTerminating()); | 570 CHECK(!isolate->IsExecutionTerminating()); |
571 } | 571 } |
OLD | NEW |