Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/ic/handler-configuration.h

Issue 2446983002: [ic] Support negative lookup on receiver in data handlers. (Closed)
Patch Set: Addressing comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-stub-assembler.cc ('k') | src/ic/handler-configuration-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 };
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.
23 // Applicable to kForFields and kForConstants kinds only when loading value
24 // from prototype chain. Ignored when loading from holder.
25 class DoNegativeLookupOnReceiverBits
26 : public BitField<bool, KindBits::kNext, 1> {};
27
22 // 28 //
23 // Encoding when KindBits contains kForConstants. 29 // Encoding when KindBits contains kForConstants.
24 // 30 //
25 31
26 // +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.
27 class DescriptorValueIndexBits 33 class DescriptorValueIndexBits
28 : public BitField<unsigned, KindBits::kNext, 34 : public BitField<unsigned, DoNegativeLookupOnReceiverBits::kNext,
29 kDescriptorIndexBitCount + 2> {}; 35 kDescriptorIndexBitCount + 2> {};
30 // Make sure we don't overflow the smi. 36 // Make sure we don't overflow the smi.
31 STATIC_ASSERT(DescriptorValueIndexBits::kNext <= kSmiValueSize); 37 STATIC_ASSERT(DescriptorValueIndexBits::kNext <= kSmiValueSize);
32 38
33 // 39 //
34 // Encoding when KindBits contains kForFields. 40 // Encoding when KindBits contains kForFields.
35 // 41 //
36 class IsInobjectBits : public BitField<bool, KindBits::kNext, 1> {}; 42 class IsInobjectBits
43 : public BitField<bool, DoNegativeLookupOnReceiverBits::kNext, 1> {};
37 class IsDoubleBits : public BitField<bool, IsInobjectBits::kNext, 1> {}; 44 class IsDoubleBits : public BitField<bool, IsInobjectBits::kNext, 1> {};
38 // +1 here is to cover all possible JSObject header sizes. 45 // +1 here is to cover all possible JSObject header sizes.
39 class FieldOffsetBits 46 class FieldOffsetBits
40 : public BitField<unsigned, IsDoubleBits::kNext, 47 : public BitField<unsigned, IsDoubleBits::kNext,
41 kDescriptorIndexBitCount + 1 + kPointerSizeLog2> {}; 48 kDescriptorIndexBitCount + 1 + kPointerSizeLog2> {};
42 // Make sure we don't overflow the smi. 49 // Make sure we don't overflow the smi.
43 STATIC_ASSERT(FieldOffsetBits::kNext <= kSmiValueSize); 50 STATIC_ASSERT(FieldOffsetBits::kNext <= kSmiValueSize);
44 51
45 // 52 //
46 // Encoding when KindBits contains kForElements. 53 // Encoding when KindBits contains kForElements.
47 // 54 //
48 class IsJsArrayBits : public BitField<bool, KindBits::kNext, 1> {}; 55 class IsJsArrayBits : public BitField<bool, KindBits::kNext, 1> {};
49 class ConvertHoleBits : public BitField<bool, IsJsArrayBits::kNext, 1> {}; 56 class ConvertHoleBits : public BitField<bool, IsJsArrayBits::kNext, 1> {};
50 class ElementsKindBits 57 class ElementsKindBits
51 : public BitField<ElementsKind, ConvertHoleBits::kNext, 8> {}; 58 : public BitField<ElementsKind, ConvertHoleBits::kNext, 8> {};
52 // Make sure we don't overflow the smi. 59 // Make sure we don't overflow the smi.
53 STATIC_ASSERT(ElementsKindBits::kNext <= kSmiValueSize); 60 STATIC_ASSERT(ElementsKindBits::kNext <= kSmiValueSize);
54 61
55 // Creates a Smi-handler for loading a field from fast object. 62 // Creates a Smi-handler for loading a field from fast object.
56 static inline Handle<Object> LoadField(Isolate* isolate, 63 static inline Handle<Object> LoadField(Isolate* isolate,
57 FieldIndex field_index); 64 FieldIndex field_index);
58 65
59 // Creates a Smi-handler for loading a constant from fast object. 66 // Creates a Smi-handler for loading a constant from fast object.
60 static inline Handle<Object> LoadConstant(Isolate* isolate, int descriptor); 67 static inline Handle<Object> LoadConstant(Isolate* isolate, int descriptor);
61 68
69 // Sets DoNegativeLookupOnReceiverBits in given Smi-handler. The receiver
70 // check is a part of a prototype chain check.
71 static inline Handle<Object> EnableNegativeLookupOnReceiver(
72 Isolate* isolate, Handle<Object> smi_handler);
73
62 // Creates a Smi-handler for loading an element. 74 // Creates a Smi-handler for loading an element.
63 static inline Handle<Object> LoadElement(Isolate* isolate, 75 static inline Handle<Object> LoadElement(Isolate* isolate,
64 ElementsKind elements_kind, 76 ElementsKind elements_kind,
65 bool convert_hole_to_undefined, 77 bool convert_hole_to_undefined,
66 bool is_js_array); 78 bool is_js_array);
67 }; 79 };
68 80
69 // A set of bit fields representing Smi handlers for stores. 81 // A set of bit fields representing Smi handlers for stores.
70 class StoreHandler { 82 class StoreHandler {
71 public: 83 public:
(...skipping 22 matching lines...) Expand all
94 // Creates a Smi-handler for storing a field to fast object. 106 // Creates a Smi-handler for storing a field to fast object.
95 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor, 107 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor,
96 FieldIndex field_index, 108 FieldIndex field_index,
97 Representation representation); 109 Representation representation);
98 }; 110 };
99 111
100 } // namespace internal 112 } // namespace internal
101 } // namespace v8 113 } // namespace v8
102 114
103 #endif // V8_IC_HANDLER_CONFIGURATION_H_ 115 #endif // V8_IC_HANDLER_CONFIGURATION_H_
OLDNEW
« no previous file with comments | « src/code-stub-assembler.cc ('k') | src/ic/handler-configuration-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698