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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 ElementsKind elements_kind, | 52 ElementsKind elements_kind, |
53 bool convert_hole_to_undefined, | 53 bool convert_hole_to_undefined, |
54 bool is_js_array) { | 54 bool is_js_array) { |
55 int config = KindBits::encode(kForElements) | | 55 int config = KindBits::encode(kForElements) | |
56 ElementsKindBits::encode(elements_kind) | | 56 ElementsKindBits::encode(elements_kind) | |
57 ConvertHoleBits::encode(convert_hole_to_undefined) | | 57 ConvertHoleBits::encode(convert_hole_to_undefined) | |
58 IsJsArrayBits::encode(is_js_array); | 58 IsJsArrayBits::encode(is_js_array); |
59 return handle(Smi::FromInt(config), isolate); | 59 return handle(Smi::FromInt(config), isolate); |
60 } | 60 } |
61 | 61 |
62 Handle<Object> StoreHandler::StoreField(Isolate* isolate, int descriptor, | 62 Handle<Object> StoreHandler::StoreField(Isolate* isolate, Kind kind, |
63 FieldIndex field_index, | 63 int descriptor, FieldIndex field_index, |
64 Representation representation) { | 64 Representation representation, |
| 65 bool extend_storage) { |
65 StoreHandler::FieldRepresentation field_rep; | 66 StoreHandler::FieldRepresentation field_rep; |
66 switch (representation.kind()) { | 67 switch (representation.kind()) { |
67 case Representation::kSmi: | 68 case Representation::kSmi: |
68 field_rep = StoreHandler::kSmi; | 69 field_rep = StoreHandler::kSmi; |
69 break; | 70 break; |
70 case Representation::kDouble: | 71 case Representation::kDouble: |
71 field_rep = StoreHandler::kDouble; | 72 field_rep = StoreHandler::kDouble; |
72 break; | 73 break; |
73 case Representation::kHeapObject: | 74 case Representation::kHeapObject: |
74 field_rep = StoreHandler::kHeapObject; | 75 field_rep = StoreHandler::kHeapObject; |
75 break; | 76 break; |
76 case Representation::kTagged: | 77 case Representation::kTagged: |
77 field_rep = StoreHandler::kTagged; | 78 field_rep = StoreHandler::kTagged; |
78 break; | 79 break; |
79 default: | 80 default: |
80 UNREACHABLE(); | 81 UNREACHABLE(); |
81 return Handle<Object>::null(); | 82 return Handle<Object>::null(); |
82 } | 83 } |
83 int value_index = DescriptorArray::ToValueIndex(descriptor); | 84 int value_index = DescriptorArray::ToValueIndex(descriptor); |
84 | 85 |
85 int config = StoreHandler::KindBits::encode(StoreHandler::kForFields) | | 86 DCHECK(kind == kStoreField || kind == kTransitionToField); |
| 87 DCHECK_IMPLIES(kind == kStoreField, !extend_storage); |
| 88 |
| 89 int config = StoreHandler::KindBits::encode(kind) | |
| 90 StoreHandler::ExtendStorageBits::encode(extend_storage) | |
86 StoreHandler::IsInobjectBits::encode(field_index.is_inobject()) | | 91 StoreHandler::IsInobjectBits::encode(field_index.is_inobject()) | |
87 StoreHandler::FieldRepresentationBits::encode(field_rep) | | 92 StoreHandler::FieldRepresentationBits::encode(field_rep) | |
88 StoreHandler::DescriptorValueIndexBits::encode(value_index) | | 93 StoreHandler::DescriptorValueIndexBits::encode(value_index) | |
89 StoreHandler::FieldOffsetBits::encode(field_index.offset()); | 94 StoreHandler::FieldOffsetBits::encode(field_index.offset()); |
90 return handle(Smi::FromInt(config), isolate); | 95 return handle(Smi::FromInt(config), isolate); |
91 } | 96 } |
92 | 97 |
| 98 Handle<Object> StoreHandler::StoreField(Isolate* isolate, int descriptor, |
| 99 FieldIndex field_index, |
| 100 Representation representation) { |
| 101 return StoreField(isolate, kStoreField, descriptor, field_index, |
| 102 representation, false); |
| 103 } |
| 104 |
| 105 Handle<Object> StoreHandler::TransitionToField(Isolate* isolate, int descriptor, |
| 106 FieldIndex field_index, |
| 107 Representation representation, |
| 108 bool extend_storage) { |
| 109 return StoreField(isolate, kTransitionToField, descriptor, field_index, |
| 110 representation, extend_storage); |
| 111 } |
| 112 |
| 113 Handle<Object> StoreHandler::TransitionToConstant(Isolate* isolate, |
| 114 int descriptor) { |
| 115 int value_index = DescriptorArray::ToValueIndex(descriptor); |
| 116 int config = |
| 117 StoreHandler::KindBits::encode(StoreHandler::kTransitionToConstant) | |
| 118 StoreHandler::DescriptorValueIndexBits::encode(value_index); |
| 119 return handle(Smi::FromInt(config), isolate); |
| 120 } |
| 121 |
93 } // namespace internal | 122 } // namespace internal |
94 } // namespace v8 | 123 } // namespace v8 |
95 | 124 |
96 #endif // V8_IC_HANDLER_CONFIGURATION_INL_H_ | 125 #endif // V8_IC_HANDLER_CONFIGURATION_INL_H_ |
OLD | NEW |