Revision: 11509
Author:   [email protected]
Date:     Fri May  4 02:16:38 2012
Log:      Implement ClearFunctionTypeFeedback for test cases.

[email protected]
TEST=mjsunit/compiler/inline-construct

Review URL: https://chromiumcodereview.appspot.com/10332010
http://code.google.com/p/v8/source/detail?r=11509

Modified:
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/runtime.h
 /branches/bleeding_edge/test/mjsunit/compiler/inline-construct.js

=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Wed May  2 05:58:40 2012
+++ /branches/bleeding_edge/src/mark-compact.cc Fri May  4 02:16:38 2012
@@ -1186,16 +1186,7 @@
     Heap* heap = map->GetHeap();
     Code* code = reinterpret_cast<Code*>(object);
     if (FLAG_cleanup_code_caches_at_gc) {
-      Object* raw_info = code->type_feedback_info();
-      if (raw_info->IsTypeFeedbackInfo()) {
-        TypeFeedbackCells* type_feedback_cells =
-            TypeFeedbackInfo::cast(raw_info)->type_feedback_cells();
-        for (int i = 0; i < type_feedback_cells->CellCount(); i++) {
-          ASSERT(type_feedback_cells->AstId(i)->IsSmi());
-          JSGlobalPropertyCell* cell = type_feedback_cells->Cell(i);
- cell->set_value(TypeFeedbackCells::RawUninitializedSentinel(heap));
-        }
-      }
+      code->ClearTypeFeedbackCells(heap);
     }
     code->CodeIterateBody<StaticMarkingVisitor>(heap);
   }
=======================================
--- /branches/bleeding_edge/src/objects.cc      Thu May  3 05:41:40 2012
+++ /branches/bleeding_edge/src/objects.cc      Fri May  4 02:16:38 2012
@@ -8318,6 +8318,20 @@
     }
   }
 }
+
+
+void Code::ClearTypeFeedbackCells(Heap* heap) {
+  Object* raw_info = type_feedback_info();
+  if (raw_info->IsTypeFeedbackInfo()) {
+    TypeFeedbackCells* type_feedback_cells =
+        TypeFeedbackInfo::cast(raw_info)->type_feedback_cells();
+    for (int i = 0; i < type_feedback_cells->CellCount(); i++) {
+      ASSERT(type_feedback_cells->AstId(i)->IsSmi());
+      JSGlobalPropertyCell* cell = type_feedback_cells->Cell(i);
+      cell->set_value(TypeFeedbackCells::RawUninitializedSentinel(heap));
+    }
+  }
+}


 #ifdef ENABLE_DISASSEMBLER
=======================================
--- /branches/bleeding_edge/src/objects.h       Thu May  3 05:41:40 2012
+++ /branches/bleeding_edge/src/objects.h       Fri May  4 02:16:38 2012
@@ -4440,6 +4440,7 @@
   void CodeVerify();
 #endif
   void ClearInlineCaches();
+  void ClearTypeFeedbackCells(Heap* heap);

   // Max loop nesting marker used to postpose OSR. We don't take loop
   // nesting that is deeper than 5 levels into account.
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Thu Apr 26 13:16:53 2012
+++ /branches/bleeding_edge/src/runtime.cc      Fri May  4 02:16:38 2012
@@ -8275,6 +8275,19 @@

   return isolate->heap()->undefined_value();
 }
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearFunctionTypeFeedback) {
+  HandleScope scope(isolate);
+  ASSERT(args.length() == 1);
+  CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+  Code* unoptimized = function->shared()->code();
+  if (unoptimized->kind() == Code::FUNCTION) {
+    unoptimized->ClearInlineCaches();
+    unoptimized->ClearTypeFeedbackCells(isolate->heap());
+  }
+  return isolate->heap()->undefined_value();
+}


 RUNTIME_FUNCTION(MaybeObject*, Runtime_RunningInSimulator) {
=======================================
--- /branches/bleeding_edge/src/runtime.h       Thu Apr 26 13:16:53 2012
+++ /branches/bleeding_edge/src/runtime.h       Fri May  4 02:16:38 2012
@@ -89,6 +89,7 @@
   F(NotifyDeoptimized, 1, 1) \
   F(NotifyOSR, 0, 1) \
   F(DeoptimizeFunction, 1, 1) \
+  F(ClearFunctionTypeFeedback, 1, 1) \
   F(RunningInSimulator, 0, 1) \
   F(OptimizeFunctionOnNextCall, -1, 1) \
   F(GetOptimizationStatus, 1, 1) \
=======================================
--- /branches/bleeding_edge/test/mjsunit/compiler/inline-construct.js Mon Mar 5 04:46:50 2012 +++ /branches/bleeding_edge/test/mjsunit/compiler/inline-construct.js Fri May 4 02:16:38 2012
@@ -25,7 +25,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-// Flags: --allow-natives-syntax --expose-gc --inline-construct
+// Flags: --allow-natives-syntax --inline-construct

 // Test inlining of constructor calls.

@@ -68,7 +68,9 @@
   %DeoptimizeFunction(value_context);
   %DeoptimizeFunction(test_context);
   %DeoptimizeFunction(effect_context);
-  gc();  // Makes V8 forget about type information for *_context.
+  %ClearFunctionTypeFeedback(value_context);
+  %ClearFunctionTypeFeedback(test_context);
+  %ClearFunctionTypeFeedback(effect_context);
 }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to