Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1043)

Unified Diff: test/cctest/heap/test-heap.cc

Issue 2635973002: [heap] Don't allocate immovable code in LO space during serialization (Closed)
Patch Set: Add test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/heap/heap-tester.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/test-heap.cc
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
index b044cfed009e25c3f26c3f8414bd3ceb4edde91e..27943854c75742f9e8b8096af8448b1a5cc7d797 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <utility>
+#include "src/code-stubs.h"
#include "src/compilation-cache.h"
#include "src/context-measure.h"
#include "src/deoptimizer.h"
@@ -6837,5 +6838,57 @@ HEAP_TEST(Regress670675) {
DCHECK(marking->IsStopped());
}
+HEAP_TEST(Regress5831) {
+ CcTest::InitializeVM();
+ Heap* heap = CcTest::heap();
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope handle_scope(isolate);
+
+ // Used to ensure that the first code space page remains filled.
+ Handle<FixedArray> array = isolate->factory()->NewFixedArray(32);
+
+ {
+ // Ensure that the first code space page is full.
+ CEntryStub stub(isolate, 1);
+ Handle<Code> code = stub.GetCode();
+
+ int i = 0;
+ array = FixedArray::SetAndGrow(array, i++, code);
+
+ while (heap->code_space()->FirstPage()->Contains(code->address())) {
+ code = isolate->factory()->CopyCode(code);
+ array = FixedArray::SetAndGrow(array, i++, code);
+ }
+ }
+
+ class ImmovableCEntryStub : public i::CEntryStub {
+ public:
+ explicit ImmovableCEntryStub(i::Isolate* isolate)
+ : i::CEntryStub(isolate, 3, i::kSaveFPRegs, i::kArgvOnStack, true) {}
+ bool NeedsImmovableCode() override { return true; }
+ };
+
+ ImmovableCEntryStub stub(isolate);
+
+ {
+ // Make sure the code object has not yet been generated.
+ Code* code;
+ CHECK(!stub.FindCodeInCache(&code));
+ }
+
+ // Fake a serializer run.
+ isolate->serializer_enabled_ = true;
+
+ // Generate the code.
+ Handle<Code> code = stub.GetCode();
+ CHECK(code->Size() <= i::kMaxRegularHeapObjectSize);
+ CHECK(!heap->code_space()->FirstPage()->Contains(code->address()));
+
+ // Ensure it's not in large object space.
+ MemoryChunk* chunk = MemoryChunk::FromAddress(code->address());
+ CHECK(chunk->owner()->identity() != LO_SPACE);
+ CHECK(chunk->NeverEvacuate());
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « test/cctest/heap/heap-tester.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698