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

Unified Diff: src/objects-inl.h

Issue 10534063: Reland r11425 "Re-enable optimization for hot functions that have optimization disabled due to many… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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
« src/objects.h ('K') | « src/objects.cc ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 0620e0e876ed6cb7754d35f342bfc8ed5117efc9..3c6e5bace0a4d70d6c0f18526f8918ea44893abe 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -3617,7 +3617,7 @@ ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
ACCESSORS(SharedFunctionInfo, this_property_assignments, Object,
kThisPropertyAssignmentsOffset)
-SMI_ACCESSORS(SharedFunctionInfo, ic_age, kICAgeOffset)
+SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset)
BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype,
@@ -3666,8 +3666,10 @@ SMI_ACCESSORS(SharedFunctionInfo, compiler_hints,
SMI_ACCESSORS(SharedFunctionInfo, this_property_assignments_count,
kThisPropertyAssignmentsCountOffset)
SMI_ACCESSORS(SharedFunctionInfo, opt_count, kOptCountOffset)
-SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset)
-SMI_ACCESSORS(SharedFunctionInfo, deopt_counter, kDeoptCounterOffset)
+SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset)
+SMI_ACCESSORS(SharedFunctionInfo,
+ stress_deopt_counter,
+ kStressDeoptCounterOffset)
#else
#define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \
@@ -3719,8 +3721,10 @@ PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo,
kThisPropertyAssignmentsCountOffset)
PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, opt_count, kOptCountOffset)
-PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset)
-PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, deopt_counter, kDeoptCounterOffset)
+PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, counters, kCountersOffset)
+PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
+ stress_deopt_counter,
+ kStressDeoptCounterOffset)
#endif
@@ -3921,12 +3925,72 @@ void SharedFunctionInfo::set_code_age(int code_age) {
}
+int SharedFunctionInfo::ic_age() {
Jakob Kummerow 2012/06/11 12:13:59 Y U NO use BitField<type, shift, size>? That'd aut
ulan 2012/06/11 16:07:31 Yeah, BitField is cleaner. Done.
+ return (counters() >> kICAgeShift) & kICAgeMask;
+}
+
+
+void SharedFunctionInfo::set_ic_age(int ic_age) {
+ ASSERT(ic_age <= kICAgeMask);
+ int value = counters() & ~(kICAgeMask << kICAgeShift);
+ set_counters(value | ((ic_age & kICAgeMask) << kICAgeShift));
+}
+
+
+int SharedFunctionInfo::deopt_count() {
+ return (counters() >> kDeoptCountShift) & kDeoptCountMask;
+}
+
+
+void SharedFunctionInfo::set_deopt_count(int deopt_count) {
+ ASSERT(deopt_count <= kDeoptCountMask);
+ int value = counters() & ~(kDeoptCountMask << kDeoptCountShift);
+ set_counters(value | ((deopt_count & kDeoptCountMask) << kDeoptCountShift));
+}
+
+
+void SharedFunctionInfo::increment_deopt_count() {
+ int value = counters();
+ int deopt_count = (value >> kDeoptCountShift) & kDeoptCountMask;
+ deopt_count++;
+ value &= ~(kDeoptCountMask << kDeoptCountShift);
+ set_counters(value | ((deopt_count & kDeoptCountMask) << kDeoptCountShift));
+}
+
+
+int SharedFunctionInfo::opt_reenable_tries() {
+ return (counters() >> kOptReenableTriesShift) & kOptReenableTriesMask;
+}
+
+
+void SharedFunctionInfo::set_opt_reenable_tries(int tries) {
+ ASSERT(tries <= kOptReenableTriesMask);
+ int value = counters() & ~(kOptReenableTriesMask << kOptReenableTriesShift);
+ value |= ((tries & kOptReenableTriesMask) << kOptReenableTriesShift);
+ set_counters(value);
+}
+
+
bool SharedFunctionInfo::has_deoptimization_support() {
Code* code = this->code();
return code->kind() == Code::FUNCTION && code->has_deoptimization_support();
}
+void SharedFunctionInfo::TryReenableOptimization() {
+ int tries = opt_reenable_tries();
+ set_opt_reenable_tries(tries + 1);
+ // We reenable optimization whenever the number of tries is a large
+ // enough power of 2.
+ if (tries >= 16 && (((tries - 1) & tries) == 0)) {
+ set_optimization_disabled(false);
+ set_opt_count(0);
+ set_deopt_count(0);
+ code()->set_optimizable(true);
+ }
+}
+
+
bool JSFunction::IsBuiltin() {
return context()->global()->IsJSBuiltinsObject();
}
« src/objects.h ('K') | « src/objects.cc ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698