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 #include "src/compiler/js-create-lowering.h" | 5 #include "src/compiler/js-create-lowering.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // TODO(turbofan): Do we want to support out-of-object properties? | 172 // TODO(turbofan): Do we want to support out-of-object properties? |
173 Handle<FixedArray> properties(boilerplate->properties(), isolate); | 173 Handle<FixedArray> properties(boilerplate->properties(), isolate); |
174 if (properties->length() > 0) return false; | 174 if (properties->length() > 0) return false; |
175 | 175 |
176 // Check the in-object properties. | 176 // Check the in-object properties. |
177 Handle<DescriptorArray> descriptors( | 177 Handle<DescriptorArray> descriptors( |
178 boilerplate->map()->instance_descriptors(), isolate); | 178 boilerplate->map()->instance_descriptors(), isolate); |
179 int limit = boilerplate->map()->NumberOfOwnDescriptors(); | 179 int limit = boilerplate->map()->NumberOfOwnDescriptors(); |
180 for (int i = 0; i < limit; i++) { | 180 for (int i = 0; i < limit; i++) { |
181 PropertyDetails details = descriptors->GetDetails(i); | 181 PropertyDetails details = descriptors->GetDetails(i); |
182 if (details.type() != DATA) continue; | 182 if (details.location() != kField) continue; |
| 183 DCHECK_EQ(kData, details.kind()); |
183 if ((*max_properties)-- == 0) return false; | 184 if ((*max_properties)-- == 0) return false; |
184 FieldIndex field_index = FieldIndex::ForDescriptor(boilerplate->map(), i); | 185 FieldIndex field_index = FieldIndex::ForDescriptor(boilerplate->map(), i); |
185 if (boilerplate->IsUnboxedDoubleField(field_index)) continue; | 186 if (boilerplate->IsUnboxedDoubleField(field_index)) continue; |
186 Handle<Object> value(boilerplate->RawFastPropertyAt(field_index), isolate); | 187 Handle<Object> value(boilerplate->RawFastPropertyAt(field_index), isolate); |
187 if (value->IsJSObject()) { | 188 if (value->IsJSObject()) { |
188 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 189 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
189 if (!IsFastLiteral(value_object, max_depth - 1, max_properties)) { | 190 if (!IsFastLiteral(value_object, max_depth - 1, max_properties)) { |
190 return false; | 191 return false; |
191 } | 192 } |
192 } | 193 } |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 if (elements->op()->EffectOutputCount() > 0) effect = elements; | 1180 if (elements->op()->EffectOutputCount() > 0) effect = elements; |
1180 | 1181 |
1181 // Compute the in-object properties to store first (might have effects). | 1182 // Compute the in-object properties to store first (might have effects). |
1182 Handle<Map> boilerplate_map(boilerplate->map(), isolate()); | 1183 Handle<Map> boilerplate_map(boilerplate->map(), isolate()); |
1183 ZoneVector<std::pair<FieldAccess, Node*>> inobject_fields(zone()); | 1184 ZoneVector<std::pair<FieldAccess, Node*>> inobject_fields(zone()); |
1184 inobject_fields.reserve(boilerplate_map->GetInObjectProperties()); | 1185 inobject_fields.reserve(boilerplate_map->GetInObjectProperties()); |
1185 int const boilerplate_nof = boilerplate_map->NumberOfOwnDescriptors(); | 1186 int const boilerplate_nof = boilerplate_map->NumberOfOwnDescriptors(); |
1186 for (int i = 0; i < boilerplate_nof; ++i) { | 1187 for (int i = 0; i < boilerplate_nof; ++i) { |
1187 PropertyDetails const property_details = | 1188 PropertyDetails const property_details = |
1188 boilerplate_map->instance_descriptors()->GetDetails(i); | 1189 boilerplate_map->instance_descriptors()->GetDetails(i); |
1189 if (property_details.type() != DATA) continue; | 1190 if (property_details.location() != kField) continue; |
| 1191 DCHECK_EQ(kData, property_details.kind()); |
1190 Handle<Name> property_name( | 1192 Handle<Name> property_name( |
1191 boilerplate_map->instance_descriptors()->GetKey(i), isolate()); | 1193 boilerplate_map->instance_descriptors()->GetKey(i), isolate()); |
1192 FieldIndex index = FieldIndex::ForDescriptor(*boilerplate_map, i); | 1194 FieldIndex index = FieldIndex::ForDescriptor(*boilerplate_map, i); |
1193 FieldAccess access = {kTaggedBase, index.offset(), | 1195 FieldAccess access = {kTaggedBase, index.offset(), |
1194 property_name, MaybeHandle<Map>(), | 1196 property_name, MaybeHandle<Map>(), |
1195 Type::Any(), MachineType::AnyTagged(), | 1197 Type::Any(), MachineType::AnyTagged(), |
1196 kFullWriteBarrier}; | 1198 kFullWriteBarrier}; |
1197 Node* value; | 1199 Node* value; |
1198 if (boilerplate->IsUnboxedDoubleField(index)) { | 1200 if (boilerplate->IsUnboxedDoubleField(index)) { |
1199 access.machine_type = MachineType::Float64(); | 1201 access.machine_type = MachineType::Float64(); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 return jsgraph()->simplified(); | 1384 return jsgraph()->simplified(); |
1383 } | 1385 } |
1384 | 1386 |
1385 MachineOperatorBuilder* JSCreateLowering::machine() const { | 1387 MachineOperatorBuilder* JSCreateLowering::machine() const { |
1386 return jsgraph()->machine(); | 1388 return jsgraph()->machine(); |
1387 } | 1389 } |
1388 | 1390 |
1389 } // namespace compiler | 1391 } // namespace compiler |
1390 } // namespace internal | 1392 } // namespace internal |
1391 } // namespace v8 | 1393 } // namespace v8 |
OLD | NEW |