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/lookup.h" | 5 #include "src/lookup.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/elements.h" | 9 #include "src/elements.h" |
10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 } | 510 } |
511 | 511 |
512 | 512 |
513 void LookupIterator::WriteDataValue(Handle<Object> value) { | 513 void LookupIterator::WriteDataValue(Handle<Object> value) { |
514 DCHECK_EQ(DATA, state_); | 514 DCHECK_EQ(DATA, state_); |
515 Handle<JSReceiver> holder = GetHolder<JSReceiver>(); | 515 Handle<JSReceiver> holder = GetHolder<JSReceiver>(); |
516 if (IsElement()) { | 516 if (IsElement()) { |
517 Handle<JSObject> object = Handle<JSObject>::cast(holder); | 517 Handle<JSObject> object = Handle<JSObject>::cast(holder); |
518 ElementsAccessor* accessor = object->GetElementsAccessor(); | 518 ElementsAccessor* accessor = object->GetElementsAccessor(); |
519 accessor->Set(object, number_, *value); | 519 accessor->Set(object, number_, *value); |
| 520 } else if (holder->HasFastProperties()) { |
| 521 if (property_details_.type() == v8::internal::DATA) { |
| 522 JSObject::cast(*holder)->WriteToField(descriptor_number(), |
| 523 property_details_, *value); |
| 524 } else { |
| 525 DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type()); |
| 526 } |
520 } else if (holder->IsJSGlobalObject()) { | 527 } else if (holder->IsJSGlobalObject()) { |
521 Handle<GlobalDictionary> property_dictionary = | 528 Handle<GlobalDictionary> property_dictionary = |
522 handle(JSObject::cast(*holder)->global_dictionary()); | 529 handle(JSObject::cast(*holder)->global_dictionary()); |
523 PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), value, | 530 PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), value, |
524 property_details_); | 531 property_details_); |
525 } else if (!holder->HasFastProperties()) { | 532 } else { |
526 NameDictionary* property_dictionary = holder->property_dictionary(); | 533 NameDictionary* property_dictionary = holder->property_dictionary(); |
527 property_dictionary->ValueAtPut(dictionary_entry(), *value); | 534 property_dictionary->ValueAtPut(dictionary_entry(), *value); |
528 } else if (property_details_.type() == v8::internal::DATA) { | |
529 JSObject::cast(*holder)->WriteToField(descriptor_number(), *value); | |
530 } else { | |
531 DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type()); | |
532 } | 535 } |
533 } | 536 } |
534 | 537 |
535 | 538 |
536 bool LookupIterator::HasInterceptor(Map* map) const { | 539 bool LookupIterator::HasInterceptor(Map* map) const { |
537 if (IsElement()) return map->has_indexed_interceptor(); | 540 if (IsElement()) return map->has_indexed_interceptor(); |
538 return map->has_named_interceptor(); | 541 return map->has_named_interceptor(); |
539 } | 542 } |
540 | 543 |
541 | 544 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 // Fall through. | 677 // Fall through. |
675 default: | 678 default: |
676 return NOT_FOUND; | 679 return NOT_FOUND; |
677 } | 680 } |
678 UNREACHABLE(); | 681 UNREACHABLE(); |
679 return state_; | 682 return state_; |
680 } | 683 } |
681 | 684 |
682 } // namespace internal | 685 } // namespace internal |
683 } // namespace v8 | 686 } // namespace v8 |
OLD | NEW |