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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 v8::Local<v8::Context> context = | 448 v8::Local<v8::Context> context = |
449 v8::Context::New(CcTest::isolate(), NULL, global); | 449 v8::Context::New(CcTest::isolate(), NULL, global); |
450 v8::Context::Scope context_scope(context); | 450 v8::Context::Scope context_scope(context); |
451 | 451 |
452 v8::TryCatch try_catch(isolate); | 452 v8::TryCatch try_catch(isolate); |
453 static const char* terminate_and_loop = | 453 static const char* terminate_and_loop = |
454 "terminate(); for (var i = 0; i < 10000; i++);"; | 454 "terminate(); for (var i = 0; i < 10000; i++);"; |
455 | 455 |
456 { // Postpone terminate execution interrupts. | 456 { // Postpone terminate execution interrupts. |
457 i::PostponeInterruptsScope p1(CcTest::i_isolate(), | 457 i::PostponeInterruptsScope p1(CcTest::i_isolate(), |
458 i::StackGuard::TERMINATE_EXECUTION) ; | 458 i::StackGuard::TERMINATE_EXECUTION); |
459 | 459 |
460 // API interrupts should still be triggered. | 460 // API interrupts should still be triggered. |
461 CcTest::isolate()->RequestInterrupt(&CounterCallback, NULL); | 461 CcTest::isolate()->RequestInterrupt(&CounterCallback, NULL); |
462 CHECK_EQ(0, callback_counter); | 462 CHECK_EQ(0, callback_counter); |
463 CompileRun(terminate_and_loop); | 463 CompileRun(terminate_and_loop); |
464 CHECK(!try_catch.HasTerminated()); | 464 CHECK(!try_catch.HasTerminated()); |
465 CHECK_EQ(1, callback_counter); | 465 CHECK_EQ(1, callback_counter); |
466 | 466 |
467 { // Postpone API interrupts as well. | 467 { // Postpone API interrupts as well. |
468 i::PostponeInterruptsScope p2(CcTest::i_isolate(), | 468 i::PostponeInterruptsScope p2(CcTest::i_isolate(), |
(...skipping 93 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 |