| 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 5599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5610 LocalLookupRealNamedProperty(name, &result); | 5610 LocalLookupRealNamedProperty(name, &result); |
| 5611 if (result.IsValid()) return GetProperty(receiver, &result, name, attributes); | 5611 if (result.IsValid()) return GetProperty(receiver, &result, name, attributes); |
| 5612 // Continue searching via the prototype chain. | 5612 // Continue searching via the prototype chain. |
| 5613 Object* pt = GetPrototype(); | 5613 Object* pt = GetPrototype(); |
| 5614 *attributes = ABSENT; | 5614 *attributes = ABSENT; |
| 5615 if (pt == Heap::null_value()) return Heap::undefined_value(); | 5615 if (pt == Heap::null_value()) return Heap::undefined_value(); |
| 5616 return pt->GetPropertyWithReceiver(receiver, name, attributes); | 5616 return pt->GetPropertyWithReceiver(receiver, name, attributes); |
| 5617 } | 5617 } |
| 5618 | 5618 |
| 5619 | 5619 |
| 5620 Object* JSObject::GetPropertyWithInterceptorProper( | 5620 bool JSObject::GetPropertyWithInterceptorProper( |
| 5621 JSObject* receiver, | 5621 JSObject* receiver, |
| 5622 String* name, | 5622 String* name, |
| 5623 PropertyAttributes* attributes) { | 5623 PropertyAttributes* attributes, |
| 5624 Object** result_object) { |
| 5624 HandleScope scope; | 5625 HandleScope scope; |
| 5625 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); | 5626 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); |
| 5626 Handle<JSObject> receiver_handle(receiver); | 5627 Handle<JSObject> receiver_handle(receiver); |
| 5627 Handle<JSObject> holder_handle(this); | 5628 Handle<JSObject> holder_handle(this); |
| 5628 Handle<String> name_handle(name); | 5629 Handle<String> name_handle(name); |
| 5629 Handle<Object> data_handle(interceptor->data()); | 5630 Handle<Object> data_handle(interceptor->data()); |
| 5630 | 5631 |
| 5631 if (!interceptor->getter()->IsUndefined()) { | 5632 if (!interceptor->getter()->IsUndefined()) { |
| 5632 v8::NamedPropertyGetter getter = | 5633 v8::NamedPropertyGetter getter = |
| 5633 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); | 5634 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); |
| 5634 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); | 5635 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); |
| 5635 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), | 5636 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), |
| 5636 v8::Utils::ToLocal(data_handle), | 5637 v8::Utils::ToLocal(data_handle), |
| 5637 v8::Utils::ToLocal(holder_handle)); | 5638 v8::Utils::ToLocal(holder_handle)); |
| 5638 v8::Handle<v8::Value> result; | 5639 v8::Handle<v8::Value> result; |
| 5639 { | 5640 { |
| 5640 // Leaving JavaScript. | 5641 // Leaving JavaScript. |
| 5641 VMState state(EXTERNAL); | 5642 VMState state(EXTERNAL); |
| 5642 result = getter(v8::Utils::ToLocal(name_handle), info); | 5643 result = getter(v8::Utils::ToLocal(name_handle), info); |
| 5643 } | 5644 } |
| 5644 RETURN_IF_SCHEDULED_EXCEPTION(); | 5645 if (Top::has_scheduled_exception()) { |
| 5646 return false; |
| 5647 } |
| 5645 if (!result.IsEmpty()) { | 5648 if (!result.IsEmpty()) { |
| 5646 *attributes = NONE; | 5649 *attributes = NONE; |
| 5647 return *v8::Utils::OpenHandle(*result); | 5650 *result_object = *v8::Utils::OpenHandle(*result); |
| 5651 return true; |
| 5648 } | 5652 } |
| 5649 } | 5653 } |
| 5650 | 5654 |
| 5651 return NULL; | 5655 return false; |
| 5652 } | 5656 } |
| 5653 | 5657 |
| 5654 | 5658 |
| 5655 Object* JSObject::GetInterceptorPropertyWithLookupHint( | 5659 Object* JSObject::GetInterceptorPropertyWithLookupHint( |
| 5656 JSObject* receiver, | 5660 JSObject* receiver, |
| 5657 Smi* lookup_hint, | 5661 Smi* lookup_hint, |
| 5658 String* name, | 5662 String* name, |
| 5659 PropertyAttributes* attributes) { | 5663 PropertyAttributes* attributes) { |
| 5660 HandleScope scope; | 5664 HandleScope scope; |
| 5661 Handle<JSObject> receiver_handle(receiver); | 5665 Handle<JSObject> receiver_handle(receiver); |
| 5662 Handle<JSObject> holder_handle(this); | 5666 Handle<JSObject> holder_handle(this); |
| 5663 Handle<String> name_handle(name); | 5667 Handle<String> name_handle(name); |
| 5664 | 5668 |
| 5665 Object* result = GetPropertyWithInterceptorProper(receiver, name, attributes); | 5669 Object* result = NULL; |
| 5666 if (result) return result; | 5670 if (GetPropertyWithInterceptorProper(receiver, name, attributes, &result)) { |
| 5671 return result; |
| 5672 } else { |
| 5673 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 5674 } |
| 5667 | 5675 |
| 5668 int property_index = lookup_hint->value(); | 5676 int property_index = lookup_hint->value(); |
| 5669 if (property_index >= 0) { | 5677 if (property_index >= 0) { |
| 5670 result = holder_handle->FastPropertyAt(property_index); | 5678 result = holder_handle->FastPropertyAt(property_index); |
| 5671 } else { | 5679 } else { |
| 5672 switch (property_index) { | 5680 switch (property_index) { |
| 5673 case kLookupInPrototype: { | 5681 case kLookupInPrototype: { |
| 5674 Object* pt = holder_handle->GetPrototype(); | 5682 Object* pt = holder_handle->GetPrototype(); |
| 5675 *attributes = ABSENT; | 5683 *attributes = ABSENT; |
| 5676 if (pt == Heap::null_value()) return Heap::undefined_value(); | 5684 if (pt == Heap::null_value()) return Heap::undefined_value(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5701 | 5709 |
| 5702 Object* JSObject::GetPropertyWithInterceptor( | 5710 Object* JSObject::GetPropertyWithInterceptor( |
| 5703 JSObject* receiver, | 5711 JSObject* receiver, |
| 5704 String* name, | 5712 String* name, |
| 5705 PropertyAttributes* attributes) { | 5713 PropertyAttributes* attributes) { |
| 5706 HandleScope scope; | 5714 HandleScope scope; |
| 5707 Handle<JSObject> receiver_handle(receiver); | 5715 Handle<JSObject> receiver_handle(receiver); |
| 5708 Handle<JSObject> holder_handle(this); | 5716 Handle<JSObject> holder_handle(this); |
| 5709 Handle<String> name_handle(name); | 5717 Handle<String> name_handle(name); |
| 5710 | 5718 |
| 5711 Object* result = GetPropertyWithInterceptorProper(receiver, name, attributes); | 5719 Object* result = NULL; |
| 5712 if (result) return result; | 5720 if (GetPropertyWithInterceptorProper(receiver, name, attributes, &result)) { |
| 5721 return result; |
| 5722 } else { |
| 5723 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 5724 } |
| 5713 | 5725 |
| 5714 result = holder_handle->GetPropertyPostInterceptor( | 5726 result = holder_handle->GetPropertyPostInterceptor( |
| 5715 *receiver_handle, | 5727 *receiver_handle, |
| 5716 *name_handle, | 5728 *name_handle, |
| 5717 attributes); | 5729 attributes); |
| 5718 RETURN_IF_SCHEDULED_EXCEPTION(); | 5730 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 5719 return result; | 5731 return result; |
| 5720 } | 5732 } |
| 5721 | 5733 |
| 5722 | 5734 |
| (...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7525 // No break point. | 7537 // No break point. |
| 7526 if (break_point_objects()->IsUndefined()) return 0; | 7538 if (break_point_objects()->IsUndefined()) return 0; |
| 7527 // Single beak point. | 7539 // Single beak point. |
| 7528 if (!break_point_objects()->IsFixedArray()) return 1; | 7540 if (!break_point_objects()->IsFixedArray()) return 1; |
| 7529 // Multiple break points. | 7541 // Multiple break points. |
| 7530 return FixedArray::cast(break_point_objects())->length(); | 7542 return FixedArray::cast(break_point_objects())->length(); |
| 7531 } | 7543 } |
| 7532 #endif | 7544 #endif |
| 7533 | 7545 |
| 7534 } } // namespace v8::internal | 7546 } } // namespace v8::internal |
| OLD | NEW |