Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: src/lookup.cc

Issue 1180753005: Cleanup typed array setters, the property is guaranteed to be there. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (attributes == NONE && !holder->HasDictionaryElements() &&
177 !holder->HasDictionaryArgumentsElements()) { 177 !holder->HasDictionaryArgumentsElements()) {
178 ElementsAccessor* accessor = holder->GetElementsAccessor(); 178 ElementsAccessor* accessor = holder->GetElementsAccessor();
179 accessor->Set(holder, index(), value); 179 accessor->Set(handle(holder->elements()), index(), value);
180 } else { 180 } else {
181 DCHECK(holder->HasFastElements() || holder->HasDictionaryElements() || 181 DCHECK(holder->HasFastElements() || holder->HasDictionaryElements() ||
182 holder->HasSloppyArgumentsElements()); 182 holder->HasSloppyArgumentsElements());
183 Handle<SeededNumberDictionary> d = JSObject::NormalizeElements(holder); 183 Handle<SeededNumberDictionary> d = JSObject::NormalizeElements(holder);
184 // TODO(verwaest): Move this into NormalizeElements. 184 // TODO(verwaest): Move this into NormalizeElements.
185 d->set_requires_slow_elements(); 185 d->set_requires_slow_elements();
186 if (holder->HasDictionaryElements()) { 186 if (holder->HasDictionaryElements()) {
187 JSObject::SetDictionaryElement(holder, index(), value, attributes); 187 JSObject::SetDictionaryElement(holder, index(), value, attributes);
188 } else { 188 } else {
189 JSObject::SetSloppyArgumentsElement(holder, index(), value, attributes); 189 JSObject::SetSloppyArgumentsElement(holder, index(), value, attributes);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 Handle<Object> value = FetchValue(); 417 Handle<Object> value = FetchValue();
418 return value; 418 return value;
419 } 419 }
420 420
421 421
422 void LookupIterator::WriteDataValue(Handle<Object> value) { 422 void LookupIterator::WriteDataValue(Handle<Object> value) {
423 DCHECK_EQ(DATA, state_); 423 DCHECK_EQ(DATA, state_);
424 Handle<JSObject> holder = GetHolder<JSObject>(); 424 Handle<JSObject> holder = GetHolder<JSObject>();
425 if (IsElement()) { 425 if (IsElement()) {
426 ElementsAccessor* accessor = holder->GetElementsAccessor(); 426 ElementsAccessor* accessor = holder->GetElementsAccessor();
427 accessor->Set(holder, index_, value); 427 accessor->Set(handle(holder->elements()), index_, value);
428 } else if (holder->IsGlobalObject()) { 428 } else if (holder->IsGlobalObject()) {
429 Handle<GlobalDictionary> property_dictionary = 429 Handle<GlobalDictionary> property_dictionary =
430 handle(holder->global_dictionary()); 430 handle(holder->global_dictionary());
431 PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), value, 431 PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), value,
432 property_details_); 432 property_details_);
433 } else if (holder_map_->is_dictionary_map()) { 433 } else if (holder_map_->is_dictionary_map()) {
434 Handle<NameDictionary> property_dictionary = 434 Handle<NameDictionary> property_dictionary =
435 handle(holder->property_dictionary()); 435 handle(holder->property_dictionary());
436 property_dictionary->ValueAtPut(dictionary_entry(), *value); 436 property_dictionary->ValueAtPut(dictionary_entry(), *value);
437 } else if (property_details_.type() == v8::internal::DATA) { 437 } else if (property_details_.type() == v8::internal::DATA) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 case InterceptorState::kSkipNonMasking: 503 case InterceptorState::kSkipNonMasking:
504 return true; 504 return true;
505 case InterceptorState::kProcessNonMasking: 505 case InterceptorState::kProcessNonMasking:
506 return false; 506 return false;
507 } 507 }
508 } 508 }
509 return interceptor_state_ == InterceptorState::kProcessNonMasking; 509 return interceptor_state_ == InterceptorState::kProcessNonMasking;
510 } 510 }
511 } // namespace internal 511 } // namespace internal
512 } // namespace v8 512 } // namespace v8
OLDNEW
« src/elements.h ('K') | « src/elements.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698