| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 166 } |
| 167 | 167 |
| 168 | 168 |
| 169 void LookupIterator::ReconfigureDataProperty(Handle<Object> value, | 169 void LookupIterator::ReconfigureDataProperty(Handle<Object> value, |
| 170 PropertyAttributes attributes) { | 170 PropertyAttributes attributes) { |
| 171 DCHECK(state_ == DATA || state_ == ACCESSOR); | 171 DCHECK(state_ == DATA || state_ == ACCESSOR); |
| 172 DCHECK(HolderIsReceiverOrHiddenPrototype()); | 172 DCHECK(HolderIsReceiverOrHiddenPrototype()); |
| 173 Handle<JSObject> holder = GetHolder<JSObject>(); | 173 Handle<JSObject> holder = GetHolder<JSObject>(); |
| 174 if (IsElement()) { | 174 if (IsElement()) { |
| 175 // TODO(verwaest): Clean up. | 175 // TODO(verwaest): Clean up. |
| 176 if (attributes == NONE && !holder->HasDictionaryElements() && | 176 DCHECK(holder->HasFastElements() || holder->HasDictionaryElements() || |
| 177 !holder->HasDictionaryArgumentsElements()) { | 177 holder->HasSloppyArgumentsElements()); |
| 178 ElementsAccessor* accessor = holder->GetElementsAccessor(); | 178 DCHECK(attributes != NONE || !holder->HasFastElements()); |
| 179 accessor->Set(holder, index(), value); | 179 Handle<SeededNumberDictionary> d = JSObject::NormalizeElements(holder); |
| 180 // TODO(verwaest): Move this into NormalizeElements. |
| 181 d->set_requires_slow_elements(); |
| 182 if (holder->HasDictionaryElements()) { |
| 183 JSObject::SetDictionaryElement(holder, index(), value, attributes); |
| 180 } else { | 184 } else { |
| 181 DCHECK(holder->HasFastElements() || holder->HasDictionaryElements() || | 185 JSObject::SetDictionaryArgumentsElement(holder, index(), value, |
| 182 holder->HasSloppyArgumentsElements()); | 186 attributes); |
| 183 Handle<SeededNumberDictionary> d = JSObject::NormalizeElements(holder); | |
| 184 // TODO(verwaest): Move this into NormalizeElements. | |
| 185 d->set_requires_slow_elements(); | |
| 186 if (holder->HasDictionaryElements()) { | |
| 187 JSObject::SetDictionaryElement(holder, index(), value, attributes); | |
| 188 } else { | |
| 189 JSObject::SetSloppyArgumentsElement(holder, index(), value, attributes); | |
| 190 } | |
| 191 } | 187 } |
| 192 } else if (holder_map_->is_dictionary_map()) { | 188 } else if (holder_map_->is_dictionary_map()) { |
| 193 PropertyDetails details(attributes, v8::internal::DATA, 0, | 189 PropertyDetails details(attributes, v8::internal::DATA, 0, |
| 194 PropertyCellType::kMutable); | 190 PropertyCellType::kMutable); |
| 195 JSObject::SetNormalizedProperty(holder, name(), value, details); | 191 JSObject::SetNormalizedProperty(holder, name(), value, details); |
| 196 } else { | 192 } else { |
| 197 holder_map_ = Map::ReconfigureExistingProperty( | 193 holder_map_ = Map::ReconfigureExistingProperty( |
| 198 holder_map_, descriptor_number(), i::kData, attributes); | 194 holder_map_, descriptor_number(), i::kData, attributes); |
| 199 holder_map_ = | 195 holder_map_ = |
| 200 Map::PrepareForDataProperty(holder_map_, descriptor_number(), value); | 196 Map::PrepareForDataProperty(holder_map_, descriptor_number(), value); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 case InterceptorState::kSkipNonMasking: | 499 case InterceptorState::kSkipNonMasking: |
| 504 return true; | 500 return true; |
| 505 case InterceptorState::kProcessNonMasking: | 501 case InterceptorState::kProcessNonMasking: |
| 506 return false; | 502 return false; |
| 507 } | 503 } |
| 508 } | 504 } |
| 509 return interceptor_state_ == InterceptorState::kProcessNonMasking; | 505 return interceptor_state_ == InterceptorState::kProcessNonMasking; |
| 510 } | 506 } |
| 511 } // namespace internal | 507 } // namespace internal |
| 512 } // namespace v8 | 508 } // namespace v8 |
| OLD | NEW |