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 18727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 CHECK(!obj.IsEmpty()); | 18745 CHECK(!obj.IsEmpty()); |
18746 | 18746 |
18747 CcTest::heap()->CollectAllGarbage( | 18747 CcTest::heap()->CollectAllGarbage( |
18748 i::Heap::Heap::kAbortIncrementalMarkingMask); | 18748 i::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 CHECK(!obj.IsEmpty()); | 18765 CHECK(!obj.IsEmpty()); |
18766 | 18766 |
18767 CcTest::heap()->CollectAllGarbage( | 18767 CcTest::heap()->CollectAllGarbage( |
18768 i::Heap::Heap::kAbortIncrementalMarkingMask); | 18768 i::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); |
18776 v8::V8::AddGCEpilogueCallback(EpilogueCallback); | 18776 v8::V8::AddGCEpilogueCallback(EpilogueCallback); |
18777 CHECK_EQ(0, prologue_call_count); | 18777 CHECK_EQ(0, prologue_call_count); |
18778 CHECK_EQ(0, epilogue_call_count); | 18778 CHECK_EQ(0, epilogue_call_count); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18834 CHECK_EQ(2, prologue_call_count); | 18834 CHECK_EQ(2, prologue_call_count); |
18835 CHECK_EQ(2, epilogue_call_count); | 18835 CHECK_EQ(2, epilogue_call_count); |
18836 CHECK_EQ(2, prologue_call_count_second); | 18836 CHECK_EQ(2, prologue_call_count_second); |
18837 CHECK_EQ(2, epilogue_call_count_second); | 18837 CHECK_EQ(2, epilogue_call_count_second); |
18838 | 18838 |
18839 CHECK_EQ(0, prologue_call_count_alloc); | 18839 CHECK_EQ(0, prologue_call_count_alloc); |
18840 CHECK_EQ(0, epilogue_call_count_alloc); | 18840 CHECK_EQ(0, epilogue_call_count_alloc); |
18841 isolate->AddGCPrologueCallback(PrologueCallbackAlloc); | 18841 isolate->AddGCPrologueCallback(PrologueCallbackAlloc); |
18842 isolate->AddGCEpilogueCallback(EpilogueCallbackAlloc); | 18842 isolate->AddGCEpilogueCallback(EpilogueCallbackAlloc); |
18843 CcTest::heap()->CollectAllGarbage( | 18843 CcTest::heap()->CollectAllGarbage( |
18844 i::Heap::Heap::kAbortIncrementalMarkingMask); | 18844 i::Heap::kAbortIncrementalMarkingMask); |
18845 CHECK_EQ(1, prologue_call_count_alloc); | 18845 CHECK_EQ(1, prologue_call_count_alloc); |
18846 CHECK_EQ(1, epilogue_call_count_alloc); | 18846 CHECK_EQ(1, epilogue_call_count_alloc); |
18847 isolate->RemoveGCPrologueCallback(PrologueCallbackAlloc); | 18847 isolate->RemoveGCPrologueCallback(PrologueCallbackAlloc); |
18848 isolate->RemoveGCEpilogueCallback(EpilogueCallbackAlloc); | 18848 isolate->RemoveGCEpilogueCallback(EpilogueCallbackAlloc); |
18849 } | 18849 } |
18850 | 18850 |
18851 | 18851 |
18852 THREADED_TEST(AddToJSFunctionResultCache) { | 18852 THREADED_TEST(AddToJSFunctionResultCache) { |
18853 i::FLAG_stress_compaction = false; | 18853 i::FLAG_stress_compaction = false; |
18854 i::FLAG_allow_natives_syntax = true; | 18854 i::FLAG_allow_natives_syntax = true; |
(...skipping 3530 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 |