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/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/debug.h" | 9 #include "src/debug.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 if (receiver_obj->IsJSObject()) { | 595 if (receiver_obj->IsJSObject()) { |
596 if (!receiver_obj->IsJSGlobalProxy() && | 596 if (!receiver_obj->IsJSGlobalProxy() && |
597 !receiver_obj->IsAccessCheckNeeded() && key_obj->IsName()) { | 597 !receiver_obj->IsAccessCheckNeeded() && key_obj->IsName()) { |
598 DisallowHeapAllocation no_allocation; | 598 DisallowHeapAllocation no_allocation; |
599 Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj); | 599 Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj); |
600 Handle<Name> key = Handle<Name>::cast(key_obj); | 600 Handle<Name> key = Handle<Name>::cast(key_obj); |
601 if (receiver->IsGlobalObject()) { | 601 if (receiver->IsGlobalObject()) { |
602 // Attempt dictionary lookup. | 602 // Attempt dictionary lookup. |
603 GlobalDictionary* dictionary = receiver->global_dictionary(); | 603 GlobalDictionary* dictionary = receiver->global_dictionary(); |
604 int entry = dictionary->FindEntry(key); | 604 int entry = dictionary->FindEntry(key); |
605 if ((entry != GlobalDictionary::kNotFound) && | 605 if (entry != GlobalDictionary::kNotFound) { |
606 (dictionary->DetailsAt(entry).type() == DATA)) { | 606 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); |
607 Object* value = dictionary->ValueAt(entry); | 607 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry)); |
608 DCHECK(value->IsPropertyCell()); | 608 if (cell->property_details().type() == DATA) { |
609 value = PropertyCell::cast(value)->value(); | 609 Object* value = cell->value(); |
610 if (!value->IsTheHole()) return value; | 610 if (!value->IsTheHole()) return value; |
611 // If value is the hole (meaning, absent) do the general lookup. | 611 // If value is the hole (meaning, absent) do the general lookup. |
| 612 } |
612 } | 613 } |
613 } else if (!receiver->HasFastProperties()) { | 614 } else if (!receiver->HasFastProperties()) { |
614 // Attempt dictionary lookup. | 615 // Attempt dictionary lookup. |
615 NameDictionary* dictionary = receiver->property_dictionary(); | 616 NameDictionary* dictionary = receiver->property_dictionary(); |
616 int entry = dictionary->FindEntry(key); | 617 int entry = dictionary->FindEntry(key); |
617 if ((entry != NameDictionary::kNotFound) && | 618 if ((entry != NameDictionary::kNotFound) && |
618 (dictionary->DetailsAt(entry).type() == DATA)) { | 619 (dictionary->DetailsAt(entry).type() == DATA)) { |
619 Object* value = dictionary->ValueAt(entry); | 620 Object* value = dictionary->ValueAt(entry); |
620 return value; | 621 return value; |
621 } | 622 } |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 1587 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
1587 | 1588 |
1588 RETURN_FAILURE_ON_EXCEPTION( | 1589 RETURN_FAILURE_ON_EXCEPTION( |
1589 isolate, | 1590 isolate, |
1590 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), | 1591 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), |
1591 setter, attrs)); | 1592 setter, attrs)); |
1592 return isolate->heap()->undefined_value(); | 1593 return isolate->heap()->undefined_value(); |
1593 } | 1594 } |
1594 } // namespace internal | 1595 } // namespace internal |
1595 } // namespace v8 | 1596 } // namespace v8 |
OLD | NEW |