| 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" |
| 11 #include "src/utils.h" | 11 #include "src/utils.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 // A set of bit fields representing Smi handlers for loads. | 16 // A set of bit fields representing Smi handlers for loads. |
| 17 class LoadHandler { | 17 class LoadHandler { |
| 18 public: | 18 public: |
| 19 enum Kind { kForElements, kForFields, kForConstants, kForNonExistent }; | 19 enum Kind { kForElements, kForFields, kForConstants, kForNonExistent }; |
| 20 class KindBits : public BitField<Kind, 0, 2> {}; | 20 class KindBits : public BitField<Kind, 0, 2> {}; |
| 21 | 21 |
| 22 // Defines whether access rights check should be done on receiver object. |
| 23 // Applicable to kForFields, kForConstants and kForNonExistent kinds only when |
| 24 // loading value from prototype chain. Ignored when loading from holder. |
| 25 class DoAccessCheckOnReceiverBits |
| 26 : public BitField<bool, KindBits::kNext, 1> {}; |
| 27 |
| 22 // Defines whether negative lookup check should be done on receiver object. | 28 // Defines whether negative lookup check should be done on receiver object. |
| 23 // Applicable to kForFields, kForConstants and kForNonExistent kinds only when | 29 // Applicable to kForFields, kForConstants and kForNonExistent kinds only when |
| 24 // loading value from prototype chain. Ignored when loading from holder. | 30 // loading value from prototype chain. Ignored when loading from holder. |
| 25 class DoNegativeLookupOnReceiverBits | 31 class DoNegativeLookupOnReceiverBits |
| 26 : public BitField<bool, KindBits::kNext, 1> {}; | 32 : public BitField<bool, DoAccessCheckOnReceiverBits::kNext, 1> {}; |
| 27 | 33 |
| 28 // | 34 // |
| 29 // Encoding when KindBits contains kForConstants. | 35 // Encoding when KindBits contains kForConstants. |
| 30 // | 36 // |
| 31 | 37 |
| 32 // +2 here is because each descriptor entry occupies 3 slots in array. | 38 // +2 here is because each descriptor entry occupies 3 slots in array. |
| 33 class DescriptorValueIndexBits | 39 class DescriptorValueIndexBits |
| 34 : public BitField<unsigned, DoNegativeLookupOnReceiverBits::kNext, | 40 : public BitField<unsigned, DoNegativeLookupOnReceiverBits::kNext, |
| 35 kDescriptorIndexBitCount + 2> {}; | 41 kDescriptorIndexBitCount + 2> {}; |
| 36 // Make sure we don't overflow the smi. | 42 // Make sure we don't overflow the smi. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 static const int kHolderCellIndex = 2; | 80 static const int kHolderCellIndex = 2; |
| 75 static const int kFirstPrototypeIndex = 3; | 81 static const int kFirstPrototypeIndex = 3; |
| 76 | 82 |
| 77 // Creates a Smi-handler for loading a field from fast object. | 83 // Creates a Smi-handler for loading a field from fast object. |
| 78 static inline Handle<Object> LoadField(Isolate* isolate, | 84 static inline Handle<Object> LoadField(Isolate* isolate, |
| 79 FieldIndex field_index); | 85 FieldIndex field_index); |
| 80 | 86 |
| 81 // Creates a Smi-handler for loading a constant from fast object. | 87 // Creates a Smi-handler for loading a constant from fast object. |
| 82 static inline Handle<Object> LoadConstant(Isolate* isolate, int descriptor); | 88 static inline Handle<Object> LoadConstant(Isolate* isolate, int descriptor); |
| 83 | 89 |
| 90 // Sets DoAccessCheckOnReceiverBits in given Smi-handler. The receiver |
| 91 // check is a part of a prototype chain check. |
| 92 static inline Handle<Object> EnableAccessCheckOnReceiver( |
| 93 Isolate* isolate, Handle<Object> smi_handler); |
| 94 |
| 84 // Sets DoNegativeLookupOnReceiverBits in given Smi-handler. The receiver | 95 // Sets DoNegativeLookupOnReceiverBits in given Smi-handler. The receiver |
| 85 // check is a part of a prototype chain check. | 96 // check is a part of a prototype chain check. |
| 86 static inline Handle<Object> EnableNegativeLookupOnReceiver( | 97 static inline Handle<Object> EnableNegativeLookupOnReceiver( |
| 87 Isolate* isolate, Handle<Object> smi_handler); | 98 Isolate* isolate, Handle<Object> smi_handler); |
| 88 | 99 |
| 89 // Creates a Smi-handler for loading a non-existent property. Works only as | 100 // Creates a Smi-handler for loading a non-existent property. Works only as |
| 90 // a part of prototype chain check. | 101 // a part of prototype chain check. |
| 91 static inline Handle<Object> LoadNonExistent( | 102 static inline Handle<Object> LoadNonExistent( |
| 92 Isolate* isolate, bool do_negative_lookup_on_receiver); | 103 Isolate* isolate, bool do_negative_lookup_on_receiver); |
| 93 | 104 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // Creates a Smi-handler for storing a field to fast object. | 137 // Creates a Smi-handler for storing a field to fast object. |
| 127 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor, | 138 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor, |
| 128 FieldIndex field_index, | 139 FieldIndex field_index, |
| 129 Representation representation); | 140 Representation representation); |
| 130 }; | 141 }; |
| 131 | 142 |
| 132 } // namespace internal | 143 } // namespace internal |
| 133 } // namespace v8 | 144 } // namespace v8 |
| 134 | 145 |
| 135 #endif // V8_IC_HANDLER_CONFIGURATION_H_ | 146 #endif // V8_IC_HANDLER_CONFIGURATION_H_ |
| OLD | NEW |