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

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: visit all fields in array buffer, reorder fields for simplicity 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
« no previous file with comments | « 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 LocalContext env;
14228 v8::Isolate* isolate = env->GetIsolate();
14229 v8::HandleScope handle_scope(isolate);
14230
14231 // Make sure the pointer looks like a heap object
14232 uint8_t* store_ptr = reinterpret_cast<uint8_t*>(i::kHeapObjectTag);
14233
14234 // Create ArrayBuffer with pointer-that-cannot-be-visited in the backing store
14235 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, store_ptr, 8);
14236
14237 // Should not crash
14238 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now
14239 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now
14240 CcTest::heap()->CollectAllGarbage();
14241 CcTest::heap()->CollectAllGarbage();
14242
14243 // Should not move the pointer
14244 CHECK_EQ(ab->GetContents().Data(), store_ptr);
14245 }
14246
14247
14226 THREADED_TEST(SharedUint8Array) { 14248 THREADED_TEST(SharedUint8Array) {
14227 i::FLAG_harmony_sharedarraybuffer = true; 14249 i::FLAG_harmony_sharedarraybuffer = true;
14228 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array, 14250 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array,
14229 v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF); 14251 v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
14230 } 14252 }
14231 14253
14232 14254
14233 THREADED_TEST(SharedInt8Array) { 14255 THREADED_TEST(SharedInt8Array) {
14234 i::FLAG_harmony_sharedarraybuffer = true; 14256 i::FLAG_harmony_sharedarraybuffer = true;
14235 TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array, 14257 TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array,
(...skipping 7614 matching lines...) Expand 10 before | Expand all | Expand 10 after
21850 timeout_thread.Join(); 21872 timeout_thread.Join();
21851 } 21873 }
21852 21874
21853 21875
21854 TEST(EstimatedContextSize) { 21876 TEST(EstimatedContextSize) {
21855 v8::Isolate* isolate = CcTest::isolate(); 21877 v8::Isolate* isolate = CcTest::isolate();
21856 v8::HandleScope scope(isolate); 21878 v8::HandleScope scope(isolate);
21857 LocalContext env; 21879 LocalContext env;
21858 CHECK(50000 < env->EstimatedSize()); 21880 CHECK(50000 < env->EstimatedSize());
21859 } 21881 }
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698