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

Side by Side Diff: src/objects-inl.h

Issue 10534063: Reland r11425 "Re-enable optimization for hot functions that have optimization disabled due to many… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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 | « src/objects.cc ('k') | src/runtime-profiler.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3655 matching lines...) Expand 10 before | Expand all | Expand 10 after
3666 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) 3666 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
3667 ACCESSORS(SharedFunctionInfo, initial_map, Object, kInitialMapOffset) 3667 ACCESSORS(SharedFunctionInfo, initial_map, Object, kInitialMapOffset)
3668 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, 3668 ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
3669 kInstanceClassNameOffset) 3669 kInstanceClassNameOffset)
3670 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) 3670 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset)
3671 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) 3671 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset)
3672 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) 3672 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
3673 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) 3673 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
3674 ACCESSORS(SharedFunctionInfo, this_property_assignments, Object, 3674 ACCESSORS(SharedFunctionInfo, this_property_assignments, Object,
3675 kThisPropertyAssignmentsOffset) 3675 kThisPropertyAssignmentsOffset)
3676 SMI_ACCESSORS(SharedFunctionInfo, ic_age, kICAgeOffset) 3676 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset)
3677 3677
3678 3678
3679 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, 3679 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype,
3680 kHiddenPrototypeBit) 3680 kHiddenPrototypeBit)
3681 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit) 3681 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit)
3682 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, 3682 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check,
3683 kNeedsAccessCheckBit) 3683 kNeedsAccessCheckBit)
3684 BOOL_ACCESSORS(FunctionTemplateInfo, flag, read_only_prototype, 3684 BOOL_ACCESSORS(FunctionTemplateInfo, flag, read_only_prototype,
3685 kReadOnlyPrototypeBit) 3685 kReadOnlyPrototypeBit)
3686 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression, 3686 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression,
(...skipping 28 matching lines...) Expand all
3715 SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type, 3715 SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type,
3716 kStartPositionAndTypeOffset) 3716 kStartPositionAndTypeOffset)
3717 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) 3717 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset)
3718 SMI_ACCESSORS(SharedFunctionInfo, function_token_position, 3718 SMI_ACCESSORS(SharedFunctionInfo, function_token_position,
3719 kFunctionTokenPositionOffset) 3719 kFunctionTokenPositionOffset)
3720 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, 3720 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints,
3721 kCompilerHintsOffset) 3721 kCompilerHintsOffset)
3722 SMI_ACCESSORS(SharedFunctionInfo, this_property_assignments_count, 3722 SMI_ACCESSORS(SharedFunctionInfo, this_property_assignments_count,
3723 kThisPropertyAssignmentsCountOffset) 3723 kThisPropertyAssignmentsCountOffset)
3724 SMI_ACCESSORS(SharedFunctionInfo, opt_count, kOptCountOffset) 3724 SMI_ACCESSORS(SharedFunctionInfo, opt_count, kOptCountOffset)
3725 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) 3725 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset)
3726 SMI_ACCESSORS(SharedFunctionInfo, deopt_counter, kDeoptCounterOffset) 3726 SMI_ACCESSORS(SharedFunctionInfo,
3727 stress_deopt_counter,
3728 kStressDeoptCounterOffset)
3727 #else 3729 #else
3728 3730
3729 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ 3731 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \
3730 STATIC_ASSERT(holder::offset % kPointerSize == 0); \ 3732 STATIC_ASSERT(holder::offset % kPointerSize == 0); \
3731 int holder::name() { \ 3733 int holder::name() { \
3732 int value = READ_INT_FIELD(this, offset); \ 3734 int value = READ_INT_FIELD(this, offset); \
3733 ASSERT(kHeapObjectTag == 1); \ 3735 ASSERT(kHeapObjectTag == 1); \
3734 ASSERT((value & kHeapObjectTag) == 0); \ 3736 ASSERT((value & kHeapObjectTag) == 0); \
3735 return value >> 1; \ 3737 return value >> 1; \
3736 } \ 3738 } \
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3768 kFunctionTokenPositionOffset) 3770 kFunctionTokenPositionOffset)
3769 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, 3771 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
3770 compiler_hints, 3772 compiler_hints,
3771 kCompilerHintsOffset) 3773 kCompilerHintsOffset)
3772 3774
3773 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, 3775 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo,
3774 this_property_assignments_count, 3776 this_property_assignments_count,
3775 kThisPropertyAssignmentsCountOffset) 3777 kThisPropertyAssignmentsCountOffset)
3776 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, opt_count, kOptCountOffset) 3778 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, opt_count, kOptCountOffset)
3777 3779
3778 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) 3780 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, counters, kCountersOffset)
3779 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, deopt_counter, kDeoptCounterOffset) 3781 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
3782 stress_deopt_counter,
3783 kStressDeoptCounterOffset)
3780 #endif 3784 #endif
3781 3785
3782 3786
3783 int SharedFunctionInfo::construction_count() { 3787 int SharedFunctionInfo::construction_count() {
3784 return READ_BYTE_FIELD(this, kConstructionCountOffset); 3788 return READ_BYTE_FIELD(this, kConstructionCountOffset);
3785 } 3789 }
3786 3790
3787 3791
3788 void SharedFunctionInfo::set_construction_count(int value) { 3792 void SharedFunctionInfo::set_construction_count(int value) {
3789 ASSERT(0 <= value && value < 256); 3793 ASSERT(0 <= value && value < 256);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3970 return (compiler_hints() >> kCodeAgeShift) & kCodeAgeMask; 3974 return (compiler_hints() >> kCodeAgeShift) & kCodeAgeMask;
3971 } 3975 }
3972 3976
3973 3977
3974 void SharedFunctionInfo::set_code_age(int code_age) { 3978 void SharedFunctionInfo::set_code_age(int code_age) {
3975 int hints = compiler_hints() & ~(kCodeAgeMask << kCodeAgeShift); 3979 int hints = compiler_hints() & ~(kCodeAgeMask << kCodeAgeShift);
3976 set_compiler_hints(hints | ((code_age & kCodeAgeMask) << kCodeAgeShift)); 3980 set_compiler_hints(hints | ((code_age & kCodeAgeMask) << kCodeAgeShift));
3977 } 3981 }
3978 3982
3979 3983
3984 int SharedFunctionInfo::ic_age() {
3985 return ICAgeBits::decode(counters());
3986 }
3987
3988
3989 void SharedFunctionInfo::set_ic_age(int ic_age) {
3990 set_counters(ICAgeBits::update(counters(), ic_age));
3991 }
3992
3993
3994 int SharedFunctionInfo::deopt_count() {
3995 return DeoptCountBits::decode(counters());
3996 }
3997
3998
3999 void SharedFunctionInfo::set_deopt_count(int deopt_count) {
4000 set_counters(DeoptCountBits::update(counters(), deopt_count));
4001 }
4002
4003
4004 void SharedFunctionInfo::increment_deopt_count() {
4005 int value = counters();
4006 int deopt_count = DeoptCountBits::decode(value);
4007 deopt_count = (deopt_count + 1) & DeoptCountBits::kMax;
4008 set_counters(DeoptCountBits::update(value, deopt_count));
4009 }
4010
4011
4012 int SharedFunctionInfo::opt_reenable_tries() {
4013 return OptReenableTriesBits::decode(counters());
4014 }
4015
4016
4017 void SharedFunctionInfo::set_opt_reenable_tries(int tries) {
4018 set_counters(OptReenableTriesBits::update(counters(), tries));
4019 }
4020
4021
3980 bool SharedFunctionInfo::has_deoptimization_support() { 4022 bool SharedFunctionInfo::has_deoptimization_support() {
3981 Code* code = this->code(); 4023 Code* code = this->code();
3982 return code->kind() == Code::FUNCTION && code->has_deoptimization_support(); 4024 return code->kind() == Code::FUNCTION && code->has_deoptimization_support();
3983 } 4025 }
3984 4026
3985 4027
4028 void SharedFunctionInfo::TryReenableOptimization() {
4029 int tries = opt_reenable_tries();
4030 set_opt_reenable_tries((tries + 1) & OptReenableTriesBits::kMax);
4031 // We reenable optimization whenever the number of tries is a large
4032 // enough power of 2.
4033 if (tries >= 16 && (((tries - 1) & tries) == 0)) {
4034 set_optimization_disabled(false);
4035 set_opt_count(0);
4036 set_deopt_count(0);
4037 code()->set_optimizable(true);
4038 }
4039 }
4040
4041
3986 bool JSFunction::IsBuiltin() { 4042 bool JSFunction::IsBuiltin() {
3987 return context()->global()->IsJSBuiltinsObject(); 4043 return context()->global()->IsJSBuiltinsObject();
3988 } 4044 }
3989 4045
3990 4046
3991 bool JSFunction::NeedsArgumentsAdaption() { 4047 bool JSFunction::NeedsArgumentsAdaption() {
3992 return shared()->formal_parameter_count() != 4048 return shared()->formal_parameter_count() !=
3993 SharedFunctionInfo::kDontAdaptArgumentsSentinel; 4049 SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3994 } 4050 }
3995 4051
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
5123 #undef WRITE_UINT32_FIELD 5179 #undef WRITE_UINT32_FIELD
5124 #undef READ_SHORT_FIELD 5180 #undef READ_SHORT_FIELD
5125 #undef WRITE_SHORT_FIELD 5181 #undef WRITE_SHORT_FIELD
5126 #undef READ_BYTE_FIELD 5182 #undef READ_BYTE_FIELD
5127 #undef WRITE_BYTE_FIELD 5183 #undef WRITE_BYTE_FIELD
5128 5184
5129 5185
5130 } } // namespace v8::internal 5186 } } // namespace v8::internal
5131 5187
5132 #endif // V8_OBJECTS_INL_H_ 5188 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698