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 <ostream> | 5 #include <ostream> |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/compilation-dependencies.h" | 8 #include "src/compilation-dependencies.h" |
9 #include "src/compiler/access-info.h" | 9 #include "src/compiler/access-info.h" |
10 #include "src/field-index-inl.h" | 10 #include "src/field-index-inl.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 // Certain (monomorphic) stores need a prototype chain check because shape | 150 // Certain (monomorphic) stores need a prototype chain check because shape |
151 // changes could allow callbacks on elements in the chain that are not | 151 // changes could allow callbacks on elements in the chain that are not |
152 // compatible with monomorphic keyed stores. | 152 // compatible with monomorphic keyed stores. |
153 MaybeHandle<JSObject> holder; | 153 MaybeHandle<JSObject> holder; |
154 if (access_mode == AccessMode::kStore && map->prototype()->IsJSObject()) { | 154 if (access_mode == AccessMode::kStore && map->prototype()->IsJSObject()) { |
155 for (PrototypeIterator i(map); !i.IsAtEnd(); i.Advance()) { | 155 for (PrototypeIterator i(map); !i.IsAtEnd(); i.Advance()) { |
156 Handle<JSReceiver> prototype = | 156 Handle<JSReceiver> prototype = |
157 PrototypeIterator::GetCurrent<JSReceiver>(i); | 157 PrototypeIterator::GetCurrent<JSReceiver>(i); |
158 if (!prototype->IsJSObject()) return false; | 158 if (!prototype->IsJSObject()) return false; |
| 159 // TODO(bmeurer): We do not currently support unstable prototypes. |
| 160 // We might want to revisit the way we handle certain keyed stores |
| 161 // because this whole prototype chain check is essential a hack, |
| 162 // and I'm not sure that it is correct at all with dictionaries in |
| 163 // the prototype chain. |
| 164 if (!prototype->map()->is_stable()) return false; |
159 holder = Handle<JSObject>::cast(prototype); | 165 holder = Handle<JSObject>::cast(prototype); |
160 } | 166 } |
161 } | 167 } |
162 | 168 |
163 *access_info = | 169 *access_info = |
164 ElementAccessInfo(Type::Class(map, zone()), elements_kind, holder); | 170 ElementAccessInfo(Type::Class(map, zone()), elements_kind, holder); |
165 return true; | 171 return true; |
166 } | 172 } |
167 | 173 |
168 | 174 |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 } | 479 } |
474 return false; | 480 return false; |
475 } | 481 } |
476 | 482 |
477 | 483 |
478 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } | 484 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } |
479 | 485 |
480 } // namespace compiler | 486 } // namespace compiler |
481 } // namespace internal | 487 } // namespace internal |
482 } // namespace v8 | 488 } // namespace v8 |
OLD | NEW |