OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4687 obj != heap->null_value(); | 4687 obj != heap->null_value(); |
4688 obj = JSObject::cast(obj)->GetPrototype()) { | 4688 obj = JSObject::cast(obj)->GetPrototype()) { |
4689 JSObject* js_object = JSObject::cast(obj); | 4689 JSObject* js_object = JSObject::cast(obj); |
4690 if (js_object->HasDictionaryElements()) { | 4690 if (js_object->HasDictionaryElements()) { |
4691 SeededNumberDictionary* dictionary = js_object->element_dictionary(); | 4691 SeededNumberDictionary* dictionary = js_object->element_dictionary(); |
4692 int entry = dictionary->FindEntry(index); | 4692 int entry = dictionary->FindEntry(index); |
4693 if (entry != SeededNumberDictionary::kNotFound) { | 4693 if (entry != SeededNumberDictionary::kNotFound) { |
4694 Object* element = dictionary->ValueAt(entry); | 4694 Object* element = dictionary->ValueAt(entry); |
4695 if (dictionary->DetailsAt(entry).type() == CALLBACKS && | 4695 if (dictionary->DetailsAt(entry).type() == CALLBACKS && |
4696 element->IsAccessorPair()) { | 4696 element->IsAccessorPair()) { |
4697 return AccessorPair::cast(element)->get(component); | 4697 return AccessorPair::cast(element)->SafeGet(component); |
4698 } | 4698 } |
4699 } | 4699 } |
4700 } | 4700 } |
4701 } | 4701 } |
4702 } else { | 4702 } else { |
4703 for (Object* obj = this; | 4703 for (Object* obj = this; |
4704 obj != heap->null_value(); | 4704 obj != heap->null_value(); |
4705 obj = JSObject::cast(obj)->GetPrototype()) { | 4705 obj = JSObject::cast(obj)->GetPrototype()) { |
4706 LookupResult result(heap->isolate()); | 4706 LookupResult result(heap->isolate()); |
4707 JSObject::cast(obj)->LocalLookup(name, &result); | 4707 JSObject::cast(obj)->LocalLookup(name, &result); |
4708 if (result.IsProperty()) { | 4708 if (result.IsProperty()) { |
4709 if (result.IsReadOnly()) return heap->undefined_value(); | 4709 if (result.IsReadOnly()) return heap->undefined_value(); |
4710 if (result.type() == CALLBACKS) { | 4710 if (result.type() == CALLBACKS) { |
4711 Object* obj = result.GetCallbackObject(); | 4711 Object* obj = result.GetCallbackObject(); |
4712 if (obj->IsAccessorPair()) { | 4712 if (obj->IsAccessorPair()) { |
4713 return AccessorPair::cast(obj)->get(component); | 4713 return AccessorPair::cast(obj)->SafeGet(component); |
4714 } | 4714 } |
4715 } | 4715 } |
4716 } | 4716 } |
4717 } | 4717 } |
4718 } | 4718 } |
4719 return heap->undefined_value(); | 4719 return heap->undefined_value(); |
4720 } | 4720 } |
4721 | 4721 |
4722 | 4722 |
4723 Object* JSObject::SlowReverseLookup(Object* value) { | 4723 Object* JSObject::SlowReverseLookup(Object* value) { |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5940 AccessorPair* copy; | 5940 AccessorPair* copy; |
5941 { MaybeObject* maybe_copy = heap->AllocateAccessorPair(); | 5941 { MaybeObject* maybe_copy = heap->AllocateAccessorPair(); |
5942 if (!maybe_copy->To(©)) return maybe_copy; | 5942 if (!maybe_copy->To(©)) return maybe_copy; |
5943 } | 5943 } |
5944 copy->set_getter(getter()->IsMap() ? heap->the_hole_value() : getter()); | 5944 copy->set_getter(getter()->IsMap() ? heap->the_hole_value() : getter()); |
5945 copy->set_setter(setter()->IsMap() ? heap->the_hole_value() : setter()); | 5945 copy->set_setter(setter()->IsMap() ? heap->the_hole_value() : setter()); |
5946 return copy; | 5946 return copy; |
5947 } | 5947 } |
5948 | 5948 |
5949 | 5949 |
| 5950 Object* AccessorPair::SafeGet(AccessorComponent component) { |
| 5951 Object* accessor = get(component); |
| 5952 return accessor->IsTheHole() ? GetHeap()->undefined_value() : accessor; |
| 5953 } |
| 5954 |
| 5955 |
5950 MaybeObject* DeoptimizationInputData::Allocate(int deopt_entry_count, | 5956 MaybeObject* DeoptimizationInputData::Allocate(int deopt_entry_count, |
5951 PretenureFlag pretenure) { | 5957 PretenureFlag pretenure) { |
5952 ASSERT(deopt_entry_count > 0); | 5958 ASSERT(deopt_entry_count > 0); |
5953 return HEAP->AllocateFixedArray(LengthFor(deopt_entry_count), | 5959 return HEAP->AllocateFixedArray(LengthFor(deopt_entry_count), |
5954 pretenure); | 5960 pretenure); |
5955 } | 5961 } |
5956 | 5962 |
5957 | 5963 |
5958 MaybeObject* DeoptimizationOutputData::Allocate(int number_of_deopt_points, | 5964 MaybeObject* DeoptimizationOutputData::Allocate(int number_of_deopt_points, |
5959 PretenureFlag pretenure) { | 5965 PretenureFlag pretenure) { |
(...skipping 6997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12957 if (break_point_objects()->IsUndefined()) return 0; | 12963 if (break_point_objects()->IsUndefined()) return 0; |
12958 // Single break point. | 12964 // Single break point. |
12959 if (!break_point_objects()->IsFixedArray()) return 1; | 12965 if (!break_point_objects()->IsFixedArray()) return 1; |
12960 // Multiple break points. | 12966 // Multiple break points. |
12961 return FixedArray::cast(break_point_objects())->length(); | 12967 return FixedArray::cast(break_point_objects())->length(); |
12962 } | 12968 } |
12963 #endif // ENABLE_DEBUGGER_SUPPORT | 12969 #endif // ENABLE_DEBUGGER_SUPPORT |
12964 | 12970 |
12965 | 12971 |
12966 } } // namespace v8::internal | 12972 } } // namespace v8::internal |
OLD | NEW |