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/runtime/runtime.h" | 10 #include "src/runtime/runtime.h" |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj); | 598 Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj); |
599 Handle<Name> key = Handle<Name>::cast(key_obj); | 599 Handle<Name> key = Handle<Name>::cast(key_obj); |
600 if (!receiver->HasFastProperties()) { | 600 if (!receiver->HasFastProperties()) { |
601 // Attempt dictionary lookup. | 601 // Attempt dictionary lookup. |
602 NameDictionary* dictionary = receiver->property_dictionary(); | 602 NameDictionary* dictionary = receiver->property_dictionary(); |
603 int entry = dictionary->FindEntry(key); | 603 int entry = dictionary->FindEntry(key); |
604 if ((entry != NameDictionary::kNotFound) && | 604 if ((entry != NameDictionary::kNotFound) && |
605 (dictionary->DetailsAt(entry).type() == DATA)) { | 605 (dictionary->DetailsAt(entry).type() == DATA)) { |
606 Object* value = dictionary->ValueAt(entry); | 606 Object* value = dictionary->ValueAt(entry); |
607 if (!receiver->IsGlobalObject()) return value; | 607 if (!receiver->IsGlobalObject()) return value; |
| 608 DCHECK(value->IsPropertyCell()); |
608 value = PropertyCell::cast(value)->value(); | 609 value = PropertyCell::cast(value)->value(); |
609 if (!value->IsTheHole()) return value; | 610 if (!value->IsTheHole()) return value; |
610 // If value is the hole (meaning, absent) do the general lookup. | 611 // If value is the hole (meaning, absent) do the general lookup. |
611 } | 612 } |
612 } | 613 } |
613 } else if (key_obj->IsSmi()) { | 614 } else if (key_obj->IsSmi()) { |
614 // JSObject without a name key. If the key is a Smi, check for a | 615 // JSObject without a name key. If the key is a Smi, check for a |
615 // definite out-of-bounds access to elements, which is a strong indicator | 616 // definite out-of-bounds access to elements, which is a strong indicator |
616 // that subsequent accesses will also call the runtime. Proactively | 617 // that subsequent accesses will also call the runtime. Proactively |
617 // transition elements to FAST_*_ELEMENTS to avoid excessive boxing of | 618 // transition elements to FAST_*_ELEMENTS to avoid excessive boxing of |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 1580 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
1580 | 1581 |
1581 RETURN_FAILURE_ON_EXCEPTION( | 1582 RETURN_FAILURE_ON_EXCEPTION( |
1582 isolate, | 1583 isolate, |
1583 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), | 1584 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), |
1584 setter, attrs)); | 1585 setter, attrs)); |
1585 return isolate->heap()->undefined_value(); | 1586 return isolate->heap()->undefined_value(); |
1586 } | 1587 } |
1587 } | 1588 } |
1588 } // namespace v8::internal | 1589 } // namespace v8::internal |
OLD | NEW |