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 3152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3163 | 3163 |
3164 // First make sure we flip spaces | 3164 // First make sure we flip spaces |
3165 HEAP->CollectGarbage(NEW_SPACE); | 3165 HEAP->CollectGarbage(NEW_SPACE); |
3166 | 3166 |
3167 // Allocate the object. | 3167 // Allocate the object. |
3168 Handle<FixedArray> array_data = factory->NewFixedArray(2, NOT_TENURED); | 3168 Handle<FixedArray> array_data = factory->NewFixedArray(2, NOT_TENURED); |
3169 array_data->set(0, Smi::FromInt(1)); | 3169 array_data->set(0, Smi::FromInt(1)); |
3170 array_data->set(1, Smi::FromInt(2)); | 3170 array_data->set(1, Smi::FromInt(2)); |
3171 | 3171 |
3172 AllocateAllButNBytes(HEAP->new_space(), | 3172 AllocateAllButNBytes(HEAP->new_space(), |
3173 JSArray::kSize + AllocationSiteInfo::kSize + | 3173 JSArray::kSize + AllocationMemento::kSize + |
3174 kPointerSize); | 3174 kPointerSize); |
3175 | 3175 |
3176 Handle<JSArray> array = factory->NewJSArrayWithElements(array_data, | 3176 Handle<JSArray> array = factory->NewJSArrayWithElements(array_data, |
3177 FAST_SMI_ELEMENTS, | 3177 FAST_SMI_ELEMENTS, |
3178 NOT_TENURED); | 3178 NOT_TENURED); |
3179 | 3179 |
3180 CHECK_EQ(Smi::FromInt(2), array->length()); | 3180 CHECK_EQ(Smi::FromInt(2), array->length()); |
3181 CHECK(array->HasFastSmiOrObjectElements()); | 3181 CHECK(array->HasFastSmiOrObjectElements()); |
3182 | 3182 |
3183 // We need filler the size of AllocationSiteInfo object, plus an extra | 3183 // We need filler the size of AllocationMemento object, plus an extra |
3184 // fill pointer value. | 3184 // fill pointer value. |
3185 MaybeObject* maybe_object = HEAP->AllocateRaw( | 3185 MaybeObject* maybe_object = HEAP->AllocateRaw( |
3186 AllocationSiteInfo::kSize + kPointerSize, NEW_SPACE, OLD_POINTER_SPACE); | 3186 AllocationMemento::kSize + kPointerSize, NEW_SPACE, OLD_POINTER_SPACE); |
3187 Object* obj = NULL; | 3187 Object* obj = NULL; |
3188 CHECK(maybe_object->ToObject(&obj)); | 3188 CHECK(maybe_object->ToObject(&obj)); |
3189 Address addr_obj = reinterpret_cast<Address>( | 3189 Address addr_obj = reinterpret_cast<Address>( |
3190 reinterpret_cast<byte*>(obj - kHeapObjectTag)); | 3190 reinterpret_cast<byte*>(obj - kHeapObjectTag)); |
3191 HEAP->CreateFillerObjectAt(addr_obj, | 3191 HEAP->CreateFillerObjectAt(addr_obj, |
3192 AllocationSiteInfo::kSize + kPointerSize); | 3192 AllocationMemento::kSize + kPointerSize); |
3193 | 3193 |
3194 // Give the array a name, making sure not to allocate strings. | 3194 // Give the array a name, making sure not to allocate strings. |
3195 v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array); | 3195 v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array); |
3196 v8::Context::GetCurrent()->Global()->Set(array_name, array_obj); | 3196 v8::Context::GetCurrent()->Global()->Set(array_name, array_obj); |
3197 | 3197 |
3198 // This should crash with a protection violation if we are running a build | 3198 // This should crash with a protection violation if we are running a build |
3199 // with the bug. | 3199 // with the bug. |
3200 AlwaysAllocateScope aa_scope; | 3200 AlwaysAllocateScope aa_scope; |
3201 v8::Script::Compile(mote_code_string)->Run(); | 3201 v8::Script::Compile(mote_code_string)->Run(); |
3202 } | 3202 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3348 " var a = new Array(n);" | 3348 " var a = new Array(n);" |
3349 " for (var i = 0; i < n; i += 100) a[i] = i;" | 3349 " for (var i = 0; i < n; i += 100) a[i] = i;" |
3350 "};" | 3350 "};" |
3351 "f(10 * 1024 * 1024);"); | 3351 "f(10 * 1024 * 1024);"); |
3352 IncrementalMarking* marking = HEAP->incremental_marking(); | 3352 IncrementalMarking* marking = HEAP->incremental_marking(); |
3353 if (marking->IsStopped()) marking->Start(); | 3353 if (marking->IsStopped()) marking->Start(); |
3354 // This big step should be sufficient to mark the whole array. | 3354 // This big step should be sufficient to mark the whole array. |
3355 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 3355 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
3356 ASSERT(marking->IsComplete()); | 3356 ASSERT(marking->IsComplete()); |
3357 } | 3357 } |
OLD | NEW |