Deprecate old code aging mechanism.

The old code aging mechanism is too agressive with flushing as it leads
to many functions being flushed and recompiled over and over again. By
now the new code aging mechanism has stabilized enough to deprecate the
old fallback mechanism.

R=danno@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15209 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent aea73c15
......@@ -811,7 +811,6 @@ static bool InstallFullCode(CompilationInfo* info) {
// Check the function has compiled code.
ASSERT(shared->is_compiled());
shared->set_code_age(0);
shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize));
shared->set_dont_inline(lit->flags()->Contains(kDontInline));
shared->set_ast_node_count(lit->ast_node_count());
......
......@@ -480,7 +480,7 @@ DEFINE_bool(flush_code_incrementally, true,
DEFINE_bool(trace_code_flushing, false, "trace code flushing progress")
DEFINE_bool(age_code, true,
"track un-executed functions to age code and flush only "
"old code")
"old code (required for code flushing)")
DEFINE_bool(incremental_marking, true, "use incremental marking")
DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps")
DEFINE_bool(trace_incremental_marking, false,
......
......@@ -4781,17 +4781,6 @@ BuiltinFunctionId SharedFunctionInfo::builtin_function_id() {
}
int SharedFunctionInfo::code_age() {
return (compiler_hints() >> kCodeAgeShift) & kCodeAgeMask;
}
void SharedFunctionInfo::set_code_age(int code_age) {
int hints = compiler_hints() & ~(kCodeAgeMask << kCodeAgeShift);
set_compiler_hints(hints | ((code_age & kCodeAgeMask) << kCodeAgeShift));
}
int SharedFunctionInfo::ic_age() {
return ICAgeBits::decode(counters());
}
......
......@@ -606,11 +606,6 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
// by optimized version of function.
MarkBit code_mark = Marking::MarkBitFrom(function->code());
if (code_mark.Get()) {
if (!FLAG_age_code) {
if (!Marking::MarkBitFrom(shared_info).Get()) {
shared_info->set_code_age(0);
}
}
return false;
}
......@@ -682,20 +677,12 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
return false;
}
if (FLAG_age_code) {
return shared_info->code()->IsOld();
} else {
// How many collections newly compiled code object will survive before being
// flushed.
static const int kCodeAgeThreshold = 5;
// Age this shared function info.
if (shared_info->code_age() < kCodeAgeThreshold) {
shared_info->set_code_age(shared_info->code_age() + 1);
return false;
}
return true;
// Check age of code. If code aging is disabled we never flush.
if (!FLAG_age_code || !shared_info->code()->IsOld()) {
return false;
}
return true;
}
......
......@@ -9403,7 +9403,6 @@ bool JSFunction::CompileLazy(Handle<JSFunction> function,
bool result = true;
if (function->shared()->is_compiled()) {
function->ReplaceCode(function->shared()->code());
function->shared()->set_code_age(0);
} else {
ASSERT(function->shared()->allows_lazy_compilation());
CompilationInfoWithZone info(function);
......
......@@ -4820,7 +4820,10 @@ class Code: public HeapObject {
};
#undef DECLARE_CODE_AGE_ENUM
// Code aging
// Code aging. Indicates how many full GCs this code has survived without
// being entered through the prologue. Used to determine when it is
// relatively safe to flush this code object and replace it with the lazy
// compilation stub.
static void MakeCodeAgeSequenceYoung(byte* sequence);
void MakeOlder(MarkingParity);
static bool IsYoungSequence(byte* sequence);
......@@ -6139,14 +6142,6 @@ class SharedFunctionInfo: public HeapObject {
// iteration by the debugger).
DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context)
// Indicates how many full GCs this function has survived with assigned
// code object. Used to determine when it is relatively safe to flush
// this code object and replace it with lazy compilation stub.
// Age is reset when GC notices that the code object is referenced
// from the stack or compilation cache.
inline int code_age();
inline void set_code_age(int age);
// Indicates whether optimizations have been disabled for this
// shared function info. If a function is repeatedly optimized or if
// we cannot optimize the function we disable optimization to avoid
......@@ -6390,15 +6385,11 @@ class SharedFunctionInfo: public HeapObject {
static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1);
// Bit positions in compiler_hints.
static const int kCodeAgeSize = 3;
static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1;
enum CompilerHints {
kAllowLazyCompilation,
kAllowLazyCompilationWithoutContext,
kLiveObjectsMayExist,
kCodeAgeShift,
kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize,
kOptimizationDisabled,
kStrictModeFunction,
kExtendedModeFunction,
kUsesArguments,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment