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 }; | 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 negative lookup check should be done on receiver object. | 22 // Defines whether negative lookup check should be done on receiver object. |
23 // Applicable to kForFields and kForConstants kinds only when loading value | 23 // Applicable to kForFields, kForConstants and kForNonExistent kinds only when |
24 // from prototype chain. Ignored when loading from holder. | 24 // loading value from prototype chain. Ignored when loading from holder. |
25 class DoNegativeLookupOnReceiverBits | 25 class DoNegativeLookupOnReceiverBits |
26 : public BitField<bool, KindBits::kNext, 1> {}; | 26 : public BitField<bool, KindBits::kNext, 1> {}; |
27 | 27 |
28 // | 28 // |
29 // Encoding when KindBits contains kForConstants. | 29 // Encoding when KindBits contains kForConstants. |
30 // | 30 // |
31 | 31 |
32 // +2 here is because each descriptor entry occupies 3 slots in array. | 32 // +2 here is because each descriptor entry occupies 3 slots in array. |
33 class DescriptorValueIndexBits | 33 class DescriptorValueIndexBits |
34 : public BitField<unsigned, DoNegativeLookupOnReceiverBits::kNext, | 34 : public BitField<unsigned, DoNegativeLookupOnReceiverBits::kNext, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 FieldIndex field_index); | 79 FieldIndex field_index); |
80 | 80 |
81 // Creates a Smi-handler for loading a constant from fast object. | 81 // Creates a Smi-handler for loading a constant from fast object. |
82 static inline Handle<Object> LoadConstant(Isolate* isolate, int descriptor); | 82 static inline Handle<Object> LoadConstant(Isolate* isolate, int descriptor); |
83 | 83 |
84 // Sets DoNegativeLookupOnReceiverBits in given Smi-handler. The receiver | 84 // Sets DoNegativeLookupOnReceiverBits in given Smi-handler. The receiver |
85 // check is a part of a prototype chain check. | 85 // check is a part of a prototype chain check. |
86 static inline Handle<Object> EnableNegativeLookupOnReceiver( | 86 static inline Handle<Object> EnableNegativeLookupOnReceiver( |
87 Isolate* isolate, Handle<Object> smi_handler); | 87 Isolate* isolate, Handle<Object> smi_handler); |
88 | 88 |
| 89 // Creates a Smi-handler for loading a non-existent property. Works only as |
| 90 // a part of prototype chain check. |
| 91 static inline Handle<Object> LoadNonExistent( |
| 92 Isolate* isolate, bool do_negative_lookup_on_receiver); |
| 93 |
89 // Creates a Smi-handler for loading an element. | 94 // Creates a Smi-handler for loading an element. |
90 static inline Handle<Object> LoadElement(Isolate* isolate, | 95 static inline Handle<Object> LoadElement(Isolate* isolate, |
91 ElementsKind elements_kind, | 96 ElementsKind elements_kind, |
92 bool convert_hole_to_undefined, | 97 bool convert_hole_to_undefined, |
93 bool is_js_array); | 98 bool is_js_array); |
94 }; | 99 }; |
95 | 100 |
96 // A set of bit fields representing Smi handlers for stores. | 101 // A set of bit fields representing Smi handlers for stores. |
97 class StoreHandler { | 102 class StoreHandler { |
98 public: | 103 public: |
(...skipping 22 matching lines...) Expand all Loading... |
121 // Creates a Smi-handler for storing a field to fast object. | 126 // Creates a Smi-handler for storing a field to fast object. |
122 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor, | 127 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor, |
123 FieldIndex field_index, | 128 FieldIndex field_index, |
124 Representation representation); | 129 Representation representation); |
125 }; | 130 }; |
126 | 131 |
127 } // namespace internal | 132 } // namespace internal |
128 } // namespace v8 | 133 } // namespace v8 |
129 | 134 |
130 #endif // V8_IC_HANDLER_CONFIGURATION_H_ | 135 #endif // V8_IC_HANDLER_CONFIGURATION_H_ |
OLD | NEW |