Chromium Code Reviews| Index: runtime/vm/object.cc |
| =================================================================== |
| --- runtime/vm/object.cc (revision 18461) |
| +++ runtime/vm/object.cc (working copy) |
| @@ -42,8 +42,10 @@ |
| "instead of showing the corresponding interface names (e.g. \"String\")"); |
| DEFINE_FLAG(bool, trace_disabling_optimized_code, false, |
| "Trace disabling optimized code."); |
| -DEFINE_FLAG(int, huge_method_cutoff, 20000, |
| - "Huge method cutoff: Disables optimizations for huge methods."); |
| +DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000, |
| + "Huge method cutoff in tokens: Disables optimizations for huge methods."); |
| +DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000, |
| + "Huge method cutoff in unoptimized code size: disables optimization."); |
|
siva
2013/02/13 21:31:17
I think the code cut of size should be in words so
srdjan
2013/02/13 21:37:10
Done.
|
| DECLARE_FLAG(bool, trace_compiler); |
| DECLARE_FLAG(bool, eliminate_type_checks); |
| DECLARE_FLAG(bool, enable_type_checks); |
| @@ -3664,10 +3666,20 @@ |
| bool Function::is_optimizable() const { |
| - return OptimizableBit::decode(raw_ptr()->kind_tag_) && |
| - (script() != Script::null()) && |
| - !is_native() && |
| - ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff); |
| + if (OptimizableBit::decode(raw_ptr()->kind_tag_) && |
| + (script() != Script::null()) && |
| + !is_native() && |
| + ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) { |
| + // Additional check needed for implicit getters. |
| + if (HasCode() && |
| + (Code::Handle(unoptimized_code()).Size() >= |
| + FLAG_huge_method_cutoff_in_code_size)) { |
| + return false; |
| + } else { |
| + return true; |
| + } |
| + } |
| + return false; |
| } |