Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/objects.cc

Issue 118302: Experimental revert of revisions 2093, 2094, 2099, and... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 bool JSObject::GetPropertyWithInterceptorProper( 5620 Object* JSObject::GetPropertyWithInterceptor(JSObject* receiver,
5621 JSObject* receiver, 5621 String* name,
5622 String* name, 5622 PropertyAttributes* attributes) {
5623 PropertyAttributes* attributes,
5624 Object** result_object) {
5625 HandleScope scope; 5623 HandleScope scope;
5626 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); 5624 Handle<InterceptorInfo> interceptor(GetNamedInterceptor());
5627 Handle<JSObject> receiver_handle(receiver); 5625 Handle<JSObject> receiver_handle(receiver);
5628 Handle<JSObject> holder_handle(this); 5626 Handle<JSObject> holder_handle(this);
5629 Handle<String> name_handle(name); 5627 Handle<String> name_handle(name);
5630 Handle<Object> data_handle(interceptor->data()); 5628 Handle<Object> data_handle(interceptor->data());
5631 5629
5632 if (!interceptor->getter()->IsUndefined()) { 5630 if (!interceptor->getter()->IsUndefined()) {
5633 v8::NamedPropertyGetter getter = 5631 v8::NamedPropertyGetter getter =
5634 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); 5632 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter());
5635 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); 5633 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name));
5636 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), 5634 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle),
5637 v8::Utils::ToLocal(data_handle), 5635 v8::Utils::ToLocal(data_handle),
5638 v8::Utils::ToLocal(holder_handle)); 5636 v8::Utils::ToLocal(holder_handle));
5639 v8::Handle<v8::Value> result; 5637 v8::Handle<v8::Value> result;
5640 { 5638 {
5641 // Leaving JavaScript. 5639 // Leaving JavaScript.
5642 VMState state(EXTERNAL); 5640 VMState state(EXTERNAL);
5643 result = getter(v8::Utils::ToLocal(name_handle), info); 5641 result = getter(v8::Utils::ToLocal(name_handle), info);
5644 } 5642 }
5645 if (Top::has_scheduled_exception()) { 5643 RETURN_IF_SCHEDULED_EXCEPTION();
5646 return false;
5647 }
5648 if (!result.IsEmpty()) { 5644 if (!result.IsEmpty()) {
5649 *attributes = NONE; 5645 *attributes = NONE;
5650 *result_object = *v8::Utils::OpenHandle(*result); 5646 return *v8::Utils::OpenHandle(*result);
5651 return true;
5652 } 5647 }
5653 } 5648 }
5654 5649
5655 return false; 5650 Object* raw_result = holder_handle->GetPropertyPostInterceptor(
5656 }
5657
5658
5659 Object* JSObject::GetInterceptorPropertyWithLookupHint(
5660 JSObject* receiver,
5661 Smi* lookup_hint,
5662 String* name,
5663 PropertyAttributes* attributes) {
5664 HandleScope scope;
5665 Handle<JSObject> receiver_handle(receiver);
5666 Handle<JSObject> holder_handle(this);
5667 Handle<String> name_handle(name);
5668
5669 Object* result = NULL;
5670 if (GetPropertyWithInterceptorProper(receiver, name, attributes, &result)) {
5671 return result;
5672 } else {
5673 RETURN_IF_SCHEDULED_EXCEPTION();
5674 }
5675
5676 int property_index = lookup_hint->value();
5677 if (property_index >= 0) {
5678 result = holder_handle->FastPropertyAt(property_index);
5679 } else {
5680 switch (property_index) {
5681 case kLookupInPrototype: {
5682 Object* pt = holder_handle->GetPrototype();
5683 *attributes = ABSENT;
5684 if (pt == Heap::null_value()) return Heap::undefined_value();
5685 result = pt->GetPropertyWithReceiver(
5686 *receiver_handle,
5687 *name_handle,
5688 attributes);
5689 RETURN_IF_SCHEDULED_EXCEPTION();
5690 }
5691 break;
5692
5693 case kLookupInHolder:
5694 result = holder_handle->GetPropertyPostInterceptor(
5695 *receiver_handle,
5696 *name_handle,
5697 attributes);
5698 RETURN_IF_SCHEDULED_EXCEPTION();
5699 break;
5700
5701 default:
5702 UNREACHABLE();
5703 }
5704 }
5705
5706 return result;
5707 }
5708
5709
5710 Object* JSObject::GetPropertyWithInterceptor(
5711 JSObject* receiver,
5712 String* name,
5713 PropertyAttributes* attributes) {
5714 HandleScope scope;
5715 Handle<JSObject> receiver_handle(receiver);
5716 Handle<JSObject> holder_handle(this);
5717 Handle<String> name_handle(name);
5718
5719 Object* result = NULL;
5720 if (GetPropertyWithInterceptorProper(receiver, name, attributes, &result)) {
5721 return result;
5722 } else {
5723 RETURN_IF_SCHEDULED_EXCEPTION();
5724 }
5725
5726 result = holder_handle->GetPropertyPostInterceptor(
5727 *receiver_handle, 5651 *receiver_handle,
5728 *name_handle, 5652 *name_handle,
5729 attributes); 5653 attributes);
5730 RETURN_IF_SCHEDULED_EXCEPTION(); 5654 RETURN_IF_SCHEDULED_EXCEPTION();
5731 return result; 5655 return raw_result;
5732 } 5656 }
5733 5657
5734 5658
5735 bool JSObject::HasRealNamedProperty(String* key) { 5659 bool JSObject::HasRealNamedProperty(String* key) {
5736 // Check access rights if needed. 5660 // Check access rights if needed.
5737 if (IsAccessCheckNeeded() && 5661 if (IsAccessCheckNeeded() &&
5738 !Top::MayNamedAccess(this, key, v8::ACCESS_HAS)) { 5662 !Top::MayNamedAccess(this, key, v8::ACCESS_HAS)) {
5739 Top::ReportFailedAccessCheck(this, v8::ACCESS_HAS); 5663 Top::ReportFailedAccessCheck(this, v8::ACCESS_HAS);
5740 return false; 5664 return false;
5741 } 5665 }
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after
7537 // No break point. 7461 // No break point.
7538 if (break_point_objects()->IsUndefined()) return 0; 7462 if (break_point_objects()->IsUndefined()) return 0;
7539 // Single beak point. 7463 // Single beak point.
7540 if (!break_point_objects()->IsFixedArray()) return 1; 7464 if (!break_point_objects()->IsFixedArray()) return 1;
7541 // Multiple break points. 7465 // Multiple break points.
7542 return FixedArray::cast(break_point_objects())->length(); 7466 return FixedArray::cast(break_point_objects())->length();
7543 } 7467 }
7544 #endif 7468 #endif
7545 7469
7546 } } // namespace v8::internal 7470 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698