OLD | NEW |
---|---|
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 Loading... | |
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 | |
Hannes Payer (out of office)
2015/10/21 14:54:43
, i.e. backing store pointer should not be treated
| |
14212 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now | |
14213 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now | |
14214 | |
14215 // Just use the `ab` to silence compiler warning | |
Hannes Payer (out of office)
2015/10/21 14:54:43
Use `ab` to...
| |
14216 CHECK_EQ(ab->GetContents().Data(), store_ptr); | |
14217 } | |
14218 | |
14219 | |
14195 THREADED_TEST(SharedUint8Array) { | 14220 THREADED_TEST(SharedUint8Array) { |
14196 i::FLAG_harmony_sharedarraybuffer = true; | 14221 i::FLAG_harmony_sharedarraybuffer = true; |
14197 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array, | 14222 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array, |
14198 v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF); | 14223 v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF); |
14199 } | 14224 } |
14200 | 14225 |
14201 | 14226 |
14202 THREADED_TEST(SharedInt8Array) { | 14227 THREADED_TEST(SharedInt8Array) { |
14203 i::FLAG_harmony_sharedarraybuffer = true; | 14228 i::FLAG_harmony_sharedarraybuffer = true; |
14204 TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array, | 14229 TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array, |
(...skipping 7735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
21940 LocalContext env; | 21965 LocalContext env; |
21941 | 21966 |
21942 env->Global()->Set(v8_str("keys"), v8::Array::GetKeysIterator(isolate)); | 21967 env->Global()->Set(v8_str("keys"), v8::Array::GetKeysIterator(isolate)); |
21943 env->Global()->Set(v8_str("values"), v8::Array::GetValuesIterator(isolate)); | 21968 env->Global()->Set(v8_str("values"), v8::Array::GetValuesIterator(isolate)); |
21944 env->Global()->Set(v8_str("entries"), v8::Array::GetEntriesIterator(isolate)); | 21969 env->Global()->Set(v8_str("entries"), v8::Array::GetEntriesIterator(isolate)); |
21945 | 21970 |
21946 ExpectString("typeof keys", "function"); | 21971 ExpectString("typeof keys", "function"); |
21947 ExpectString("typeof values", "function"); | 21972 ExpectString("typeof values", "function"); |
21948 ExpectString("typeof entries", "function"); | 21973 ExpectString("typeof entries", "function"); |
21949 } | 21974 } |
OLD | NEW |