// AllocationSites are not cleared because they do not store
// information that leaks.
break;
- case JS_FUNCTION_TYPE:
- // No need to clear the native context array function.
- if (obj == JSFunction::cast(obj)->context()->native_context()->
- get(Context::ARRAY_FUNCTION_INDEX)) {
- break;
- }
// Fall through...
-
default:
vector->set(i, TypeFeedbackInfo::RawUninitializedSentinel(heap),
SKIP_WRITE_BARRIER);
Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(int slot) {
Handle<Object> info = GetInfo(slot);
if (info->IsAllocationSite()) {
- ASSERT(!FLAG_pretenuring_call_new);
return Handle<JSFunction>(isolate()->native_context()->array_function());
- } else {
- return Handle<JSFunction>::cast(info);
}
- ASSERT(info->IsAllocationSite());
- return Handle<JSFunction>(isolate()->native_context()->array_function());
+ return Handle<JSFunction>::cast(info);
}
v8::HandleScope scope(CcTest::isolate());
i::ScopedVector<char> source(1024);
+ // Call new is doing slack tracking for the first
+ // JSFunction::kGenerousAllocationCount allocations, and we can't find
+ // mementos during that time.
i::OS::SNPrintF(
source,
"var number_elements = %d;"
"f(); f();"
"%%OptimizeFunctionOnNextCall(f);"
"f();",
- AllocationSite::kPretenureMinimumCreated);
+ AllocationSite::kPretenureMinimumCreated +
+ JSFunction::kGenerousAllocationCount);
v8::Local<v8::Value> res = CompileRun(source.start());
v8::HandleScope scope(CcTest::isolate());
i::ScopedVector<char> source(1024);
+ // Call new is doing slack tracking for the first
+ // JSFunction::kGenerousAllocationCount allocations, and we can't find
+ // mementos during that time.
i::OS::SNPrintF(
source,
- "var number_elements = 100;"
+ "var number_elements = %d;"
"var elements = new Array(number_elements);"
"function g() { this.a = 0; }"
"function f() {"
"f(); f();"
"%%OptimizeFunctionOnNextCall(f);"
"f();",
- AllocationSite::kPretenureMinimumCreated);
+ AllocationSite::kPretenureMinimumCreated +
+ JSFunction::kGenerousAllocationCount);
v8::Local<v8::Value> res = CompileRun(source.start());
// Now make sure that a gc should get rid of the function, even though we
// still have the allocation site alive.
for (int i = 0; i < 4; i++) {
- heap->CollectAllGarbage(false);
+ heap->CollectAllGarbage(Heap::kNoGCFlags);
}
// The site still exists because of our global handle, but the code is no