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 6010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6021 LocalLookupRealNamedProperty(name, &result); | 6021 LocalLookupRealNamedProperty(name, &result); |
6022 if (result.IsValid()) return GetProperty(receiver, &result, name, attributes); | 6022 if (result.IsValid()) return GetProperty(receiver, &result, name, attributes); |
6023 // Continue searching via the prototype chain. | 6023 // Continue searching via the prototype chain. |
6024 Object* pt = GetPrototype(); | 6024 Object* pt = GetPrototype(); |
6025 *attributes = ABSENT; | 6025 *attributes = ABSENT; |
6026 if (pt == Heap::null_value()) return Heap::undefined_value(); | 6026 if (pt == Heap::null_value()) return Heap::undefined_value(); |
6027 return pt->GetPropertyWithReceiver(receiver, name, attributes); | 6027 return pt->GetPropertyWithReceiver(receiver, name, attributes); |
6028 } | 6028 } |
6029 | 6029 |
6030 | 6030 |
6031 Object* JSObject::GetPropertyWithInterceptorProper( | 6031 Object* JSObject::GetPropertyWithInterceptor( |
6032 JSObject* receiver, | 6032 JSObject* receiver, |
6033 String* name, | 6033 String* name, |
6034 PropertyAttributes* attributes) { | 6034 PropertyAttributes* attributes) { |
| 6035 InterceptorInfo* interceptor = GetNamedInterceptor(); |
6035 HandleScope scope; | 6036 HandleScope scope; |
6036 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); | |
6037 Handle<JSObject> receiver_handle(receiver); | 6037 Handle<JSObject> receiver_handle(receiver); |
6038 Handle<JSObject> holder_handle(this); | 6038 Handle<JSObject> holder_handle(this); |
6039 Handle<String> name_handle(name); | 6039 Handle<String> name_handle(name); |
6040 Handle<Object> data_handle(interceptor->data()); | 6040 Handle<Object> data_handle(interceptor->data()); |
6041 | 6041 |
6042 if (!interceptor->getter()->IsUndefined()) { | 6042 if (!interceptor->getter()->IsUndefined()) { |
6043 v8::NamedPropertyGetter getter = | 6043 v8::NamedPropertyGetter getter = |
6044 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); | 6044 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); |
6045 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); | 6045 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); |
6046 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), | 6046 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), |
6047 v8::Utils::ToLocal(data_handle), | 6047 v8::Utils::ToLocal(data_handle), |
6048 v8::Utils::ToLocal(holder_handle)); | 6048 v8::Utils::ToLocal(holder_handle)); |
6049 v8::Handle<v8::Value> result; | 6049 v8::Handle<v8::Value> result; |
6050 { | 6050 { |
6051 // Leaving JavaScript. | 6051 // Leaving JavaScript. |
6052 VMState state(EXTERNAL); | 6052 VMState state(EXTERNAL); |
6053 result = getter(v8::Utils::ToLocal(name_handle), info); | 6053 result = getter(v8::Utils::ToLocal(name_handle), info); |
6054 } | 6054 } |
6055 if (!Top::has_scheduled_exception() && !result.IsEmpty()) { | 6055 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 6056 if (!result.IsEmpty()) { |
6056 *attributes = NONE; | 6057 *attributes = NONE; |
6057 return *v8::Utils::OpenHandle(*result); | 6058 return *v8::Utils::OpenHandle(*result); |
6058 } | 6059 } |
6059 } | 6060 } |
6060 | 6061 |
6061 *attributes = ABSENT; | 6062 Object* result = holder_handle->GetPropertyPostInterceptor( |
6062 return Heap::undefined_value(); | |
6063 } | |
6064 | |
6065 | |
6066 Object* JSObject::GetInterceptorPropertyWithLookupHint( | |
6067 JSObject* receiver, | |
6068 Smi* lookup_hint, | |
6069 String* name, | |
6070 PropertyAttributes* attributes) { | |
6071 HandleScope scope; | |
6072 Handle<JSObject> receiver_handle(receiver); | |
6073 Handle<JSObject> holder_handle(this); | |
6074 Handle<String> name_handle(name); | |
6075 | |
6076 Object* result = GetPropertyWithInterceptorProper(receiver, | |
6077 name, | |
6078 attributes); | |
6079 if (*attributes != ABSENT) { | |
6080 return result; | |
6081 } | |
6082 RETURN_IF_SCHEDULED_EXCEPTION(); | |
6083 | |
6084 int property_index = lookup_hint->value(); | |
6085 if (property_index >= 0) { | |
6086 result = holder_handle->FastPropertyAt(property_index); | |
6087 } else { | |
6088 switch (property_index) { | |
6089 case kLookupInPrototype: { | |
6090 Object* pt = holder_handle->GetPrototype(); | |
6091 *attributes = ABSENT; | |
6092 if (pt == Heap::null_value()) return Heap::undefined_value(); | |
6093 result = pt->GetPropertyWithReceiver( | |
6094 *receiver_handle, | |
6095 *name_handle, | |
6096 attributes); | |
6097 RETURN_IF_SCHEDULED_EXCEPTION(); | |
6098 } | |
6099 break; | |
6100 | |
6101 case kLookupInHolder: | |
6102 result = holder_handle->GetPropertyPostInterceptor( | |
6103 *receiver_handle, | |
6104 *name_handle, | |
6105 attributes); | |
6106 RETURN_IF_SCHEDULED_EXCEPTION(); | |
6107 break; | |
6108 | |
6109 default: | |
6110 UNREACHABLE(); | |
6111 } | |
6112 } | |
6113 | |
6114 return result; | |
6115 } | |
6116 | |
6117 | |
6118 Object* JSObject::GetPropertyWithInterceptor( | |
6119 JSObject* receiver, | |
6120 String* name, | |
6121 PropertyAttributes* attributes) { | |
6122 HandleScope scope; | |
6123 Handle<JSObject> receiver_handle(receiver); | |
6124 Handle<JSObject> holder_handle(this); | |
6125 Handle<String> name_handle(name); | |
6126 | |
6127 Object* result = GetPropertyWithInterceptorProper(receiver, name, attributes); | |
6128 if (*attributes != ABSENT) { | |
6129 return result; | |
6130 } | |
6131 RETURN_IF_SCHEDULED_EXCEPTION(); | |
6132 | |
6133 result = holder_handle->GetPropertyPostInterceptor( | |
6134 *receiver_handle, | 6063 *receiver_handle, |
6135 *name_handle, | 6064 *name_handle, |
6136 attributes); | 6065 attributes); |
6137 RETURN_IF_SCHEDULED_EXCEPTION(); | 6066 RETURN_IF_SCHEDULED_EXCEPTION(); |
6138 return result; | 6067 return result; |
6139 } | 6068 } |
6140 | 6069 |
6141 | 6070 |
6142 bool JSObject::HasRealNamedProperty(String* key) { | 6071 bool JSObject::HasRealNamedProperty(String* key) { |
6143 // Check access rights if needed. | 6072 // Check access rights if needed. |
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7997 if (break_point_objects()->IsUndefined()) return 0; | 7926 if (break_point_objects()->IsUndefined()) return 0; |
7998 // Single beak point. | 7927 // Single beak point. |
7999 if (!break_point_objects()->IsFixedArray()) return 1; | 7928 if (!break_point_objects()->IsFixedArray()) return 1; |
8000 // Multiple break points. | 7929 // Multiple break points. |
8001 return FixedArray::cast(break_point_objects())->length(); | 7930 return FixedArray::cast(break_point_objects())->length(); |
8002 } | 7931 } |
8003 #endif | 7932 #endif |
8004 | 7933 |
8005 | 7934 |
8006 } } // namespace v8::internal | 7935 } } // namespace v8::internal |
OLD | NEW |