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 Code::WasmFunctionType Code::wasm_function_type() { |
| 4738 return ExtractWasmFunctionTypeFromFlags(flags()); |
| 4739 } |
4737 | 4740 |
4738 // For initialization. | 4741 // For initialization. |
4739 void Code::set_raw_kind_specific_flags1(int value) { | 4742 void Code::set_raw_kind_specific_flags1(int value) { |
4740 WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value); | 4743 WRITE_INT_FIELD(this, kKindSpecificFlags1Offset, value); |
4741 } | 4744 } |
4742 | 4745 |
4743 | 4746 |
4744 void Code::set_raw_kind_specific_flags2(int value) { | 4747 void Code::set_raw_kind_specific_flags2(int value) { |
4745 WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value); | 4748 WRITE_INT_FIELD(this, kKindSpecificFlags2Offset, value); |
4746 } | 4749 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5008 Address constant_pool = NULL; | 5011 Address constant_pool = NULL; |
5009 if (FLAG_enable_embedded_constant_pool) { | 5012 if (FLAG_enable_embedded_constant_pool) { |
5010 int offset = constant_pool_offset(); | 5013 int offset = constant_pool_offset(); |
5011 if (offset < instruction_size()) { | 5014 if (offset < instruction_size()) { |
5012 constant_pool = FIELD_ADDR(this, kHeaderSize + offset); | 5015 constant_pool = FIELD_ADDR(this, kHeaderSize + offset); |
5013 } | 5016 } |
5014 } | 5017 } |
5015 return constant_pool; | 5018 return constant_pool; |
5016 } | 5019 } |
5017 | 5020 |
5018 | |
5019 Code::Flags Code::ComputeFlags(Kind kind, InlineCacheState ic_state, | 5021 Code::Flags Code::ComputeFlags(Kind kind, InlineCacheState ic_state, |
5020 ExtraICState extra_ic_state, StubType type, | 5022 ExtraICState extra_ic_state, StubType type, |
5021 CacheHolderFlag holder) { | 5023 CacheHolderFlag holder, |
| 5024 WasmFunctionType wasm_type) { |
5022 // Compute the bit mask. | 5025 // Compute the bit mask. |
5023 unsigned int bits = KindField::encode(kind) | 5026 unsigned int bits = KindField::encode(kind) | ICStateField::encode(ic_state) | |
5024 | ICStateField::encode(ic_state) | 5027 TypeField::encode(type) | |
5025 | TypeField::encode(type) | 5028 ExtraICStateField::encode(extra_ic_state) | |
5026 | ExtraICStateField::encode(extra_ic_state) | 5029 WasmFunctionTypeField::encode(wasm_type) | |
5027 | CacheHolderField::encode(holder); | 5030 CacheHolderField::encode(holder); |
5028 return static_cast<Flags>(bits); | 5031 return static_cast<Flags>(bits); |
5029 } | 5032 } |
5030 | 5033 |
| 5034 Code::Flags Code::ComputeWasmFlags(Kind kind, WasmFunctionType wasm_type) { |
| 5035 return ComputeFlags(kind, UNINITIALIZED, kNoExtraICState, NORMAL, |
| 5036 kCacheOnReceiver, wasm_type); |
| 5037 } |
5031 | 5038 |
5032 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 5039 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
5033 ExtraICState extra_ic_state, | 5040 ExtraICState extra_ic_state, |
5034 CacheHolderFlag holder, | 5041 CacheHolderFlag holder, |
5035 StubType type) { | 5042 StubType type) { |
5036 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, holder); | 5043 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, holder); |
5037 } | 5044 } |
5038 | 5045 |
5039 | 5046 |
5040 Code::Flags Code::ComputeHandlerFlags(Kind handler_kind, StubType type, | 5047 Code::Flags Code::ComputeHandlerFlags(Kind handler_kind, StubType type, |
(...skipping 14 matching lines...) Expand all Loading... |
5055 | 5062 |
5056 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { | 5063 ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) { |
5057 return ExtraICStateField::decode(flags); | 5064 return ExtraICStateField::decode(flags); |
5058 } | 5065 } |
5059 | 5066 |
5060 | 5067 |
5061 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { | 5068 Code::StubType Code::ExtractTypeFromFlags(Flags flags) { |
5062 return TypeField::decode(flags); | 5069 return TypeField::decode(flags); |
5063 } | 5070 } |
5064 | 5071 |
| 5072 Code::WasmFunctionType Code::ExtractWasmFunctionTypeFromFlags(Flags flags) { |
| 5073 return WasmFunctionTypeField::decode(flags); |
| 5074 } |
5065 | 5075 |
5066 CacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { | 5076 CacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) { |
5067 return CacheHolderField::decode(flags); | 5077 return CacheHolderField::decode(flags); |
5068 } | 5078 } |
5069 | 5079 |
5070 | 5080 |
5071 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { | 5081 Code::Flags Code::RemoveTypeFromFlags(Flags flags) { |
5072 int bits = flags & ~TypeField::kMask; | 5082 int bits = flags & ~TypeField::kMask; |
5073 return static_cast<Flags>(bits); | 5083 return static_cast<Flags>(bits); |
5074 } | 5084 } |
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7750 #undef WRITE_INT64_FIELD | 7760 #undef WRITE_INT64_FIELD |
7751 #undef READ_BYTE_FIELD | 7761 #undef READ_BYTE_FIELD |
7752 #undef WRITE_BYTE_FIELD | 7762 #undef WRITE_BYTE_FIELD |
7753 #undef NOBARRIER_READ_BYTE_FIELD | 7763 #undef NOBARRIER_READ_BYTE_FIELD |
7754 #undef NOBARRIER_WRITE_BYTE_FIELD | 7764 #undef NOBARRIER_WRITE_BYTE_FIELD |
7755 | 7765 |
7756 } // namespace internal | 7766 } // namespace internal |
7757 } // namespace v8 | 7767 } // namespace v8 |
7758 | 7768 |
7759 #endif // V8_OBJECTS_INL_H_ | 7769 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |