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 5482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5493 FeedbackVectorSlot slot = property->GetSlot(); | 5493 FeedbackVectorSlot slot = property->GetSlot(); |
5494 if (map.is_null()) { | 5494 if (map.is_null()) { |
5495 // If we don't know the monomorphic type, do a generic store. | 5495 // If we don't know the monomorphic type, do a generic store. |
5496 CHECK_ALIVE(store = BuildNamedGeneric(STORE, NULL, slot, literal, | 5496 CHECK_ALIVE(store = BuildNamedGeneric(STORE, NULL, slot, literal, |
5497 name, value)); | 5497 name, value)); |
5498 } else { | 5498 } else { |
5499 PropertyAccessInfo info(this, STORE, map, name); | 5499 PropertyAccessInfo info(this, STORE, map, name); |
5500 if (info.CanAccessMonomorphic()) { | 5500 if (info.CanAccessMonomorphic()) { |
5501 HValue* checked_literal = Add<HCheckMaps>(literal, map); | 5501 HValue* checked_literal = Add<HCheckMaps>(literal, map); |
5502 DCHECK(!info.IsAccessorConstant()); | 5502 DCHECK(!info.IsAccessorConstant()); |
5503 info.MarkAsInitializingStore(); | |
5503 store = BuildMonomorphicAccess( | 5504 store = BuildMonomorphicAccess( |
5504 &info, literal, checked_literal, value, | 5505 &info, literal, checked_literal, value, |
5505 BailoutId::None(), BailoutId::None()); | 5506 BailoutId::None(), BailoutId::None()); |
5506 } else { | 5507 } else { |
5507 CHECK_ALIVE(store = BuildNamedGeneric(STORE, NULL, slot, | 5508 CHECK_ALIVE(store = BuildNamedGeneric(STORE, NULL, slot, |
5508 literal, name, value)); | 5509 literal, name, value)); |
5509 } | 5510 } |
5510 } | 5511 } |
5511 if (store->IsInstruction()) { | 5512 if (store->IsInstruction()) { |
5512 AddInstruction(HInstruction::cast(store)); | 5513 AddInstruction(HInstruction::cast(store)); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5734 if (field_access.representation().IsHeapObject()) { | 5735 if (field_access.representation().IsHeapObject()) { |
5735 BuildCheckHeapObject(value); | 5736 BuildCheckHeapObject(value); |
5736 } | 5737 } |
5737 | 5738 |
5738 if (!info->field_maps()->is_empty()) { | 5739 if (!info->field_maps()->is_empty()) { |
5739 DCHECK(field_access.representation().IsHeapObject()); | 5740 DCHECK(field_access.representation().IsHeapObject()); |
5740 value = Add<HCheckMaps>(value, info->field_maps()); | 5741 value = Add<HCheckMaps>(value, info->field_maps()); |
5741 } | 5742 } |
5742 | 5743 |
5743 // This is a normal store. | 5744 // This is a normal store. |
5744 instr = New<HStoreNamedField>( | 5745 instr = New<HStoreNamedField>(checked_object->ActualValue(), field_access, |
5745 checked_object->ActualValue(), field_access, value, | 5746 value, info->StoreMode()); |
5746 transition_to_field ? INITIALIZING_STORE : STORE_TO_INITIALIZED_ENTRY); | |
5747 } | 5747 } |
5748 | 5748 |
5749 if (transition_to_field) { | 5749 if (transition_to_field) { |
5750 Handle<Map> transition(info->transition()); | 5750 Handle<Map> transition(info->transition()); |
5751 DCHECK(!transition->is_deprecated()); | 5751 DCHECK(!transition->is_deprecated()); |
5752 instr->SetTransition(Add<HConstant>(transition)); | 5752 instr->SetTransition(Add<HConstant>(transition)); |
5753 } | 5753 } |
5754 return instr; | 5754 return instr; |
5755 } | 5755 } |
5756 | 5756 |
5757 void HOptimizedGraphBuilder::PropertyAccessInfo::MarkAsInitializingStore() { | |
5758 DCHECK_EQ(STORE, access_type_); | |
5759 store_mode_ = INITIALIZING_STORE; | |
5760 } | |
5761 | |
5762 StoreFieldOrKeyedMode HOptimizedGraphBuilder::PropertyAccessInfo::StoreMode() { | |
5763 DCHECK_EQ(STORE, access_type_); | |
5764 if (IsTransition()) return INITIALIZING_STORE; | |
Toon Verwaest
2017/01/16 11:53:31
if IsTransition() is true, store_mode_ should just
Igor Sheludko
2017/01/16 12:02:59
Done.
| |
5765 return store_mode_; | |
5766 } | |
5767 | |
5757 Handle<FieldType> | 5768 Handle<FieldType> |
5758 HOptimizedGraphBuilder::PropertyAccessInfo::GetFieldTypeFromMap( | 5769 HOptimizedGraphBuilder::PropertyAccessInfo::GetFieldTypeFromMap( |
5759 Handle<Map> map) const { | 5770 Handle<Map> map) const { |
5760 DCHECK(IsFound()); | 5771 DCHECK(IsFound()); |
5761 DCHECK(number_ < map->NumberOfOwnDescriptors()); | 5772 DCHECK(number_ < map->NumberOfOwnDescriptors()); |
5762 return handle(map->instance_descriptors()->GetFieldType(number_), isolate()); | 5773 return handle(map->instance_descriptors()->GetFieldType(number_), isolate()); |
5763 } | 5774 } |
5764 | 5775 |
5765 bool HOptimizedGraphBuilder::PropertyAccessInfo::IsCompatible( | 5776 bool HOptimizedGraphBuilder::PropertyAccessInfo::IsCompatible( |
5766 PropertyAccessInfo* info) { | 5777 PropertyAccessInfo* info) { |
(...skipping 7170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12937 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12948 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12938 } | 12949 } |
12939 | 12950 |
12940 #ifdef DEBUG | 12951 #ifdef DEBUG |
12941 graph_->Verify(false); // No full verify. | 12952 graph_->Verify(false); // No full verify. |
12942 #endif | 12953 #endif |
12943 } | 12954 } |
12944 | 12955 |
12945 } // namespace internal | 12956 } // namespace internal |
12946 } // namespace v8 | 12957 } // namespace v8 |
OLD | NEW |