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

Unified Diff: src/ia32/full-codegen-ia32.cc

Issue 8700008: New approach to Crankshaft decision-making (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 9 years 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
« no previous file with comments | « src/heap.cc ('k') | src/ic.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index 6e2391110b2346903d53b6d365fbe3d405afe3c1..460af72331d7d91f9c3d832a9e4c770310a2ae2b 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -129,6 +129,31 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
}
#endif
+ // Primitive functions are unlikely to be picked up by the stack-walking
+ // profiler, so they trigger their own optimization when they're called
+ // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time.
+ if (FLAG_crankshaft &&
+ info->function()->is_primitive() &&
+ !Serializer::enabled() &&
+ !(!info->shared_info().is_null() &&
+ info->shared_info()->optimization_disabled())) {
+ if (FLAG_trace_opt) {
+ PrintF("[adding self-optimization header to %s]\n",
+ *info->function()->debug_name()->ToCString());
+ }
+ MaybeObject* maybe_cell = isolate()->heap()->AllocateJSGlobalPropertyCell(
+ Smi::FromInt(Compiler::kCallsUntilPrimitiveOpt));
+ JSGlobalPropertyCell* cell;
+ if (maybe_cell->To(&cell)) {
+ __ mov(eax, Immediate(Handle<JSGlobalPropertyCell>(cell)));
+ __ sub(FieldOperand(eax, JSGlobalPropertyCell::kValueOffset),
+ Immediate(Smi::FromInt(1)));
+ Handle<Code> compile_stub(
+ isolate()->builtins()->builtin(Builtins::kLazyRecompile));
+ __ j(zero, compile_stub);
+ }
+ }
+
// Strict mode functions and builtins need to replace the receiver
// with undefined when called as functions (without an explicit
// receiver object). ecx is zero for method calls and non-zero for
« no previous file with comments | « src/heap.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698