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_H_ | 5 #ifndef V8_IC_HANDLER_CONFIGURATION_H_ |
6 #define V8_IC_HANDLER_CONFIGURATION_H_ | 6 #define V8_IC_HANDLER_CONFIGURATION_H_ |
7 | 7 |
8 #include "src/elements-kind.h" | 8 #include "src/elements-kind.h" |
9 #include "src/field-index.h" | 9 #include "src/field-index.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Creates a Smi-handler for loading a constant from fast object. | 59 // Creates a Smi-handler for loading a constant from fast object. |
60 static inline Handle<Object> LoadConstant(Isolate* isolate, int descriptor); | 60 static inline Handle<Object> LoadConstant(Isolate* isolate, int descriptor); |
61 | 61 |
62 // Creates a Smi-handler for loading an element. | 62 // Creates a Smi-handler for loading an element. |
63 static inline Handle<Object> LoadElement(Isolate* isolate, | 63 static inline Handle<Object> LoadElement(Isolate* isolate, |
64 ElementsKind elements_kind, | 64 ElementsKind elements_kind, |
65 bool convert_hole_to_undefined, | 65 bool convert_hole_to_undefined, |
66 bool is_js_array); | 66 bool is_js_array); |
67 }; | 67 }; |
68 | 68 |
| 69 // A set of bit fields representing Smi handlers for stores. |
| 70 class StoreHandler { |
| 71 public: |
| 72 enum Kind { kForElements, kForFields }; |
| 73 class KindBits : public BitField<Kind, 0, 1> {}; |
| 74 |
| 75 enum FieldRepresentation { kSmi, kDouble, kHeapObject, kTagged }; |
| 76 |
| 77 // |
| 78 // Encoding when KindBits contains kForFields. |
| 79 // |
| 80 class IsInobjectBits : public BitField<bool, KindBits::kNext, 1> {}; |
| 81 class FieldRepresentationBits |
| 82 : public BitField<FieldRepresentation, IsInobjectBits::kNext, 2> {}; |
| 83 // +2 here is because each descriptor entry occupies 3 slots in array. |
| 84 class DescriptorValueIndexBits |
| 85 : public BitField<unsigned, FieldRepresentationBits::kNext, |
| 86 kDescriptorIndexBitCount + 2> {}; |
| 87 // +1 here is to cover all possible JSObject header sizes. |
| 88 class FieldOffsetBits |
| 89 : public BitField<unsigned, DescriptorValueIndexBits::kNext, |
| 90 kDescriptorIndexBitCount + 1 + kPointerSizeLog2> {}; |
| 91 // Make sure we don't overflow the smi. |
| 92 STATIC_ASSERT(FieldOffsetBits::kNext <= kSmiValueSize); |
| 93 |
| 94 // Creates a Smi-handler for storing a field to fast object. |
| 95 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor, |
| 96 FieldIndex field_index, |
| 97 Representation representation); |
| 98 }; |
| 99 |
69 } // namespace internal | 100 } // namespace internal |
70 } // namespace v8 | 101 } // namespace v8 |
71 | 102 |
72 #endif // V8_IC_HANDLER_CONFIGURATION_H_ | 103 #endif // V8_IC_HANDLER_CONFIGURATION_H_ |
OLD | NEW |