Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: src/objects.cc

Issue 9207002: Add a deoptimization count to each function to limit number of re-compilations. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/objects.cc
===================================================================
--- src/objects.cc (revision 10399)
+++ src/objects.cc (working copy)
@@ -7367,12 +7367,6 @@
}
-void JSFunction::PrintName(FILE* out) {
- SmartArrayPointer<char> name = shared()->DebugName()->ToCString();
- PrintF(out, "%s", *name);
-}
-
-
Context* JSFunction::GlobalContextFromLiterals(FixedArray* literals) {
return Context::cast(literals->get(JSFunction::kLiteralGlobalContextIndex));
}
@@ -7609,7 +7603,16 @@
}
-void SharedFunctionInfo::DisableOptimization(JSFunction* function) {
+void SharedFunctionInfo::IncrementAndCheckDeoptCount() {
+ set_deopt_count(deopt_count() + 1);
+ const int kMaxDeoptCount = FLAG_deopt_every_n_times == 0
+ ? Compiler::kDefaultMaxDeoptCount
+ : 1000;
+ if (deopt_count() > kMaxDeoptCount) DisableOptimization();
+}
+
+
+void SharedFunctionInfo::DisableOptimization() {
// Disable optimization for the shared function info and mark the
// code as non-optimizable. The marker on the shared function info
// is there because we flush non-optimized code thereby loosing the
@@ -7626,12 +7629,18 @@
}
if (FLAG_trace_opt) {
PrintF("[disabled optimization for: ");
- function->PrintName();
- PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function));
+ PrintName();
+ PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(this));
}
}
+void SharedFunctionInfo::PrintName(FILE* out) {
+ SmartArrayPointer<char> name = DebugName()->ToCString();
+ PrintF(out, "%s", *name);
+}
+
+
bool SharedFunctionInfo::VerifyBailoutId(int id) {
// TODO(srdjan): debugging ARM crashes in hydrogen. OK to disable while
// we are always bailing out on ARM.
@@ -8008,7 +8017,7 @@
JSFunction::cast(LiteralArray()->get(function_id));
unsigned height = iterator.Next();
PrintF(out, "{ast_id=%d, function=", ast_id);
- function->PrintName(out);
+ function->shared()->PrintName(out);
Jakob Kummerow 2012/01/16 11:41:25 nit: since you defined JSFunction::PrintName(...),
fschneider 2012/01/19 10:26:11 Done.
PrintF(out, ", height=%u}", height);
break;
}

Powered by Google App Engine
This is Rietveld 408576698