Repairs to FLAG_pretenure_call_new.
authormvstanton@chromium.org <mvstanton@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 May 2014 08:39:33 +0000 (08:39 +0000)
committermvstanton@chromium.org <mvstanton@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 May 2014 08:39:33 +0000 (08:39 +0000)
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

src/objects.cc
src/type-info.cc
test/cctest/test-heap.cc

index a7b880e..9fe82ed 100644 (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);
index ca3baa1..bf4ac78 100644 (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);
 }
 
 
index 2e1e7a7..6d4da76 100644 (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