OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 | 1709 |
1710 IfBuilder found_key_match(this, &found_key_match_continuation); | 1710 IfBuilder found_key_match(this, &found_key_match_continuation); |
1711 found_key_match.Then(); | 1711 found_key_match.Then(); |
1712 // Key at current probe matches. Relevant bits in the |details| field must | 1712 // Key at current probe matches. Relevant bits in the |details| field must |
1713 // be zero, otherwise the dictionary element requires special handling. | 1713 // be zero, otherwise the dictionary element requires special handling. |
1714 HValue* details_index = | 1714 HValue* details_index = |
1715 AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 2)); | 1715 AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 2)); |
1716 details_index->ClearFlag(HValue::kCanOverflow); | 1716 details_index->ClearFlag(HValue::kCanOverflow); |
1717 HValue* details = Add<HLoadKeyed>(elements, details_index, nullptr, nullptr, | 1717 HValue* details = Add<HLoadKeyed>(elements, details_index, nullptr, nullptr, |
1718 FAST_ELEMENTS); | 1718 FAST_ELEMENTS); |
1719 int details_mask = PropertyDetails::TypeField::kMask; | 1719 int details_mask = PropertyDetails::KindField::kMask; |
1720 details = AddUncasted<HBitwise>(Token::BIT_AND, details, | 1720 details = AddUncasted<HBitwise>(Token::BIT_AND, details, |
1721 Add<HConstant>(details_mask)); | 1721 Add<HConstant>(details_mask)); |
1722 IfBuilder details_compare(this); | 1722 IfBuilder details_compare(this); |
1723 details_compare.If<HCompareNumericAndBranch>( | 1723 details_compare.If<HCompareNumericAndBranch>(details, New<HConstant>(kData), |
1724 details, graph()->GetConstant0(), Token::EQ); | 1724 Token::EQ); |
1725 details_compare.Then(); | 1725 details_compare.Then(); |
1726 HValue* result_index = | 1726 HValue* result_index = |
1727 AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 1)); | 1727 AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 1)); |
1728 result_index->ClearFlag(HValue::kCanOverflow); | 1728 result_index->ClearFlag(HValue::kCanOverflow); |
1729 Push(Add<HLoadKeyed>(elements, result_index, nullptr, nullptr, | 1729 Push(Add<HLoadKeyed>(elements, result_index, nullptr, nullptr, |
1730 FAST_ELEMENTS)); | 1730 FAST_ELEMENTS)); |
1731 details_compare.Else(); | 1731 details_compare.Else(); |
1732 Add<HPushArguments>(receiver, key); | 1732 Add<HPushArguments>(receiver, key); |
1733 Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kKeyedGetProperty), | 1733 Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kKeyedGetProperty), |
1734 2)); | 1734 2)); |
(...skipping 3659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5394 | 5394 |
5395 Handle<FixedArray> properties(boilerplate->properties()); | 5395 Handle<FixedArray> properties(boilerplate->properties()); |
5396 if (properties->length() > 0) { | 5396 if (properties->length() > 0) { |
5397 return false; | 5397 return false; |
5398 } else { | 5398 } else { |
5399 Handle<DescriptorArray> descriptors( | 5399 Handle<DescriptorArray> descriptors( |
5400 boilerplate->map()->instance_descriptors()); | 5400 boilerplate->map()->instance_descriptors()); |
5401 int limit = boilerplate->map()->NumberOfOwnDescriptors(); | 5401 int limit = boilerplate->map()->NumberOfOwnDescriptors(); |
5402 for (int i = 0; i < limit; i++) { | 5402 for (int i = 0; i < limit; i++) { |
5403 PropertyDetails details = descriptors->GetDetails(i); | 5403 PropertyDetails details = descriptors->GetDetails(i); |
5404 if (details.type() != DATA) continue; | 5404 if (details.location() != kField) continue; |
| 5405 DCHECK_EQ(kData, details.kind()); |
5405 if ((*max_properties)-- == 0) return false; | 5406 if ((*max_properties)-- == 0) return false; |
5406 FieldIndex field_index = FieldIndex::ForDescriptor(boilerplate->map(), i); | 5407 FieldIndex field_index = FieldIndex::ForDescriptor(boilerplate->map(), i); |
5407 if (boilerplate->IsUnboxedDoubleField(field_index)) continue; | 5408 if (boilerplate->IsUnboxedDoubleField(field_index)) continue; |
5408 Handle<Object> value(boilerplate->RawFastPropertyAt(field_index), | 5409 Handle<Object> value(boilerplate->RawFastPropertyAt(field_index), |
5409 isolate); | 5410 isolate); |
5410 if (value->IsJSObject()) { | 5411 if (value->IsJSObject()) { |
5411 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 5412 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
5412 if (!IsFastLiteral(value_object, | 5413 if (!IsFastLiteral(value_object, |
5413 max_depth - 1, | 5414 max_depth - 1, |
5414 max_properties)) { | 5415 max_properties)) { |
(...skipping 6198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11613 HInstruction* object, | 11614 HInstruction* object, |
11614 AllocationSiteUsageContext* site_context, | 11615 AllocationSiteUsageContext* site_context, |
11615 PretenureFlag pretenure_flag) { | 11616 PretenureFlag pretenure_flag) { |
11616 Handle<Map> boilerplate_map(boilerplate_object->map()); | 11617 Handle<Map> boilerplate_map(boilerplate_object->map()); |
11617 Handle<DescriptorArray> descriptors(boilerplate_map->instance_descriptors()); | 11618 Handle<DescriptorArray> descriptors(boilerplate_map->instance_descriptors()); |
11618 int limit = boilerplate_map->NumberOfOwnDescriptors(); | 11619 int limit = boilerplate_map->NumberOfOwnDescriptors(); |
11619 | 11620 |
11620 int copied_fields = 0; | 11621 int copied_fields = 0; |
11621 for (int i = 0; i < limit; i++) { | 11622 for (int i = 0; i < limit; i++) { |
11622 PropertyDetails details = descriptors->GetDetails(i); | 11623 PropertyDetails details = descriptors->GetDetails(i); |
11623 if (details.type() != DATA) continue; | 11624 if (details.location() != kField) continue; |
| 11625 DCHECK_EQ(kData, details.kind()); |
11624 copied_fields++; | 11626 copied_fields++; |
11625 FieldIndex field_index = FieldIndex::ForDescriptor(*boilerplate_map, i); | 11627 FieldIndex field_index = FieldIndex::ForDescriptor(*boilerplate_map, i); |
11626 | 11628 |
11627 | 11629 |
11628 int property_offset = field_index.offset(); | 11630 int property_offset = field_index.offset(); |
11629 Handle<Name> name(descriptors->GetKey(i)); | 11631 Handle<Name> name(descriptors->GetKey(i)); |
11630 | 11632 |
11631 // The access for the store depends on the type of the boilerplate. | 11633 // The access for the store depends on the type of the boilerplate. |
11632 HObjectAccess access = boilerplate_object->IsJSArray() ? | 11634 HObjectAccess access = boilerplate_object->IsJSArray() ? |
11633 HObjectAccess::ForJSArrayOffset(property_offset) : | 11635 HObjectAccess::ForJSArrayOffset(property_offset) : |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12969 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12971 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12970 } | 12972 } |
12971 | 12973 |
12972 #ifdef DEBUG | 12974 #ifdef DEBUG |
12973 graph_->Verify(false); // No full verify. | 12975 graph_->Verify(false); // No full verify. |
12974 #endif | 12976 #endif |
12975 } | 12977 } |
12976 | 12978 |
12977 } // namespace internal | 12979 } // namespace internal |
12978 } // namespace v8 | 12980 } // namespace v8 |
OLD | NEW |