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 22 matching lines...) Expand all Loading... |
33 ElementsKind elements_kind, | 33 ElementsKind elements_kind, |
34 bool convert_hole_to_undefined, | 34 bool convert_hole_to_undefined, |
35 bool is_js_array) { | 35 bool is_js_array) { |
36 int config = KindBits::encode(kForElements) | | 36 int config = KindBits::encode(kForElements) | |
37 ElementsKindBits::encode(elements_kind) | | 37 ElementsKindBits::encode(elements_kind) | |
38 ConvertHoleBits::encode(convert_hole_to_undefined) | | 38 ConvertHoleBits::encode(convert_hole_to_undefined) | |
39 IsJsArrayBits::encode(is_js_array); | 39 IsJsArrayBits::encode(is_js_array); |
40 return handle(Smi::FromInt(config), isolate); | 40 return handle(Smi::FromInt(config), isolate); |
41 } | 41 } |
42 | 42 |
| 43 Handle<Object> StoreHandler::StoreField(Isolate* isolate, int descriptor, |
| 44 FieldIndex field_index, |
| 45 Representation representation) { |
| 46 StoreHandler::FieldRepresentation field_rep; |
| 47 switch (representation.kind()) { |
| 48 case Representation::kSmi: |
| 49 field_rep = StoreHandler::kSmi; |
| 50 break; |
| 51 case Representation::kDouble: |
| 52 field_rep = StoreHandler::kDouble; |
| 53 break; |
| 54 case Representation::kHeapObject: |
| 55 field_rep = StoreHandler::kHeapObject; |
| 56 break; |
| 57 case Representation::kTagged: |
| 58 field_rep = StoreHandler::kTagged; |
| 59 break; |
| 60 default: |
| 61 UNREACHABLE(); |
| 62 return Handle<Object>::null(); |
| 63 } |
| 64 int value_index = DescriptorArray::ToValueIndex(descriptor); |
| 65 |
| 66 int config = StoreHandler::KindBits::encode(StoreHandler::kForFields) | |
| 67 StoreHandler::IsInobjectBits::encode(field_index.is_inobject()) | |
| 68 StoreHandler::FieldRepresentationBits::encode(field_rep) | |
| 69 StoreHandler::DescriptorValueIndexBits::encode(value_index) | |
| 70 StoreHandler::FieldOffsetBits::encode(field_index.offset()); |
| 71 return handle(Smi::FromInt(config), isolate); |
| 72 } |
| 73 |
43 } // namespace internal | 74 } // namespace internal |
44 } // namespace v8 | 75 } // namespace v8 |
45 | 76 |
46 #endif // V8_IC_HANDLER_CONFIGURATION_INL_H_ | 77 #endif // V8_IC_HANDLER_CONFIGURATION_INL_H_ |
OLD | NEW |