| 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 5807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5818 LocalLookupRealNamedProperty(name, &result); | 5818 LocalLookupRealNamedProperty(name, &result); |
| 5819 if (result.IsValid()) return GetProperty(receiver, &result, name, attributes); | 5819 if (result.IsValid()) return GetProperty(receiver, &result, name, attributes); |
| 5820 // Continue searching via the prototype chain. | 5820 // Continue searching via the prototype chain. |
| 5821 Object* pt = GetPrototype(); | 5821 Object* pt = GetPrototype(); |
| 5822 *attributes = ABSENT; | 5822 *attributes = ABSENT; |
| 5823 if (pt == Heap::null_value()) return Heap::undefined_value(); | 5823 if (pt == Heap::null_value()) return Heap::undefined_value(); |
| 5824 return pt->GetPropertyWithReceiver(receiver, name, attributes); | 5824 return pt->GetPropertyWithReceiver(receiver, name, attributes); |
| 5825 } | 5825 } |
| 5826 | 5826 |
| 5827 | 5827 |
| 5828 Object* JSObject::GetPropertyWithInterceptorProper( | 5828 bool JSObject::GetPropertyWithInterceptorProper( |
| 5829 JSObject* receiver, | 5829 JSObject* receiver, |
| 5830 String* name, | 5830 String* name, |
| 5831 PropertyAttributes* attributes) { | 5831 PropertyAttributes* attributes, |
| 5832 Object** result_object) { |
| 5832 HandleScope scope; | 5833 HandleScope scope; |
| 5833 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); | 5834 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); |
| 5834 Handle<JSObject> receiver_handle(receiver); | 5835 Handle<JSObject> receiver_handle(receiver); |
| 5835 Handle<JSObject> holder_handle(this); | 5836 Handle<JSObject> holder_handle(this); |
| 5836 Handle<String> name_handle(name); | 5837 Handle<String> name_handle(name); |
| 5837 Handle<Object> data_handle(interceptor->data()); | 5838 Handle<Object> data_handle(interceptor->data()); |
| 5838 | 5839 |
| 5839 if (!interceptor->getter()->IsUndefined()) { | 5840 if (!interceptor->getter()->IsUndefined()) { |
| 5840 v8::NamedPropertyGetter getter = | 5841 v8::NamedPropertyGetter getter = |
| 5841 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); | 5842 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); |
| 5842 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); | 5843 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); |
| 5843 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), | 5844 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), |
| 5844 v8::Utils::ToLocal(data_handle), | 5845 v8::Utils::ToLocal(data_handle), |
| 5845 v8::Utils::ToLocal(holder_handle)); | 5846 v8::Utils::ToLocal(holder_handle)); |
| 5846 v8::Handle<v8::Value> result; | 5847 v8::Handle<v8::Value> result; |
| 5847 { | 5848 { |
| 5848 // Leaving JavaScript. | 5849 // Leaving JavaScript. |
| 5849 VMState state(EXTERNAL); | 5850 VMState state(EXTERNAL); |
| 5850 result = getter(v8::Utils::ToLocal(name_handle), info); | 5851 result = getter(v8::Utils::ToLocal(name_handle), info); |
| 5851 } | 5852 } |
| 5852 if (!Top::has_scheduled_exception() && !result.IsEmpty()) { | 5853 if (Top::has_scheduled_exception()) { |
| 5854 return false; |
| 5855 } |
| 5856 if (!result.IsEmpty()) { |
| 5853 *attributes = NONE; | 5857 *attributes = NONE; |
| 5854 return *v8::Utils::OpenHandle(*result); | 5858 *result_object = *v8::Utils::OpenHandle(*result); |
| 5859 return true; |
| 5855 } | 5860 } |
| 5856 } | 5861 } |
| 5857 | 5862 |
| 5858 *attributes = ABSENT; | 5863 return false; |
| 5859 return Heap::undefined_value(); | |
| 5860 } | 5864 } |
| 5861 | 5865 |
| 5862 | 5866 |
| 5863 Object* JSObject::GetInterceptorPropertyWithLookupHint( | 5867 Object* JSObject::GetInterceptorPropertyWithLookupHint( |
| 5864 JSObject* receiver, | 5868 JSObject* receiver, |
| 5865 Smi* lookup_hint, | 5869 Smi* lookup_hint, |
| 5866 String* name, | 5870 String* name, |
| 5867 PropertyAttributes* attributes) { | 5871 PropertyAttributes* attributes) { |
| 5868 HandleScope scope; | 5872 HandleScope scope; |
| 5869 Handle<JSObject> receiver_handle(receiver); | 5873 Handle<JSObject> receiver_handle(receiver); |
| 5870 Handle<JSObject> holder_handle(this); | 5874 Handle<JSObject> holder_handle(this); |
| 5871 Handle<String> name_handle(name); | 5875 Handle<String> name_handle(name); |
| 5872 | 5876 |
| 5873 Object* result = GetPropertyWithInterceptorProper(receiver, | 5877 Object* result = NULL; |
| 5874 name, | 5878 if (GetPropertyWithInterceptorProper(receiver, name, attributes, &result)) { |
| 5875 attributes); | |
| 5876 if (*attributes != ABSENT) { | |
| 5877 return result; | 5879 return result; |
| 5880 } else { |
| 5881 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 5878 } | 5882 } |
| 5879 RETURN_IF_SCHEDULED_EXCEPTION(); | |
| 5880 | 5883 |
| 5881 int property_index = lookup_hint->value(); | 5884 int property_index = lookup_hint->value(); |
| 5882 if (property_index >= 0) { | 5885 if (property_index >= 0) { |
| 5883 result = holder_handle->FastPropertyAt(property_index); | 5886 result = holder_handle->FastPropertyAt(property_index); |
| 5884 } else { | 5887 } else { |
| 5885 switch (property_index) { | 5888 switch (property_index) { |
| 5886 case kLookupInPrototype: { | 5889 case kLookupInPrototype: { |
| 5887 Object* pt = holder_handle->GetPrototype(); | 5890 Object* pt = holder_handle->GetPrototype(); |
| 5888 *attributes = ABSENT; | 5891 *attributes = ABSENT; |
| 5889 if (pt == Heap::null_value()) return Heap::undefined_value(); | 5892 if (pt == Heap::null_value()) return Heap::undefined_value(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5914 | 5917 |
| 5915 Object* JSObject::GetPropertyWithInterceptor( | 5918 Object* JSObject::GetPropertyWithInterceptor( |
| 5916 JSObject* receiver, | 5919 JSObject* receiver, |
| 5917 String* name, | 5920 String* name, |
| 5918 PropertyAttributes* attributes) { | 5921 PropertyAttributes* attributes) { |
| 5919 HandleScope scope; | 5922 HandleScope scope; |
| 5920 Handle<JSObject> receiver_handle(receiver); | 5923 Handle<JSObject> receiver_handle(receiver); |
| 5921 Handle<JSObject> holder_handle(this); | 5924 Handle<JSObject> holder_handle(this); |
| 5922 Handle<String> name_handle(name); | 5925 Handle<String> name_handle(name); |
| 5923 | 5926 |
| 5924 Object* result = GetPropertyWithInterceptorProper(receiver, name, attributes); | 5927 Object* result = NULL; |
| 5925 if (*attributes != ABSENT) { | 5928 if (GetPropertyWithInterceptorProper(receiver, name, attributes, &result)) { |
| 5926 return result; | 5929 return result; |
| 5930 } else { |
| 5931 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 5927 } | 5932 } |
| 5928 RETURN_IF_SCHEDULED_EXCEPTION(); | |
| 5929 | 5933 |
| 5930 result = holder_handle->GetPropertyPostInterceptor( | 5934 result = holder_handle->GetPropertyPostInterceptor( |
| 5931 *receiver_handle, | 5935 *receiver_handle, |
| 5932 *name_handle, | 5936 *name_handle, |
| 5933 attributes); | 5937 attributes); |
| 5934 RETURN_IF_SCHEDULED_EXCEPTION(); | 5938 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 5935 return result; | 5939 return result; |
| 5936 } | 5940 } |
| 5937 | 5941 |
| 5938 | 5942 |
| (...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7706 if (break_point_objects()->IsUndefined()) return 0; | 7710 if (break_point_objects()->IsUndefined()) return 0; |
| 7707 // Single beak point. | 7711 // Single beak point. |
| 7708 if (!break_point_objects()->IsFixedArray()) return 1; | 7712 if (!break_point_objects()->IsFixedArray()) return 1; |
| 7709 // Multiple break points. | 7713 // Multiple break points. |
| 7710 return FixedArray::cast(break_point_objects())->length(); | 7714 return FixedArray::cast(break_point_objects())->length(); |
| 7711 } | 7715 } |
| 7712 #endif | 7716 #endif |
| 7713 | 7717 |
| 7714 | 7718 |
| 7715 } } // namespace v8::internal | 7719 } } // namespace v8::internal |
| OLD | NEW |