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/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
8 #include "src/frames.h" | 8 #include "src/frames.h" |
9 #include "src/ic/handler-configuration.h" | 9 #include "src/ic/handler-configuration.h" |
10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
(...skipping 4931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4942 Bind(&next); | 4942 Bind(&next); |
4943 { | 4943 { |
4944 // For all objects but the receiver, check that the cache is empty. | 4944 // For all objects but the receiver, check that the cache is empty. |
4945 current_map.Bind(LoadMap(current_js_object.value())); | 4945 current_map.Bind(LoadMap(current_js_object.value())); |
4946 Node* enum_length = EnumLength(current_map.value()); | 4946 Node* enum_length = EnumLength(current_map.value()); |
4947 Node* zero_constant = SmiConstant(Smi::FromInt(0)); | 4947 Node* zero_constant = SmiConstant(Smi::FromInt(0)); |
4948 BranchIf(WordEqual(enum_length, zero_constant), &loop, use_runtime); | 4948 BranchIf(WordEqual(enum_length, zero_constant), &loop, use_runtime); |
4949 } | 4949 } |
4950 } | 4950 } |
4951 | 4951 |
| 4952 Node* CodeStubAssembler::CreateAllocationSiteInFeedbackVector( |
| 4953 Node* feedback_vector, Node* slot) { |
| 4954 Node* size = IntPtrConstant(AllocationSite::kSize); |
| 4955 Node* site = Allocate(size, CodeStubAssembler::kPretenured); |
| 4956 |
| 4957 // Store the map |
| 4958 StoreObjectFieldRoot(site, AllocationSite::kMapOffset, |
| 4959 Heap::kAllocationSiteMapRootIndex); |
| 4960 Node* kind = SmiConstant(Smi::FromInt(GetInitialFastElementsKind())); |
| 4961 StoreObjectFieldNoWriteBarrier(site, AllocationSite::kTransitionInfoOffset, |
| 4962 kind); |
| 4963 |
| 4964 // Unlike literals, constructed arrays don't have nested sites |
| 4965 Node* zero = IntPtrConstant(0); |
| 4966 StoreObjectFieldNoWriteBarrier(site, AllocationSite::kNestedSiteOffset, zero); |
| 4967 |
| 4968 // Pretenuring calculation field. |
| 4969 StoreObjectFieldNoWriteBarrier(site, AllocationSite::kPretenureDataOffset, |
| 4970 zero); |
| 4971 |
| 4972 // Pretenuring memento creation count field. |
| 4973 StoreObjectFieldNoWriteBarrier( |
| 4974 site, AllocationSite::kPretenureCreateCountOffset, zero); |
| 4975 |
| 4976 // Store an empty fixed array for the code dependency. |
| 4977 StoreObjectFieldRoot(site, AllocationSite::kDependentCodeOffset, |
| 4978 Heap::kEmptyFixedArrayRootIndex); |
| 4979 |
| 4980 // Link the object to the allocation site list |
| 4981 Node* site_list = ExternalConstant( |
| 4982 ExternalReference::allocation_sites_list_address(isolate())); |
| 4983 Node* next_site = LoadBufferObject(site_list, 0); |
| 4984 |
| 4985 // TODO(mvstanton): This is a store to a weak pointer, which we may want to |
| 4986 // mark as such in order to skip the write barrier, once we have a unified |
| 4987 // system for weakness. For now we decided to keep it like this because having |
| 4988 // an initial write barrier backed store makes this pointer strong until the |
| 4989 // next GC, and allocation sites are designed to survive several GCs anyway. |
| 4990 StoreObjectField(site, AllocationSite::kWeakNextOffset, next_site); |
| 4991 StoreNoWriteBarrier(MachineRepresentation::kTagged, site_list, site); |
| 4992 |
| 4993 StoreFixedArrayElement(feedback_vector, slot, site, UPDATE_WRITE_BARRIER, |
| 4994 CodeStubAssembler::SMI_PARAMETERS); |
| 4995 return site; |
| 4996 } |
| 4997 |
4952 Node* CodeStubAssembler::CreateWeakCellInFeedbackVector(Node* feedback_vector, | 4998 Node* CodeStubAssembler::CreateWeakCellInFeedbackVector(Node* feedback_vector, |
4953 Node* slot, | 4999 Node* slot, |
4954 Node* value) { | 5000 Node* value) { |
4955 Node* size = IntPtrConstant(WeakCell::kSize); | 5001 Node* size = IntPtrConstant(WeakCell::kSize); |
4956 Node* cell = Allocate(size, CodeStubAssembler::kPretenured); | 5002 Node* cell = Allocate(size, CodeStubAssembler::kPretenured); |
4957 | 5003 |
4958 // Initialize the WeakCell. | 5004 // Initialize the WeakCell. |
4959 StoreObjectFieldRoot(cell, WeakCell::kMapOffset, Heap::kWeakCellMapRootIndex); | 5005 StoreObjectFieldRoot(cell, WeakCell::kMapOffset, Heap::kWeakCellMapRootIndex); |
4960 StoreObjectField(cell, WeakCell::kValueOffset, value); | 5006 StoreObjectField(cell, WeakCell::kValueOffset, value); |
4961 StoreObjectFieldRoot(cell, WeakCell::kNextOffset, | 5007 StoreObjectFieldRoot(cell, WeakCell::kNextOffset, |
4962 Heap::kTheHoleValueRootIndex); | 5008 Heap::kTheHoleValueRootIndex); |
4963 | 5009 |
4964 // Store the WeakCell in the feedback vector. | 5010 // Store the WeakCell in the feedback vector. |
4965 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 5011 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
4966 CodeStubAssembler::SMI_PARAMETERS); | 5012 CodeStubAssembler::SMI_PARAMETERS); |
4967 return cell; | 5013 return cell; |
4968 } | 5014 } |
4969 | 5015 |
4970 } // namespace internal | 5016 } // namespace internal |
4971 } // namespace v8 | 5017 } // namespace v8 |
OLD | NEW |