OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
10 #include "src/lookup-inl.h" | 10 #include "src/lookup-inl.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 ReloadPropertyInformation(); | 149 ReloadPropertyInformation(); |
150 } | 150 } |
151 | 151 |
152 | 152 |
153 void LookupIterator::ReconfigureDataProperty(Handle<Object> value, | 153 void LookupIterator::ReconfigureDataProperty(Handle<Object> value, |
154 PropertyAttributes attributes) { | 154 PropertyAttributes attributes) { |
155 DCHECK(state_ == DATA || state_ == ACCESSOR); | 155 DCHECK(state_ == DATA || state_ == ACCESSOR); |
156 DCHECK(HolderIsReceiverOrHiddenPrototype()); | 156 DCHECK(HolderIsReceiverOrHiddenPrototype()); |
157 Handle<JSObject> holder = GetHolder<JSObject>(); | 157 Handle<JSObject> holder = GetHolder<JSObject>(); |
158 if (IsElement()) { | 158 if (IsElement()) { |
159 // TODO(verwaest): Clean up. | 159 DCHECK(!holder->HasExternalArrayElements()); |
160 DCHECK(holder->HasFastElements() || holder->HasDictionaryElements() || | 160 DCHECK(!holder->HasFixedTypedArrayElements()); |
161 holder->HasSloppyArgumentsElements()); | |
162 DCHECK(attributes != NONE || !holder->HasFastElements()); | 161 DCHECK(attributes != NONE || !holder->HasFastElements()); |
163 Handle<SeededNumberDictionary> d = JSObject::NormalizeElements(holder); | 162 Handle<FixedArrayBase> elements(holder->elements()); |
164 // TODO(verwaest): Move this into NormalizeElements. | 163 holder->GetElementsAccessor()->Reconfigure(holder, elements, number_, value, |
165 d->set_requires_slow_elements(); | 164 attributes); |
166 if (holder->HasDictionaryElements()) { | |
167 JSObject::SetDictionaryElement(holder, index(), value, attributes); | |
168 } else { | |
169 JSObject::SetDictionaryArgumentsElement(holder, index(), value, | |
170 attributes); | |
171 } | |
172 } else if (holder_map_->is_dictionary_map()) { | 165 } else if (holder_map_->is_dictionary_map()) { |
173 PropertyDetails details(attributes, v8::internal::DATA, 0, | 166 PropertyDetails details(attributes, v8::internal::DATA, 0, |
174 PropertyCellType::kMutable); | 167 PropertyCellType::kMutable); |
175 JSObject::SetNormalizedProperty(holder, name(), value, details); | 168 JSObject::SetNormalizedProperty(holder, name(), value, details); |
176 } else { | 169 } else { |
177 holder_map_ = Map::ReconfigureExistingProperty( | 170 holder_map_ = Map::ReconfigureExistingProperty( |
178 holder_map_, descriptor_number(), i::kData, attributes); | 171 holder_map_, descriptor_number(), i::kData, attributes); |
179 holder_map_ = | 172 holder_map_ = |
180 Map::PrepareForDataProperty(holder_map_, descriptor_number(), value); | 173 Map::PrepareForDataProperty(holder_map_, descriptor_number(), value); |
181 JSObject::MigrateToMap(holder, holder_map_); | 174 JSObject::MigrateToMap(holder, holder_map_); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 case InterceptorState::kSkipNonMasking: | 475 case InterceptorState::kSkipNonMasking: |
483 return true; | 476 return true; |
484 case InterceptorState::kProcessNonMasking: | 477 case InterceptorState::kProcessNonMasking: |
485 return false; | 478 return false; |
486 } | 479 } |
487 } | 480 } |
488 return interceptor_state_ == InterceptorState::kProcessNonMasking; | 481 return interceptor_state_ == InterceptorState::kProcessNonMasking; |
489 } | 482 } |
490 } // namespace internal | 483 } // namespace internal |
491 } // namespace v8 | 484 } // namespace v8 |
OLD | NEW |