Chromium Code Reviews| 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; |
| } |