Repairs to FLAG_pretenure_call_new.

R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/307583002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21553 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mvstanton@chromium.org 2014-05-28 08:39:33 +00:00
parent 3812677b42
commit 5f7fed0134
3 changed files with 13 additions and 16 deletions

View File

@ -11217,14 +11217,7 @@ void SharedFunctionInfo::ClearTypeFeedbackInfo() {
// 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);

View File

@ -133,14 +133,10 @@ KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode(
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);
}

View File

@ -2531,6 +2531,9 @@ TEST(OptimizedPretenuringConstructorCalls) {
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;"
@ -2549,7 +2552,8 @@ TEST(OptimizedPretenuringConstructorCalls) {
"f(); f();"
"%%OptimizeFunctionOnNextCall(f);"
"f();",
AllocationSite::kPretenureMinimumCreated);
AllocationSite::kPretenureMinimumCreated +
JSFunction::kGenerousAllocationCount);
v8::Local<v8::Value> res = CompileRun(source.start());
@ -2573,9 +2577,12 @@ TEST(OptimizedPretenuringCallNew) {
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() {"
@ -2588,7 +2595,8 @@ TEST(OptimizedPretenuringCallNew) {
"f(); f();"
"%%OptimizeFunctionOnNextCall(f);"
"f();",
AllocationSite::kPretenureMinimumCreated);
AllocationSite::kPretenureMinimumCreated +
JSFunction::kGenerousAllocationCount);
v8::Local<v8::Value> res = CompileRun(source.start());
@ -3803,7 +3811,7 @@ TEST(EnsureAllocationSiteDependentCodesProcessed) {
// 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