OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compilation-dependencies.h" | 5 #include "src/compilation-dependencies.h" |
6 | 6 |
7 #include "src/factory.h" | 7 #include "src/factory.h" |
8 #include "src/handles-inl.h" | 8 #include "src/handles-inl.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 void CompilationDependencies::AssumeMapStable(Handle<Map> map) { | 118 void CompilationDependencies::AssumeMapStable(Handle<Map> map) { |
119 DCHECK(map->is_stable()); | 119 DCHECK(map->is_stable()); |
120 // Do nothing if the map cannot transition. | 120 // Do nothing if the map cannot transition. |
121 if (map->CanTransition()) { | 121 if (map->CanTransition()) { |
122 Insert(DependentCode::kPrototypeCheckGroup, map); | 122 Insert(DependentCode::kPrototypeCheckGroup, map); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 | 126 |
| 127 void CompilationDependencies::AssumePrototypeMapsStable( |
| 128 Handle<Map> map, MaybeHandle<JSReceiver> prototype) { |
| 129 for (PrototypeIterator i(map); !i.IsAtEnd(); i.Advance()) { |
| 130 Handle<JSReceiver> const current = |
| 131 PrototypeIterator::GetCurrent<JSReceiver>(i); |
| 132 AssumeMapStable(handle(current->map())); |
| 133 Handle<JSReceiver> last; |
| 134 if (prototype.ToHandle(&last) && last.is_identical_to(current)) { |
| 135 break; |
| 136 } |
| 137 } |
| 138 } |
| 139 |
| 140 |
127 void CompilationDependencies::AssumeTransitionStable( | 141 void CompilationDependencies::AssumeTransitionStable( |
128 Handle<AllocationSite> site) { | 142 Handle<AllocationSite> site) { |
129 // Do nothing if the object doesn't have any useful element transitions left. | 143 // Do nothing if the object doesn't have any useful element transitions left. |
130 ElementsKind kind = | 144 ElementsKind kind = |
131 site->SitePointsToLiteral() | 145 site->SitePointsToLiteral() |
132 ? JSObject::cast(site->transition_info())->GetElementsKind() | 146 ? JSObject::cast(site->transition_info())->GetElementsKind() |
133 : site->GetElementsKind(); | 147 : site->GetElementsKind(); |
134 if (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) { | 148 if (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) { |
135 Insert(DependentCode::kAllocationSiteTransitionChangedGroup, site); | 149 Insert(DependentCode::kAllocationSiteTransitionChangedGroup, site); |
136 } | 150 } |
137 } | 151 } |
| 152 |
138 } // namespace internal | 153 } // namespace internal |
139 } // namespace v8 | 154 } // namespace v8 |
OLD | NEW |