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

Side by Side Diff: runtime/vm/object.cc

Issue 12263017: Add flag to block optimizations of large implicit getters. Implicit getters have a 0 size in tokens… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 24 matching lines...) Expand all
35 #include "vm/timer.h" 35 #include "vm/timer.h"
36 #include "vm/unicode.h" 36 #include "vm/unicode.h"
37 37
38 namespace dart { 38 namespace dart {
39 39
40 DEFINE_FLAG(bool, show_internal_names, false, 40 DEFINE_FLAG(bool, show_internal_names, false,
41 "Show names of internal classes (e.g. \"OneByteString\") in error messages " 41 "Show names of internal classes (e.g. \"OneByteString\") in error messages "
42 "instead of showing the corresponding interface names (e.g. \"String\")"); 42 "instead of showing the corresponding interface names (e.g. \"String\")");
43 DEFINE_FLAG(bool, trace_disabling_optimized_code, false, 43 DEFINE_FLAG(bool, trace_disabling_optimized_code, false,
44 "Trace disabling optimized code."); 44 "Trace disabling optimized code.");
45 DEFINE_FLAG(int, huge_method_cutoff, 20000, 45 DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000,
46 "Huge method cutoff: Disables optimizations for huge methods."); 46 "Huge method cutoff in tokens: Disables optimizations for huge methods.");
47 DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000,
48 "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.
47 DECLARE_FLAG(bool, trace_compiler); 49 DECLARE_FLAG(bool, trace_compiler);
48 DECLARE_FLAG(bool, eliminate_type_checks); 50 DECLARE_FLAG(bool, eliminate_type_checks);
49 DECLARE_FLAG(bool, enable_type_checks); 51 DECLARE_FLAG(bool, enable_type_checks);
50 52
51 static const char* kGetterPrefix = "get:"; 53 static const char* kGetterPrefix = "get:";
52 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); 54 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix);
53 static const char* kSetterPrefix = "set:"; 55 static const char* kSetterPrefix = "set:";
54 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); 56 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix);
55 57
56 cpp_vtable Object::handle_vtable_ = 0; 58 cpp_vtable Object::handle_vtable_ = 0;
(...skipping 3600 matching lines...) Expand 10 before | Expand all | Expand 10 after
3657 void Function::SetNumOptionalParameters(intptr_t num_optional_parameters, 3659 void Function::SetNumOptionalParameters(intptr_t num_optional_parameters,
3658 bool are_optional_positional) const { 3660 bool are_optional_positional) const {
3659 ASSERT(num_optional_parameters >= 0); 3661 ASSERT(num_optional_parameters >= 0);
3660 set_num_optional_parameters(are_optional_positional ? 3662 set_num_optional_parameters(are_optional_positional ?
3661 num_optional_parameters : 3663 num_optional_parameters :
3662 -num_optional_parameters); 3664 -num_optional_parameters);
3663 } 3665 }
3664 3666
3665 3667
3666 bool Function::is_optimizable() const { 3668 bool Function::is_optimizable() const {
3667 return OptimizableBit::decode(raw_ptr()->kind_tag_) && 3669 if (OptimizableBit::decode(raw_ptr()->kind_tag_) &&
3668 (script() != Script::null()) && 3670 (script() != Script::null()) &&
3669 !is_native() && 3671 !is_native() &&
3670 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff); 3672 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) {
3673 // Additional check needed for implicit getters.
3674 if (HasCode() &&
3675 (Code::Handle(unoptimized_code()).Size() >=
3676 FLAG_huge_method_cutoff_in_code_size)) {
3677 return false;
3678 } else {
3679 return true;
3680 }
3681 }
3682 return false;
3671 } 3683 }
3672 3684
3673 3685
3674 void Function::set_is_optimizable(bool value) const { 3686 void Function::set_is_optimizable(bool value) const {
3675 set_kind_tag(OptimizableBit::update(value, raw_ptr()->kind_tag_)); 3687 set_kind_tag(OptimizableBit::update(value, raw_ptr()->kind_tag_));
3676 } 3688 }
3677 3689
3678 3690
3679 void Function::set_has_finally(bool value) const { 3691 void Function::set_has_finally(bool value) const {
3680 set_kind_tag(HasFinallyBit::update(value, raw_ptr()->kind_tag_)); 3692 set_kind_tag(HasFinallyBit::update(value, raw_ptr()->kind_tag_));
(...skipping 9113 matching lines...) Expand 10 before | Expand all | Expand 10 after
12794 } 12806 }
12795 return result.raw(); 12807 return result.raw();
12796 } 12808 }
12797 12809
12798 12810
12799 const char* WeakProperty::ToCString() const { 12811 const char* WeakProperty::ToCString() const {
12800 return "_WeakProperty"; 12812 return "_WeakProperty";
12801 } 12813 }
12802 12814
12803 } // namespace dart 12815 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698