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

Side by Side 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, 1 month 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 unified diff | Download patch
« src/heap/heap.h ('K') | « src/heap/heap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 14174 matching lines...) Expand 10 before | Expand all | Expand 10 after
14185 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now 14185 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now
14186 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now 14186 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now
14187 CcTest::heap()->CollectAllGarbage(); 14187 CcTest::heap()->CollectAllGarbage();
14188 CcTest::heap()->CollectAllGarbage(); 14188 CcTest::heap()->CollectAllGarbage();
14189 14189
14190 // Should not move the pointer 14190 // Should not move the pointer
14191 CHECK_EQ(ab->GetContents().Data(), store_ptr); 14191 CHECK_EQ(ab->GetContents().Data(), store_ptr);
14192 } 14192 }
14193 14193
14194 14194
14195 THREADED_TEST(SkipArrayBufferDuringScavenge) {
14196 LocalContext env;
14197 v8::Isolate* isolate = env->GetIsolate();
14198 v8::HandleScope handle_scope(isolate);
14199
14200 // Make sure the pointer looks like a heap object
14201 Local<v8::Object> tmp = v8::Object::New(isolate);
14202 uint8_t* store_ptr =
14203 reinterpret_cast<uint8_t*>(*reinterpret_cast<uintptr_t*>(*tmp));
14204
14205 // Make `store_ptr` point to from space
14206 CcTest::heap()->CollectGarbage(i::NEW_SPACE);
14207
14208 // Create ArrayBuffer with pointer-that-cannot-be-visited in the backing store
14209 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, store_ptr, 8);
14210
14211 // Should not crash,
14212 // i.e. backing store pointer should not be treated as a heap object pointer
14213 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now
14214 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now
14215
14216 // Use `ab` to silence compiler warning
14217 CHECK_EQ(ab->GetContents().Data(), store_ptr);
14218 }
14219
14220
14195 THREADED_TEST(SharedUint8Array) { 14221 THREADED_TEST(SharedUint8Array) {
14196 i::FLAG_harmony_sharedarraybuffer = true; 14222 i::FLAG_harmony_sharedarraybuffer = true;
14197 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array, 14223 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array,
14198 v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF); 14224 v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
14199 } 14225 }
14200 14226
14201 14227
14202 THREADED_TEST(SharedInt8Array) { 14228 THREADED_TEST(SharedInt8Array) {
14203 i::FLAG_harmony_sharedarraybuffer = true; 14229 i::FLAG_harmony_sharedarraybuffer = true;
14204 TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array, 14230 TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array,
(...skipping 7735 matching lines...) Expand 10 before | Expand all | Expand 10 after
21940 LocalContext env; 21966 LocalContext env;
21941 21967
21942 env->Global()->Set(v8_str("keys"), v8::Array::GetKeysIterator(isolate)); 21968 env->Global()->Set(v8_str("keys"), v8::Array::GetKeysIterator(isolate));
21943 env->Global()->Set(v8_str("values"), v8::Array::GetValuesIterator(isolate)); 21969 env->Global()->Set(v8_str("values"), v8::Array::GetValuesIterator(isolate));
21944 env->Global()->Set(v8_str("entries"), v8::Array::GetEntriesIterator(isolate)); 21970 env->Global()->Set(v8_str("entries"), v8::Array::GetEntriesIterator(isolate));
21945 21971
21946 ExpectString("typeof keys", "function"); 21972 ExpectString("typeof keys", "function");
21947 ExpectString("typeof values", "function"); 21973 ExpectString("typeof values", "function");
21948 ExpectString("typeof entries", "function"); 21974 ExpectString("typeof entries", "function");
21949 } 21975 }
OLDNEW
« 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