| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 18724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18735 v8::HandleScope scope(isolate); | 18735 v8::HandleScope scope(isolate); |
| 18736 | 18736 |
| 18737 CHECK_EQ(flags, v8::kNoGCCallbackFlags); | 18737 CHECK_EQ(flags, v8::kNoGCCallbackFlags); |
| 18738 CHECK_EQ(gc_callbacks_isolate, isolate); | 18738 CHECK_EQ(gc_callbacks_isolate, isolate); |
| 18739 ++prologue_call_count_alloc; | 18739 ++prologue_call_count_alloc; |
| 18740 | 18740 |
| 18741 // Simulate full heap to see if we will reenter this callback | 18741 // Simulate full heap to see if we will reenter this callback |
| 18742 SimulateFullSpace(CcTest::heap()->new_space()); | 18742 SimulateFullSpace(CcTest::heap()->new_space()); |
| 18743 | 18743 |
| 18744 Local<Object> obj = Object::New(isolate); | 18744 Local<Object> obj = Object::New(isolate); |
| 18745 ASSERT(!obj.IsEmpty()); | 18745 CHECK(!obj.IsEmpty()); |
| 18746 | 18746 |
| 18747 CcTest::heap()->CollectAllGarbage( | 18747 CcTest::heap()->CollectAllGarbage( |
| 18748 i::Heap::Heap::kAbortIncrementalMarkingMask); | 18748 i::Heap::Heap::kAbortIncrementalMarkingMask); |
| 18749 } | 18749 } |
| 18750 | 18750 |
| 18751 | 18751 |
| 18752 void EpilogueCallbackAlloc(v8::Isolate* isolate, | 18752 void EpilogueCallbackAlloc(v8::Isolate* isolate, |
| 18753 v8::GCType, | 18753 v8::GCType, |
| 18754 v8::GCCallbackFlags flags) { | 18754 v8::GCCallbackFlags flags) { |
| 18755 v8::HandleScope scope(isolate); | 18755 v8::HandleScope scope(isolate); |
| 18756 | 18756 |
| 18757 CHECK_EQ(flags, v8::kNoGCCallbackFlags); | 18757 CHECK_EQ(flags, v8::kNoGCCallbackFlags); |
| 18758 CHECK_EQ(gc_callbacks_isolate, isolate); | 18758 CHECK_EQ(gc_callbacks_isolate, isolate); |
| 18759 ++epilogue_call_count_alloc; | 18759 ++epilogue_call_count_alloc; |
| 18760 | 18760 |
| 18761 // Simulate full heap to see if we will reenter this callback | 18761 // Simulate full heap to see if we will reenter this callback |
| 18762 SimulateFullSpace(CcTest::heap()->new_space()); | 18762 SimulateFullSpace(CcTest::heap()->new_space()); |
| 18763 | 18763 |
| 18764 Local<Object> obj = Object::New(isolate); | 18764 Local<Object> obj = Object::New(isolate); |
| 18765 ASSERT(!obj.IsEmpty()); | 18765 CHECK(!obj.IsEmpty()); |
| 18766 | 18766 |
| 18767 CcTest::heap()->CollectAllGarbage( | 18767 CcTest::heap()->CollectAllGarbage( |
| 18768 i::Heap::Heap::kAbortIncrementalMarkingMask); | 18768 i::Heap::Heap::kAbortIncrementalMarkingMask); |
| 18769 } | 18769 } |
| 18770 | 18770 |
| 18771 | 18771 |
| 18772 TEST(GCCallbacksOld) { | 18772 TEST(GCCallbacksOld) { |
| 18773 LocalContext context; | 18773 LocalContext context; |
| 18774 | 18774 |
| 18775 v8::V8::AddGCPrologueCallback(PrologueCallback); | 18775 v8::V8::AddGCPrologueCallback(PrologueCallback); |
| (...skipping 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22385 CompileRun("x1 = x2 = 0;"); | 22385 CompileRun("x1 = x2 = 0;"); |
| 22386 rr = v8::Promise::Resolver::New(isolate); | 22386 rr = v8::Promise::Resolver::New(isolate); |
| 22387 rr->GetPromise()->Catch(f1)->Chain(f2); | 22387 rr->GetPromise()->Catch(f1)->Chain(f2); |
| 22388 rr->Reject(v8::Integer::New(isolate, 3)); | 22388 rr->Reject(v8::Integer::New(isolate, 3)); |
| 22389 CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value()); | 22389 CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value()); |
| 22390 CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value()); | 22390 CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value()); |
| 22391 V8::RunMicrotasks(isolate); | 22391 V8::RunMicrotasks(isolate); |
| 22392 CHECK_EQ(3, global->Get(v8_str("x1"))->Int32Value()); | 22392 CHECK_EQ(3, global->Get(v8_str("x1"))->Int32Value()); |
| 22393 CHECK_EQ(4, global->Get(v8_str("x2"))->Int32Value()); | 22393 CHECK_EQ(4, global->Get(v8_str("x2"))->Int32Value()); |
| 22394 } | 22394 } |
| OLD | NEW |