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

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

Issue 2488673004: [ic] Support data handlers that represent transitioning stores. (Closed)
Patch Set: Rebasing again 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/ic/handler-configuration.h ('k') | src/ic/ic.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_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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ElementsKind elements_kind, 72 ElementsKind elements_kind,
73 bool convert_hole_to_undefined, 73 bool convert_hole_to_undefined,
74 bool is_js_array) { 74 bool is_js_array) {
75 int config = KindBits::encode(kForElements) | 75 int config = KindBits::encode(kForElements) |
76 ElementsKindBits::encode(elements_kind) | 76 ElementsKindBits::encode(elements_kind) |
77 ConvertHoleBits::encode(convert_hole_to_undefined) | 77 ConvertHoleBits::encode(convert_hole_to_undefined) |
78 IsJsArrayBits::encode(is_js_array); 78 IsJsArrayBits::encode(is_js_array);
79 return handle(Smi::FromInt(config), isolate); 79 return handle(Smi::FromInt(config), isolate);
80 } 80 }
81 81
82 Handle<Object> StoreHandler::StoreField(Isolate* isolate, int descriptor, 82 Handle<Object> StoreHandler::StoreField(Isolate* isolate, Kind kind,
83 FieldIndex field_index, 83 int descriptor, FieldIndex field_index,
84 Representation representation) { 84 Representation representation,
85 bool extend_storage) {
85 StoreHandler::FieldRepresentation field_rep; 86 StoreHandler::FieldRepresentation field_rep;
86 switch (representation.kind()) { 87 switch (representation.kind()) {
87 case Representation::kSmi: 88 case Representation::kSmi:
88 field_rep = StoreHandler::kSmi; 89 field_rep = StoreHandler::kSmi;
89 break; 90 break;
90 case Representation::kDouble: 91 case Representation::kDouble:
91 field_rep = StoreHandler::kDouble; 92 field_rep = StoreHandler::kDouble;
92 break; 93 break;
93 case Representation::kHeapObject: 94 case Representation::kHeapObject:
94 field_rep = StoreHandler::kHeapObject; 95 field_rep = StoreHandler::kHeapObject;
95 break; 96 break;
96 case Representation::kTagged: 97 case Representation::kTagged:
97 field_rep = StoreHandler::kTagged; 98 field_rep = StoreHandler::kTagged;
98 break; 99 break;
99 default: 100 default:
100 UNREACHABLE(); 101 UNREACHABLE();
101 return Handle<Object>::null(); 102 return Handle<Object>::null();
102 } 103 }
103 int value_index = DescriptorArray::ToValueIndex(descriptor); 104 int value_index = DescriptorArray::ToValueIndex(descriptor);
104 105
105 int config = StoreHandler::KindBits::encode(StoreHandler::kForFields) | 106 DCHECK(kind == kStoreField || kind == kTransitionToField);
107 DCHECK_IMPLIES(kind == kStoreField, !extend_storage);
108
109 int config = StoreHandler::KindBits::encode(kind) |
110 StoreHandler::ExtendStorageBits::encode(extend_storage) |
106 StoreHandler::IsInobjectBits::encode(field_index.is_inobject()) | 111 StoreHandler::IsInobjectBits::encode(field_index.is_inobject()) |
107 StoreHandler::FieldRepresentationBits::encode(field_rep) | 112 StoreHandler::FieldRepresentationBits::encode(field_rep) |
108 StoreHandler::DescriptorValueIndexBits::encode(value_index) | 113 StoreHandler::DescriptorValueIndexBits::encode(value_index) |
109 StoreHandler::FieldOffsetBits::encode(field_index.offset()); 114 StoreHandler::FieldOffsetBits::encode(field_index.offset());
110 return handle(Smi::FromInt(config), isolate); 115 return handle(Smi::FromInt(config), isolate);
111 } 116 }
112 117
118 Handle<Object> StoreHandler::StoreField(Isolate* isolate, int descriptor,
119 FieldIndex field_index,
120 Representation representation) {
121 return StoreField(isolate, kStoreField, descriptor, field_index,
122 representation, false);
123 }
124
125 Handle<Object> StoreHandler::TransitionToField(Isolate* isolate, int descriptor,
126 FieldIndex field_index,
127 Representation representation,
128 bool extend_storage) {
129 return StoreField(isolate, kTransitionToField, descriptor, field_index,
130 representation, extend_storage);
131 }
132
133 Handle<Object> StoreHandler::TransitionToConstant(Isolate* isolate,
134 int descriptor) {
135 int value_index = DescriptorArray::ToValueIndex(descriptor);
136 int config =
137 StoreHandler::KindBits::encode(StoreHandler::kTransitionToConstant) |
138 StoreHandler::DescriptorValueIndexBits::encode(value_index);
139 return handle(Smi::FromInt(config), isolate);
140 }
141
113 } // namespace internal 142 } // namespace internal
114 } // namespace v8 143 } // namespace v8
115 144
116 #endif // V8_IC_HANDLER_CONFIGURATION_INL_H_ 145 #endif // V8_IC_HANDLER_CONFIGURATION_INL_H_
OLDNEW
« no previous file with comments | « src/ic/handler-configuration.h ('k') | src/ic/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698