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 3961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3972 Handle<JSArray> array = factory->NewJSArrayWithElements(array_data, | 3972 Handle<JSArray> array = factory->NewJSArrayWithElements(array_data, |
3973 FAST_SMI_ELEMENTS, | 3973 FAST_SMI_ELEMENTS, |
3974 NOT_TENURED); | 3974 NOT_TENURED); |
3975 | 3975 |
3976 CHECK_EQ(Smi::FromInt(2), array->length()); | 3976 CHECK_EQ(Smi::FromInt(2), array->length()); |
3977 CHECK(array->HasFastSmiOrObjectElements()); | 3977 CHECK(array->HasFastSmiOrObjectElements()); |
3978 | 3978 |
3979 // We need filler the size of AllocationMemento object, plus an extra | 3979 // We need filler the size of AllocationMemento object, plus an extra |
3980 // fill pointer value. | 3980 // fill pointer value. |
3981 HeapObject* obj = NULL; | 3981 HeapObject* obj = NULL; |
3982 AllocationResult allocation = CcTest::heap()->new_space()->AllocateRaw( | 3982 AllocationResult allocation = |
3983 AllocationMemento::kSize + kPointerSize); | 3983 CcTest::heap()->new_space()->AllocateRawUnaligned( |
| 3984 AllocationMemento::kSize + kPointerSize); |
3984 CHECK(allocation.To(&obj)); | 3985 CHECK(allocation.To(&obj)); |
3985 Address addr_obj = obj->address(); | 3986 Address addr_obj = obj->address(); |
3986 CcTest::heap()->CreateFillerObjectAt( | 3987 CcTest::heap()->CreateFillerObjectAt( |
3987 addr_obj, AllocationMemento::kSize + kPointerSize); | 3988 addr_obj, AllocationMemento::kSize + kPointerSize); |
3988 | 3989 |
3989 // Give the array a name, making sure not to allocate strings. | 3990 // Give the array a name, making sure not to allocate strings. |
3990 v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array); | 3991 v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array); |
3991 CcTest::global()->Set(array_name, array_obj); | 3992 CcTest::global()->Set(array_name, array_obj); |
3992 | 3993 |
3993 // This should crash with a protection violation if we are running a build | 3994 // This should crash with a protection violation if we are running a build |
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5476 shared.SetWeak(&shared, SharedHasBeenCollected, | 5477 shared.SetWeak(&shared, SharedHasBeenCollected, |
5477 v8::WeakCallbackType::kParameter); | 5478 v8::WeakCallbackType::kParameter); |
5478 builtin_exports.SetWeak(&builtin_exports, BuiltinExportsHasBeenCollected, | 5479 builtin_exports.SetWeak(&builtin_exports, BuiltinExportsHasBeenCollected, |
5479 v8::WeakCallbackType::kParameter); | 5480 v8::WeakCallbackType::kParameter); |
5480 | 5481 |
5481 CcTest::heap()->CollectAllAvailableGarbage("fire weak callbacks"); | 5482 CcTest::heap()->CollectAllAvailableGarbage("fire weak callbacks"); |
5482 | 5483 |
5483 CHECK(shared_has_been_collected); | 5484 CHECK(shared_has_been_collected); |
5484 CHECK(builtin_exports_has_been_collected); | 5485 CHECK(builtin_exports_has_been_collected); |
5485 } | 5486 } |
OLD | NEW |