OLD | NEW |
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 4716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4727 ExtraICState Code::extra_ic_state() { | 4727 ExtraICState Code::extra_ic_state() { |
4728 DCHECK(is_inline_cache_stub() || ic_state() == DEBUG_STUB); | 4728 DCHECK(is_inline_cache_stub() || ic_state() == DEBUG_STUB); |
4729 return ExtractExtraICStateFromFlags(flags()); | 4729 return ExtractExtraICStateFromFlags(flags()); |
4730 } | 4730 } |
4731 | 4731 |
4732 | 4732 |
4733 Code::StubType Code::type() { | 4733 Code::StubType Code::type() { |
4734 return ExtractTypeFromFlags(flags()); | 4734 return ExtractTypeFromFlags(flags()); |
4735 } | 4735 } |
4736 | 4736 |
4737 | |
4738 // For initialization. | 4737 // For initialization. |
4739 void Code::set_raw_kind_specific_flags1(int value) { | 4738 void Code::set_raw_kind_specific_flags1(int value) { |
4740 WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value); | 4739 WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value); |
4741 } | 4740 } |
4742 | 4741 |
4743 | 4742 |
4744 void Code::set_raw_kind_specific_flags2(int value) { | 4743 void Code::set_raw_kind_specific_flags2(int value) { |
4745 WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value); | 4744 WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value); |
4746 } | 4745 } |
4747 | 4746 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5008 Address constant_pool = NULL; | 5007 Address constant_pool = NULL; |
5009 if (FLAG_enable_embedded_constant_pool) { | 5008 if (FLAG_enable_embedded_constant_pool) { |
5010 int offset = constant_pool_offset(); | 5009 int offset = constant_pool_offset(); |
5011 if (offset < instruction_size()) { | 5010 if (offset < instruction_size()) { |
5012 constant_pool = FIELD_ADDR(this, kHeaderSize + offset); | 5011 constant_pool = FIELD_ADDR(this, kHeaderSize + offset); |
5013 } | 5012 } |
5014 } | 5013 } |
5015 return constant_pool; | 5014 return constant_pool; |
5016 } | 5015 } |
5017 | 5016 |
5018 | |
5019 Code::Flags Code::ComputeFlags(Kind kind, InlineCacheState ic_state, | 5017 Code::Flags Code::ComputeFlags(Kind kind, InlineCacheState ic_state, |
5020 ExtraICState extra_ic_state, StubType type, | 5018 ExtraICState extra_ic_state, StubType type, |
5021 CacheHolderFlag holder) { | 5019 CacheHolderFlag holder) { |
5022 // Compute the bit mask. | 5020 // Compute the bit mask. |
5023 unsigned int bits = KindField::encode(kind) | 5021 unsigned int bits = KindField::encode(kind) | ICStateField::encode(ic_state) | |
5024 | ICStateField::encode(ic_state) | 5022 TypeField::encode(type) | |
5025 | TypeField::encode(type) | 5023 ExtraICStateField::encode(extra_ic_state) | |
5026 | ExtraICStateField::encode(extra_ic_state) | 5024 CacheHolderField::encode(holder); |
5027 | CacheHolderField::encode(holder); | |
5028 return static_cast<Flags>(bits); | 5025 return static_cast<Flags>(bits); |
5029 } | 5026 } |
5030 | 5027 |
5031 | |
5032 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 5028 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
5033 ExtraICState extra_ic_state, | 5029 ExtraICState extra_ic_state, |
5034 CacheHolderFlag holder, | 5030 CacheHolderFlag holder, |
5035 StubType type) { | 5031 StubType type) { |
5036 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, holder); | 5032 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, holder); |
5037 } | 5033 } |
5038 | 5034 |
5039 | 5035 |
5040 Code::Flags Code::ComputeHandlerFlags(Kind handler_kind, StubType type, | 5036 Code::Flags Code::ComputeHandlerFlags(Kind handler_kind, StubType type, |
5041 CacheHolderFlag holder) { | 5037 CacheHolderFlag holder) { |
(...skipping 13 matching lines...) Expand all Loading... |
5055 | 5051 |
5056 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { | 5052 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { |
5057 return ExtraICStateField::decode(flags); | 5053 return ExtraICStateField::decode(flags); |
5058 } | 5054 } |
5059 | 5055 |
5060 | 5056 |
5061 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { | 5057 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { |
5062 return TypeField::decode(flags); | 5058 return TypeField::decode(flags); |
5063 } | 5059 } |
5064 | 5060 |
5065 | |
5066 CacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { | 5061 CacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { |
5067 return CacheHolderField::decode(flags); | 5062 return CacheHolderField::decode(flags); |
5068 } | 5063 } |
5069 | 5064 |
5070 | 5065 |
5071 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { | 5066 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { |
5072 int bits = flags & ~TypeField::kMask; | 5067 int bits = flags & ~TypeField::kMask; |
5073 return static_cast<Flags>(bits); | 5068 return static_cast<Flags>(bits); |
5074 } | 5069 } |
5075 | 5070 |
(...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7750 #undef WRITE_INT64_FIELD | 7745 #undef WRITE_INT64_FIELD |
7751 #undef READ_BYTE_FIELD | 7746 #undef READ_BYTE_FIELD |
7752 #undef WRITE_BYTE_FIELD | 7747 #undef WRITE_BYTE_FIELD |
7753 #undef NOBARRIER_READ_BYTE_FIELD | 7748 #undef NOBARRIER_READ_BYTE_FIELD |
7754 #undef NOBARRIER_WRITE_BYTE_FIELD | 7749 #undef NOBARRIER_WRITE_BYTE_FIELD |
7755 | 7750 |
7756 } // namespace internal | 7751 } // namespace internal |
7757 } // namespace v8 | 7752 } // namespace v8 |
7758 | 7753 |
7759 #endif // V8_OBJECTS_INL_H_ | 7754 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |