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

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

Issue 1148043002: Remove obsolete Code::optimizable flag. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 4900 matching lines...) Expand 10 before | Expand all | Expand 10 after
4911 4911
4912 4912
4913 inline void Code::set_can_have_weak_objects(bool value) { 4913 inline void Code::set_can_have_weak_objects(bool value) {
4914 DCHECK(kind() == OPTIMIZED_FUNCTION); 4914 DCHECK(kind() == OPTIMIZED_FUNCTION);
4915 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); 4915 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
4916 int updated = CanHaveWeakObjectsField::update(previous, value); 4916 int updated = CanHaveWeakObjectsField::update(previous, value);
4917 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); 4917 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
4918 } 4918 }
4919 4919
4920 4920
4921 bool Code::optimizable() {
4922 DCHECK_EQ(FUNCTION, kind());
4923 return READ_BYTE_FIELD(this, kOptimizableOffset) == 1;
4924 }
4925
4926
4927 void Code::set_optimizable(bool value) {
4928 DCHECK_EQ(FUNCTION, kind());
4929 WRITE_BYTE_FIELD(this, kOptimizableOffset, value ? 1 : 0);
4930 }
4931
4932
4933 bool Code::has_deoptimization_support() { 4921 bool Code::has_deoptimization_support() {
4934 DCHECK_EQ(FUNCTION, kind()); 4922 DCHECK_EQ(FUNCTION, kind());
4935 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); 4923 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags);
4936 return FullCodeFlagsHasDeoptimizationSupportField::decode(flags); 4924 return FullCodeFlagsHasDeoptimizationSupportField::decode(flags);
4937 } 4925 }
4938 4926
4939 4927
4940 void Code::set_has_deoptimization_support(bool value) { 4928 void Code::set_has_deoptimization_support(bool value) {
4941 DCHECK_EQ(FUNCTION, kind()); 4929 DCHECK_EQ(FUNCTION, kind());
4942 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); 4930 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags);
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
5734 BOOL_GETTER(SharedFunctionInfo, 5722 BOOL_GETTER(SharedFunctionInfo,
5735 compiler_hints, 5723 compiler_hints,
5736 optimization_disabled, 5724 optimization_disabled,
5737 kOptimizationDisabled) 5725 kOptimizationDisabled)
5738 5726
5739 5727
5740 void SharedFunctionInfo::set_optimization_disabled(bool disable) { 5728 void SharedFunctionInfo::set_optimization_disabled(bool disable) {
5741 set_compiler_hints(BooleanBit::set(compiler_hints(), 5729 set_compiler_hints(BooleanBit::set(compiler_hints(),
5742 kOptimizationDisabled, 5730 kOptimizationDisabled,
5743 disable)); 5731 disable));
5744 // If disabling optimizations we reflect that in the code object so
5745 // it will not be counted as optimizable code.
5746 if ((code()->kind() == Code::FUNCTION) && disable) {
5747 code()->set_optimizable(false);
5748 }
5749 } 5732 }
5750 5733
5751 5734
5752 LanguageMode SharedFunctionInfo::language_mode() { 5735 LanguageMode SharedFunctionInfo::language_mode() {
5753 STATIC_ASSERT(LANGUAGE_END == 3); 5736 STATIC_ASSERT(LANGUAGE_END == 3);
5754 return construct_language_mode( 5737 return construct_language_mode(
5755 BooleanBit::get(compiler_hints(), kStrictModeFunction), 5738 BooleanBit::get(compiler_hints(), kStrictModeFunction),
5756 BooleanBit::get(compiler_hints(), kStrongModeFunction)); 5739 BooleanBit::get(compiler_hints(), kStrongModeFunction));
5757 } 5740 }
5758 5741
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
5980 5963
5981 void SharedFunctionInfo::TryReenableOptimization() { 5964 void SharedFunctionInfo::TryReenableOptimization() {
5982 int tries = opt_reenable_tries(); 5965 int tries = opt_reenable_tries();
5983 set_opt_reenable_tries((tries + 1) & OptReenableTriesBits::kMax); 5966 set_opt_reenable_tries((tries + 1) & OptReenableTriesBits::kMax);
5984 // We reenable optimization whenever the number of tries is a large 5967 // We reenable optimization whenever the number of tries is a large
5985 // enough power of 2. 5968 // enough power of 2.
5986 if (tries >= 16 && (((tries - 1) & tries) == 0)) { 5969 if (tries >= 16 && (((tries - 1) & tries) == 0)) {
5987 set_optimization_disabled(false); 5970 set_optimization_disabled(false);
5988 set_opt_count(0); 5971 set_opt_count(0);
5989 set_deopt_count(0); 5972 set_deopt_count(0);
5990 code()->set_optimizable(true);
5991 } 5973 }
5992 } 5974 }
5993 5975
5994 5976
5995 bool JSFunction::IsBuiltin() { 5977 bool JSFunction::IsBuiltin() {
5996 return context()->global_object()->IsJSBuiltinsObject(); 5978 return context()->global_object()->IsJSBuiltinsObject();
5997 } 5979 }
5998 5980
5999 5981
6000 bool JSFunction::IsFromNativeScript() { 5982 bool JSFunction::IsFromNativeScript() {
(...skipping 17 matching lines...) Expand all
6018 SharedFunctionInfo::kDontAdaptArgumentsSentinel; 6000 SharedFunctionInfo::kDontAdaptArgumentsSentinel;
6019 } 6001 }
6020 6002
6021 6003
6022 bool JSFunction::IsOptimized() { 6004 bool JSFunction::IsOptimized() {
6023 return code()->kind() == Code::OPTIMIZED_FUNCTION; 6005 return code()->kind() == Code::OPTIMIZED_FUNCTION;
6024 } 6006 }
6025 6007
6026 6008
6027 bool JSFunction::IsOptimizable() { 6009 bool JSFunction::IsOptimizable() {
6028 return code()->kind() == Code::FUNCTION && code()->optimizable(); 6010 return code()->kind() == Code::FUNCTION && !shared()->optimization_disabled();
6029 } 6011 }
6030 6012
6031 6013
6032 bool JSFunction::IsMarkedForOptimization() { 6014 bool JSFunction::IsMarkedForOptimization() {
6033 return code() == GetIsolate()->builtins()->builtin( 6015 return code() == GetIsolate()->builtins()->builtin(
6034 Builtins::kCompileOptimized); 6016 Builtins::kCompileOptimized);
6035 } 6017 }
6036 6018
6037 6019
6038 bool JSFunction::IsMarkedForConcurrentOptimization() { 6020 bool JSFunction::IsMarkedForConcurrentOptimization() {
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
7633 #undef READ_SHORT_FIELD 7615 #undef READ_SHORT_FIELD
7634 #undef WRITE_SHORT_FIELD 7616 #undef WRITE_SHORT_FIELD
7635 #undef READ_BYTE_FIELD 7617 #undef READ_BYTE_FIELD
7636 #undef WRITE_BYTE_FIELD 7618 #undef WRITE_BYTE_FIELD
7637 #undef NOBARRIER_READ_BYTE_FIELD 7619 #undef NOBARRIER_READ_BYTE_FIELD
7638 #undef NOBARRIER_WRITE_BYTE_FIELD 7620 #undef NOBARRIER_WRITE_BYTE_FIELD
7639 7621
7640 } } // namespace v8::internal 7622 } } // namespace v8::internal
7641 7623
7642 #endif // V8_OBJECTS_INL_H_ 7624 #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