Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index df502cb177e6d8ee103668a80c57c6c689f01bd3..4ead519e26910689178842347a76fcc5869776d2 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -14223,6 +14223,28 @@ THREADED_TEST(DataView) { |
} |
+THREADED_TEST(SkipArrayBufferBackingStoreDuringGC) { |
+ LocalContext env; |
+ v8::Isolate* isolate = env->GetIsolate(); |
+ v8::HandleScope handle_scope(isolate); |
+ |
+ // Make sure the pointer looks like a heap object |
+ uint8_t* store_ptr = reinterpret_cast<uint8_t*>(i::kHeapObjectTag); |
+ |
+ // Create ArrayBuffer with pointer-that-cannot-be-visited in the backing store |
+ Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, store_ptr, 8); |
+ |
+ // Should not crash |
+ CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now |
+ CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now |
+ CcTest::heap()->CollectAllGarbage(); |
+ CcTest::heap()->CollectAllGarbage(); |
+ |
+ // Should not move the pointer |
+ CHECK_EQ(ab->GetContents().Data(), store_ptr); |
+} |
+ |
+ |
THREADED_TEST(SharedUint8Array) { |
i::FLAG_harmony_sharedarraybuffer = true; |
TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array, |