Chromium Code Reviews| 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..839822a70164aaea0d0604c167758bb49742cc60 100644 |
| --- a/src/ia32/full-codegen-ia32.cc |
| +++ b/src/ia32/full-codegen-ia32.cc |
| @@ -129,6 +129,29 @@ 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 && |
|
fschneider
2011/12/13 11:53:01
If a function has optimization disabled via Disabl
Jakob Kummerow
2011/12/14 08:42:31
Done.
|
| + info->function()->is_primitive() && |
|
fschneider
2011/12/12 11:31:21
What is a primitive function? I can't find the sou
Jakob Kummerow
2011/12/14 08:42:31
Basically a function that doesn't contain loops, c
|
| + !Serializer::enabled()) { |
| + 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 |