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

Side by Side Diff: test/cctest/test-api.cc

Issue 1327403002: [objects] do not visit ArrayBuffer's backing store (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« src/objects-inl.h ('K') | « src/objects-inl.h ('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 14205 matching lines...) Expand 10 before | Expand all | Expand 10 after
14216 Local<v8::ArrayBuffer> ab = 14216 Local<v8::ArrayBuffer> ab =
14217 v8::ArrayBuffer::New(isolate, backing_store.start(), 2 + kSize); 14217 v8::ArrayBuffer::New(isolate, backing_store.start(), 2 + kSize);
14218 Local<v8::DataView> dv = v8::DataView::New(ab, 2, kSize); 14218 Local<v8::DataView> dv = v8::DataView::New(ab, 2, kSize);
14219 CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv); 14219 CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv);
14220 CHECK_EQ(2u, dv->ByteOffset()); 14220 CHECK_EQ(2u, dv->ByteOffset());
14221 CHECK_EQ(kSize, static_cast<int>(dv->ByteLength())); 14221 CHECK_EQ(kSize, static_cast<int>(dv->ByteLength()));
14222 CHECK(ab->Equals(dv->Buffer())); 14222 CHECK(ab->Equals(dv->Buffer()));
14223 } 14223 }
14224 14224
14225 14225
14226 THREADED_TEST(SkipArrayBufferBackingStoreDuringGC) {
14227 const int kSize = 64;
14228
14229 LocalContext env;
14230 v8::Isolate* isolate = env->GetIsolate();
14231 v8::HandleScope handle_scope(isolate);
14232
14233 // Make sure the pointer looks like a heap object
14234 uint8_t* store_ptr = reinterpret_cast<uint8_t*>(i::kHeapObjectTag);
14235
14236 // Create ArrayBuffer with pointer-that-cannot-be-visited in the backing store
14237 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, store_ptr, 8);
14238
14239 // Should not crash
14240 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now
14241 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now
14242 CcTest::heap()->CollectAllGarbage();
14243 CcTest::heap()->CollectAllGarbage();
14244
14245 // Should not move the pointer
14246 CHECK_EQ(ab->GetContents().Data(), store_ptr);
14247 }
14248
14249
14226 THREADED_TEST(SharedUint8Array) { 14250 THREADED_TEST(SharedUint8Array) {
14227 i::FLAG_harmony_sharedarraybuffer = true; 14251 i::FLAG_harmony_sharedarraybuffer = true;
14228 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array, 14252 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array,
14229 v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF); 14253 v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
14230 } 14254 }
14231 14255
14232 14256
14233 THREADED_TEST(SharedInt8Array) { 14257 THREADED_TEST(SharedInt8Array) {
14234 i::FLAG_harmony_sharedarraybuffer = true; 14258 i::FLAG_harmony_sharedarraybuffer = true;
14235 TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array, 14259 TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array,
(...skipping 7614 matching lines...) Expand 10 before | Expand all | Expand 10 after
21850 timeout_thread.Join(); 21874 timeout_thread.Join();
21851 } 21875 }
21852 21876
21853 21877
21854 TEST(EstimatedContextSize) { 21878 TEST(EstimatedContextSize) {
21855 v8::Isolate* isolate = CcTest::isolate(); 21879 v8::Isolate* isolate = CcTest::isolate();
21856 v8::HandleScope scope(isolate); 21880 v8::HandleScope scope(isolate);
21857 LocalContext env; 21881 LocalContext env;
21858 CHECK(50000 < env->EstimatedSize()); 21882 CHECK(50000 < env->EstimatedSize());
21859 } 21883 }
OLDNEW
« src/objects-inl.h ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698