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

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') | tests/language/large_implicit_getter_test.dart » ('j') | 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, 50000,
48 "Huge method cutoff in unoptimized code size (in words).");
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 3607 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 void Function::SetNumOptionalParameters(intptr_t num_optional_parameters, 3666 void Function::SetNumOptionalParameters(intptr_t num_optional_parameters,
3665 bool are_optional_positional) const { 3667 bool are_optional_positional) const {
3666 ASSERT(num_optional_parameters >= 0); 3668 ASSERT(num_optional_parameters >= 0);
3667 set_num_optional_parameters(are_optional_positional ? 3669 set_num_optional_parameters(are_optional_positional ?
3668 num_optional_parameters : 3670 num_optional_parameters :
3669 -num_optional_parameters); 3671 -num_optional_parameters);
3670 } 3672 }
3671 3673
3672 3674
3673 bool Function::is_optimizable() const { 3675 bool Function::is_optimizable() const {
3674 return OptimizableBit::decode(raw_ptr()->kind_tag_) && 3676 if (OptimizableBit::decode(raw_ptr()->kind_tag_) &&
3675 (script() != Script::null()) && 3677 (script() != Script::null()) &&
3676 !is_native() && 3678 !is_native() &&
3677 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff); 3679 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) {
3680 // Additional check needed for implicit getters.
3681 if (HasCode() &&
3682 (Code::Handle(unoptimized_code()).Size() >=
3683 FLAG_huge_method_cutoff_in_code_size * kWordSize)) {
3684 return false;
3685 } else {
3686 return true;
3687 }
3688 }
3689 return false;
3678 } 3690 }
3679 3691
3680 3692
3681 void Function::set_is_optimizable(bool value) const { 3693 void Function::set_is_optimizable(bool value) const {
3682 set_kind_tag(OptimizableBit::update(value, raw_ptr()->kind_tag_)); 3694 set_kind_tag(OptimizableBit::update(value, raw_ptr()->kind_tag_));
3683 } 3695 }
3684 3696
3685 3697
3686 void Function::set_has_finally(bool value) const { 3698 void Function::set_has_finally(bool value) const {
3687 set_kind_tag(HasFinallyBit::update(value, raw_ptr()->kind_tag_)); 3699 set_kind_tag(HasFinallyBit::update(value, raw_ptr()->kind_tag_));
(...skipping 9185 matching lines...) Expand 10 before | Expand all | Expand 10 after
12873 } 12885 }
12874 return result.raw(); 12886 return result.raw();
12875 } 12887 }
12876 12888
12877 12889
12878 const char* WeakProperty::ToCString() const { 12890 const char* WeakProperty::ToCString() const {
12879 return "_WeakProperty"; 12891 return "_WeakProperty";
12880 } 12892 }
12881 12893
12882 } // namespace dart 12894 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | tests/language/large_implicit_getter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698