Reviewers: danno,
Description:
Implement ClearFunctionTypeFeedback for test cases.
[email protected]
TEST=mjsunit/compiler/inline-construct
Please review this at https://chromiumcodereview.appspot.com/10332010/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/mark-compact.cc
M src/objects.h
M src/objects.cc
M src/runtime.h
M src/runtime.cc
M test/mjsunit/compiler/inline-construct.js
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index
507ad84090860b0c9eb6993b4896619fcefad389..4216e164091366af9d2659961b0efb2108cccfaf
100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1186,16 +1186,7 @@ class StaticMarkingVisitor : public
StaticVisitorBase {
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);
}
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
083a332f1c6cf369e896d6cda3027c08e7937469..970fc24550878072e45297bd6c0601a576165ba3
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8320,6 +8320,20 @@ void Code::ClearInlineCaches() {
}
+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
void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) {
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
5a0fef07ae811c08716c60be98f5b60a692f3d3d..e3a1fd0d25c53f5874718fe86510a047082f768b
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4440,6 +4440,7 @@ class Code: public HeapObject {
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.
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index
1305f8b5c813ff1a5d814d2c8d73609170684c2c..0b80effbf21e86138f7e66ea6290998d3922b7de
100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8277,6 +8277,19 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_DeoptimizeFunction) {
}
+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) {
#if defined(USE_SIMULATOR)
return isolate->heap()->true_value();
Index: src/runtime.h
diff --git a/src/runtime.h b/src/runtime.h
index
9ae1383fbc486906886b6be8e0d8d37973c38429..a09d9cc3cca054e69a49092d0ed5b45771c64b14
100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -89,6 +89,7 @@ namespace internal {
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) \
Index: test/mjsunit/compiler/inline-construct.js
diff --git a/test/mjsunit/compiler/inline-construct.js
b/test/mjsunit/compiler/inline-construct.js
index
af9e69c94020e2ea44283e689d9dd0d0b4809223..7a3f1e44bd256ff5a148ca54e110789b4c79bde2
100644
--- a/test/mjsunit/compiler/inline-construct.js
+++ b/test/mjsunit/compiler/inline-construct.js
@@ -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 @@ function TestInAllContexts(constructor) {
%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