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 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 #include <utility> | 29 #include <utility> |
30 | 30 |
| 31 #include "src/code-stubs.h" |
31 #include "src/compilation-cache.h" | 32 #include "src/compilation-cache.h" |
32 #include "src/context-measure.h" | 33 #include "src/context-measure.h" |
33 #include "src/deoptimizer.h" | 34 #include "src/deoptimizer.h" |
34 #include "src/elements.h" | 35 #include "src/elements.h" |
35 #include "src/execution.h" | 36 #include "src/execution.h" |
36 #include "src/factory.h" | 37 #include "src/factory.h" |
37 #include "src/field-type.h" | 38 #include "src/field-type.h" |
38 #include "src/global-handles.h" | 39 #include "src/global-handles.h" |
39 #include "src/heap/gc-tracer.h" | 40 #include "src/heap/gc-tracer.h" |
40 #include "src/heap/memory-reducer.h" | 41 #include "src/heap/memory-reducer.h" |
(...skipping 6789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6830 } | 6831 } |
6831 if (marking->IsStopped()) break; | 6832 if (marking->IsStopped()) break; |
6832 double deadline = heap->MonotonicallyIncreasingTimeInMs() + 1; | 6833 double deadline = heap->MonotonicallyIncreasingTimeInMs() + 1; |
6833 marking->AdvanceIncrementalMarking( | 6834 marking->AdvanceIncrementalMarking( |
6834 deadline, IncrementalMarking::GC_VIA_STACK_GUARD, | 6835 deadline, IncrementalMarking::GC_VIA_STACK_GUARD, |
6835 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); | 6836 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
6836 } | 6837 } |
6837 DCHECK(marking->IsStopped()); | 6838 DCHECK(marking->IsStopped()); |
6838 } | 6839 } |
6839 | 6840 |
| 6841 HEAP_TEST(Regress5831) { |
| 6842 CcTest::InitializeVM(); |
| 6843 Heap* heap = CcTest::heap(); |
| 6844 Isolate* isolate = CcTest::i_isolate(); |
| 6845 HandleScope handle_scope(isolate); |
| 6846 |
| 6847 // Used to ensure that the first code space page remains filled. |
| 6848 Handle<FixedArray> array = isolate->factory()->NewFixedArray(32); |
| 6849 |
| 6850 { |
| 6851 // Ensure that the first code space page is full. |
| 6852 CEntryStub stub(isolate, 1); |
| 6853 Handle<Code> code = stub.GetCode(); |
| 6854 |
| 6855 int i = 0; |
| 6856 array = FixedArray::SetAndGrow(array, i++, code); |
| 6857 |
| 6858 while (heap->code_space()->FirstPage()->Contains(code->address())) { |
| 6859 code = isolate->factory()->CopyCode(code); |
| 6860 array = FixedArray::SetAndGrow(array, i++, code); |
| 6861 } |
| 6862 } |
| 6863 |
| 6864 class ImmovableCEntryStub : public i::CEntryStub { |
| 6865 public: |
| 6866 explicit ImmovableCEntryStub(i::Isolate* isolate) |
| 6867 : i::CEntryStub(isolate, 3, i::kSaveFPRegs, i::kArgvOnStack, true) {} |
| 6868 bool NeedsImmovableCode() override { return true; } |
| 6869 }; |
| 6870 |
| 6871 ImmovableCEntryStub stub(isolate); |
| 6872 |
| 6873 { |
| 6874 // Make sure the code object has not yet been generated. |
| 6875 Code* code; |
| 6876 CHECK(!stub.FindCodeInCache(&code)); |
| 6877 } |
| 6878 |
| 6879 // Fake a serializer run. |
| 6880 isolate->serializer_enabled_ = true; |
| 6881 |
| 6882 // Generate the code. |
| 6883 Handle<Code> code = stub.GetCode(); |
| 6884 CHECK(code->Size() <= i::kMaxRegularHeapObjectSize); |
| 6885 CHECK(!heap->code_space()->FirstPage()->Contains(code->address())); |
| 6886 |
| 6887 // Ensure it's not in large object space. |
| 6888 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address()); |
| 6889 CHECK(chunk->owner()->identity() != LO_SPACE); |
| 6890 CHECK(chunk->NeverEvacuate()); |
| 6891 } |
| 6892 |
6840 } // namespace internal | 6893 } // namespace internal |
6841 } // namespace v8 | 6894 } // namespace v8 |
OLD | NEW |