| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef V8_IC_HANDLER_CONFIGURATION_INL_H_ | 5 #ifndef V8_IC_HANDLER_CONFIGURATION_INL_H_ |
| 6 #define V8_IC_HANDLER_CONFIGURATION_INL_H_ | 6 #define V8_IC_HANDLER_CONFIGURATION_INL_H_ |
| 7 | 7 |
| 8 #include "src/ic/handler-configuration.h" | 8 #include "src/ic/handler-configuration.h" |
| 9 | 9 |
| 10 #include "src/field-index-inl.h" | 10 #include "src/field-index-inl.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 break; | 96 break; |
| 97 case Representation::kTagged: | 97 case Representation::kTagged: |
| 98 field_rep = StoreHandler::kTagged; | 98 field_rep = StoreHandler::kTagged; |
| 99 break; | 99 break; |
| 100 default: | 100 default: |
| 101 UNREACHABLE(); | 101 UNREACHABLE(); |
| 102 return Handle<Object>::null(); | 102 return Handle<Object>::null(); |
| 103 } | 103 } |
| 104 int value_index = DescriptorArray::ToValueIndex(descriptor); | 104 int value_index = DescriptorArray::ToValueIndex(descriptor); |
| 105 | 105 |
| 106 DCHECK(kind == kStoreField || kind == kTransitionToField); | 106 DCHECK(kind == kStoreField || kind == kTransitionToField || |
| 107 (kind == kStoreConstField && FLAG_track_constant_fields)); |
| 107 DCHECK_IMPLIES(extend_storage, kind == kTransitionToField); | 108 DCHECK_IMPLIES(extend_storage, kind == kTransitionToField); |
| 108 DCHECK_IMPLIES(field_index.is_inobject(), !extend_storage); | 109 DCHECK_IMPLIES(field_index.is_inobject(), !extend_storage); |
| 109 | 110 |
| 110 int config = StoreHandler::KindBits::encode(kind) | | 111 int config = StoreHandler::KindBits::encode(kind) | |
| 111 StoreHandler::ExtendStorageBits::encode(extend_storage) | | 112 StoreHandler::ExtendStorageBits::encode(extend_storage) | |
| 112 StoreHandler::IsInobjectBits::encode(field_index.is_inobject()) | | 113 StoreHandler::IsInobjectBits::encode(field_index.is_inobject()) | |
| 113 StoreHandler::FieldRepresentationBits::encode(field_rep) | | 114 StoreHandler::FieldRepresentationBits::encode(field_rep) | |
| 114 StoreHandler::DescriptorValueIndexBits::encode(value_index) | | 115 StoreHandler::DescriptorValueIndexBits::encode(value_index) | |
| 115 StoreHandler::FieldOffsetBits::encode(field_index.offset()); | 116 StoreHandler::FieldOffsetBits::encode(field_index.offset()); |
| 116 return handle(Smi::FromInt(config), isolate); | 117 return handle(Smi::FromInt(config), isolate); |
| 117 } | 118 } |
| 118 | 119 |
| 119 Handle<Object> StoreHandler::StoreField(Isolate* isolate, int descriptor, | 120 Handle<Object> StoreHandler::StoreField(Isolate* isolate, int descriptor, |
| 120 FieldIndex field_index, | 121 FieldIndex field_index, |
| 122 PropertyConstness constness, |
| 121 Representation representation) { | 123 Representation representation) { |
| 122 return StoreField(isolate, kStoreField, descriptor, field_index, | 124 DCHECK_IMPLIES(!FLAG_track_constant_fields, constness == kMutable); |
| 123 representation, false); | 125 Kind kind = constness == kMutable ? kStoreField : kStoreConstField; |
| 126 return StoreField(isolate, kind, descriptor, field_index, representation, |
| 127 false); |
| 124 } | 128 } |
| 125 | 129 |
| 126 Handle<Object> StoreHandler::TransitionToField(Isolate* isolate, int descriptor, | 130 Handle<Object> StoreHandler::TransitionToField(Isolate* isolate, int descriptor, |
| 127 FieldIndex field_index, | 131 FieldIndex field_index, |
| 128 Representation representation, | 132 Representation representation, |
| 129 bool extend_storage) { | 133 bool extend_storage) { |
| 130 return StoreField(isolate, kTransitionToField, descriptor, field_index, | 134 return StoreField(isolate, kTransitionToField, descriptor, field_index, |
| 131 representation, extend_storage); | 135 representation, extend_storage); |
| 132 } | 136 } |
| 133 | 137 |
| 134 Handle<Object> StoreHandler::TransitionToConstant(Isolate* isolate, | 138 Handle<Object> StoreHandler::TransitionToConstant(Isolate* isolate, |
| 135 int descriptor) { | 139 int descriptor) { |
| 140 DCHECK(!FLAG_track_constant_fields); |
| 136 int value_index = DescriptorArray::ToValueIndex(descriptor); | 141 int value_index = DescriptorArray::ToValueIndex(descriptor); |
| 137 int config = | 142 int config = |
| 138 StoreHandler::KindBits::encode(StoreHandler::kTransitionToConstant) | | 143 StoreHandler::KindBits::encode(StoreHandler::kTransitionToConstant) | |
| 139 StoreHandler::DescriptorValueIndexBits::encode(value_index); | 144 StoreHandler::DescriptorValueIndexBits::encode(value_index); |
| 140 return handle(Smi::FromInt(config), isolate); | 145 return handle(Smi::FromInt(config), isolate); |
| 141 } | 146 } |
| 142 | 147 |
| 143 } // namespace internal | 148 } // namespace internal |
| 144 } // namespace v8 | 149 } // namespace v8 |
| 145 | 150 |
| 146 #endif // V8_IC_HANDLER_CONFIGURATION_INL_H_ | 151 #endif // V8_IC_HANDLER_CONFIGURATION_INL_H_ |
| OLD | NEW |