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

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

Issue 1406133003: [heap] fix crash during the scavenge of ArrayBuffer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix ref Created 5 years, 2 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
« src/heap/heap.h ('K') | « src/heap/heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 7ba4a3c4a923de2f38d9aa8d2453d880a26a8b92..ef3c395f69012f8cedc861063f5386d58bd1172c 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -14192,6 +14192,32 @@ THREADED_TEST(SkipArrayBufferBackingStoreDuringGC) {
}
+THREADED_TEST(SkipArrayBufferDuringScavenge) {
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope handle_scope(isolate);
+
+ // Make sure the pointer looks like a heap object
+ Local<v8::Object> tmp = v8::Object::New(isolate);
+ uint8_t* store_ptr =
+ reinterpret_cast<uint8_t*>(*reinterpret_cast<uintptr_t*>(*tmp));
+
+ // Make `store_ptr` point to from space
+ CcTest::heap()->CollectGarbage(i::NEW_SPACE);
+
+ // 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,
+ // i.e. backing store pointer should not be treated as a heap object pointer
+ CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now
+ CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now
+
+ // Use `ab` to silence compiler warning
+ CHECK_EQ(ab->GetContents().Data(), store_ptr);
+}
+
+
THREADED_TEST(SharedUint8Array) {
i::FLAG_harmony_sharedarraybuffer = true;
TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array,
« src/heap/heap.h ('K') | « src/heap/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698