OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 5770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5781 LocalLookupRealNamedProperty(name, &result); | 5781 LocalLookupRealNamedProperty(name, &result); |
5782 if (result.IsValid()) return GetProperty(receiver, &result, name, attributes); | 5782 if (result.IsValid()) return GetProperty(receiver, &result, name, attributes); |
5783 // Continue searching via the prototype chain. | 5783 // Continue searching via the prototype chain. |
5784 Object* pt = GetPrototype(); | 5784 Object* pt = GetPrototype(); |
5785 *attributes = ABSENT; | 5785 *attributes = ABSENT; |
5786 if (pt == Heap::null_value()) return Heap::undefined_value(); | 5786 if (pt == Heap::null_value()) return Heap::undefined_value(); |
5787 return pt->GetPropertyWithReceiver(receiver, name, attributes); | 5787 return pt->GetPropertyWithReceiver(receiver, name, attributes); |
5788 } | 5788 } |
5789 | 5789 |
5790 | 5790 |
5791 bool JSObject::GetPropertyWithInterceptorProper( | 5791 Object* JSObject::GetPropertyWithInterceptorProper( |
5792 JSObject* receiver, | 5792 JSObject* receiver, |
5793 String* name, | 5793 String* name, |
5794 PropertyAttributes* attributes, | 5794 PropertyAttributes* attributes) { |
5795 Object** result_object) { | |
5796 HandleScope scope; | 5795 HandleScope scope; |
5797 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); | 5796 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); |
5798 Handle<JSObject> receiver_handle(receiver); | 5797 Handle<JSObject> receiver_handle(receiver); |
5799 Handle<JSObject> holder_handle(this); | 5798 Handle<JSObject> holder_handle(this); |
5800 Handle<String> name_handle(name); | 5799 Handle<String> name_handle(name); |
5801 Handle<Object> data_handle(interceptor->data()); | 5800 Handle<Object> data_handle(interceptor->data()); |
5802 | 5801 |
5803 if (!interceptor->getter()->IsUndefined()) { | 5802 if (!interceptor->getter()->IsUndefined()) { |
5804 v8::NamedPropertyGetter getter = | 5803 v8::NamedPropertyGetter getter = |
5805 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); | 5804 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); |
5806 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); | 5805 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); |
5807 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), | 5806 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), |
5808 v8::Utils::ToLocal(data_handle), | 5807 v8::Utils::ToLocal(data_handle), |
5809 v8::Utils::ToLocal(holder_handle)); | 5808 v8::Utils::ToLocal(holder_handle)); |
5810 v8::Handle<v8::Value> result; | 5809 v8::Handle<v8::Value> result; |
5811 { | 5810 { |
5812 // Leaving JavaScript. | 5811 // Leaving JavaScript. |
5813 VMState state(EXTERNAL); | 5812 VMState state(EXTERNAL); |
5814 result = getter(v8::Utils::ToLocal(name_handle), info); | 5813 result = getter(v8::Utils::ToLocal(name_handle), info); |
5815 } | 5814 } |
5816 if (Top::has_scheduled_exception()) { | 5815 if (!Top::has_scheduled_exception() && !result.IsEmpty()) { |
5817 return false; | |
5818 } | |
5819 if (!result.IsEmpty()) { | |
5820 *attributes = NONE; | 5816 *attributes = NONE; |
5821 *result_object = *v8::Utils::OpenHandle(*result); | 5817 return *v8::Utils::OpenHandle(*result); |
5822 return true; | |
5823 } | 5818 } |
5824 } | 5819 } |
5825 | 5820 |
5826 return false; | 5821 *attributes = ABSENT; |
| 5822 return Heap::undefined_value(); |
5827 } | 5823 } |
5828 | 5824 |
5829 | 5825 |
5830 Object* JSObject::GetInterceptorPropertyWithLookupHint( | 5826 Object* JSObject::GetInterceptorPropertyWithLookupHint( |
5831 JSObject* receiver, | 5827 JSObject* receiver, |
5832 Smi* lookup_hint, | 5828 Smi* lookup_hint, |
5833 String* name, | 5829 String* name, |
5834 PropertyAttributes* attributes) { | 5830 PropertyAttributes* attributes) { |
5835 HandleScope scope; | 5831 HandleScope scope; |
5836 Handle<JSObject> receiver_handle(receiver); | 5832 Handle<JSObject> receiver_handle(receiver); |
5837 Handle<JSObject> holder_handle(this); | 5833 Handle<JSObject> holder_handle(this); |
5838 Handle<String> name_handle(name); | 5834 Handle<String> name_handle(name); |
5839 | 5835 |
5840 Object* result = NULL; | 5836 Object* result = GetPropertyWithInterceptorProper(receiver, |
5841 if (GetPropertyWithInterceptorProper(receiver, name, attributes, &result)) { | 5837 name, |
| 5838 attributes); |
| 5839 if (*attributes != ABSENT) { |
5842 return result; | 5840 return result; |
5843 } else { | |
5844 RETURN_IF_SCHEDULED_EXCEPTION(); | |
5845 } | 5841 } |
| 5842 RETURN_IF_SCHEDULED_EXCEPTION(); |
5846 | 5843 |
5847 int property_index = lookup_hint->value(); | 5844 int property_index = lookup_hint->value(); |
5848 if (property_index >= 0) { | 5845 if (property_index >= 0) { |
5849 result = holder_handle->FastPropertyAt(property_index); | 5846 result = holder_handle->FastPropertyAt(property_index); |
5850 } else { | 5847 } else { |
5851 switch (property_index) { | 5848 switch (property_index) { |
5852 case kLookupInPrototype: { | 5849 case kLookupInPrototype: { |
5853 Object* pt = holder_handle->GetPrototype(); | 5850 Object* pt = holder_handle->GetPrototype(); |
5854 *attributes = ABSENT; | 5851 *attributes = ABSENT; |
5855 if (pt == Heap::null_value()) return Heap::undefined_value(); | 5852 if (pt == Heap::null_value()) return Heap::undefined_value(); |
(...skipping 24 matching lines...) Expand all Loading... |
5880 | 5877 |
5881 Object* JSObject::GetPropertyWithInterceptor( | 5878 Object* JSObject::GetPropertyWithInterceptor( |
5882 JSObject* receiver, | 5879 JSObject* receiver, |
5883 String* name, | 5880 String* name, |
5884 PropertyAttributes* attributes) { | 5881 PropertyAttributes* attributes) { |
5885 HandleScope scope; | 5882 HandleScope scope; |
5886 Handle<JSObject> receiver_handle(receiver); | 5883 Handle<JSObject> receiver_handle(receiver); |
5887 Handle<JSObject> holder_handle(this); | 5884 Handle<JSObject> holder_handle(this); |
5888 Handle<String> name_handle(name); | 5885 Handle<String> name_handle(name); |
5889 | 5886 |
5890 Object* result = NULL; | 5887 Object* result = GetPropertyWithInterceptorProper(receiver, name, attributes); |
5891 if (GetPropertyWithInterceptorProper(receiver, name, attributes, &result)) { | 5888 if (*attributes != ABSENT) { |
5892 return result; | 5889 return result; |
5893 } else { | |
5894 RETURN_IF_SCHEDULED_EXCEPTION(); | |
5895 } | 5890 } |
| 5891 RETURN_IF_SCHEDULED_EXCEPTION(); |
5896 | 5892 |
5897 result = holder_handle->GetPropertyPostInterceptor( | 5893 result = holder_handle->GetPropertyPostInterceptor( |
5898 *receiver_handle, | 5894 *receiver_handle, |
5899 *name_handle, | 5895 *name_handle, |
5900 attributes); | 5896 attributes); |
5901 RETURN_IF_SCHEDULED_EXCEPTION(); | 5897 RETURN_IF_SCHEDULED_EXCEPTION(); |
5902 return result; | 5898 return result; |
5903 } | 5899 } |
5904 | 5900 |
5905 | 5901 |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7639 // No break point. | 7635 // No break point. |
7640 if (break_point_objects()->IsUndefined()) return 0; | 7636 if (break_point_objects()->IsUndefined()) return 0; |
7641 // Single beak point. | 7637 // Single beak point. |
7642 if (!break_point_objects()->IsFixedArray()) return 1; | 7638 if (!break_point_objects()->IsFixedArray()) return 1; |
7643 // Multiple break points. | 7639 // Multiple break points. |
7644 return FixedArray::cast(break_point_objects())->length(); | 7640 return FixedArray::cast(break_point_objects())->length(); |
7645 } | 7641 } |
7646 #endif | 7642 #endif |
7647 | 7643 |
7648 } } // namespace v8::internal | 7644 } } // namespace v8::internal |
OLD | NEW |