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

Side by Side Diff: src/objects.cc

Issue 118118: Store fast property index in stubs generated for interceptor loads (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 | « no previous file | src/objects-inl.h » ('j') | src/objects-inl.h » ('J')
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 Object* JSObject::GetPropertyWithInterceptor(JSObject* receiver, 5620 Object* JSObject::GetPropertyWithInterceptorProper(
5621 String* name, 5621 JSObject* receiver,
5622 PropertyAttributes* attributes) { 5622 String* name,
5623 PropertyAttributes* attributes) {
5623 HandleScope scope; 5624 HandleScope scope;
5624 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); 5625 Handle<InterceptorInfo> interceptor(GetNamedInterceptor());
5625 Handle<JSObject> receiver_handle(receiver); 5626 Handle<JSObject> receiver_handle(receiver);
5626 Handle<JSObject> holder_handle(this); 5627 Handle<JSObject> holder_handle(this);
5627 Handle<String> name_handle(name); 5628 Handle<String> name_handle(name);
5628 Handle<Object> data_handle(interceptor->data()); 5629 Handle<Object> data_handle(interceptor->data());
5629 5630
5630 if (!interceptor->getter()->IsUndefined()) { 5631 if (!interceptor->getter()->IsUndefined()) {
5631 v8::NamedPropertyGetter getter = 5632 v8::NamedPropertyGetter getter =
5632 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); 5633 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter());
5633 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); 5634 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name));
5634 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), 5635 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle),
5635 v8::Utils::ToLocal(data_handle), 5636 v8::Utils::ToLocal(data_handle),
5636 v8::Utils::ToLocal(holder_handle)); 5637 v8::Utils::ToLocal(holder_handle));
5637 v8::Handle<v8::Value> result; 5638 v8::Handle<v8::Value> result;
5638 { 5639 {
5639 // Leaving JavaScript. 5640 // Leaving JavaScript.
5640 VMState state(EXTERNAL); 5641 VMState state(EXTERNAL);
5641 result = getter(v8::Utils::ToLocal(name_handle), info); 5642 result = getter(v8::Utils::ToLocal(name_handle), info);
5642 } 5643 }
5643 RETURN_IF_SCHEDULED_EXCEPTION(); 5644 RETURN_IF_SCHEDULED_EXCEPTION();
5644 if (!result.IsEmpty()) { 5645 if (!result.IsEmpty()) {
5645 *attributes = NONE; 5646 *attributes = NONE;
5646 return *v8::Utils::OpenHandle(*result); 5647 return *v8::Utils::OpenHandle(*result);
5647 } 5648 }
5648 } 5649 }
5649 5650
5650 Object* raw_result = holder_handle->GetPropertyPostInterceptor( 5651 return NULL;
5652 }
5653
5654
5655 Object* JSObject::GetInterceptorPropertyWithLookupHint(
5656 JSObject* receiver,
5657 Smi* lookup_hint,
5658 String* name,
5659 PropertyAttributes* attributes) {
5660 HandleScope scope;
5661 Handle<JSObject> receiver_handle(receiver);
5662 Handle<JSObject> holder_handle(this);
5663 Handle<String> name_handle(name);
5664
5665 Object* result = GetPropertyWithInterceptorProper(receiver, name, attributes);
5666 if (result) return result;
5667
5668 int property_index = lookup_hint->value();
5669 if (property_index >= 0) {
5670 result = holder_handle->FastPropertyAt(property_index);
5671 } else {
5672 switch (property_index) {
5673 case kLookupInPrototype: {
5674 Object* pt = holder_handle->GetPrototype();
5675 *attributes = ABSENT;
5676 if (pt == Heap::null_value()) return Heap::undefined_value();
5677 result = pt->GetPropertyWithReceiver(
5678 *receiver_handle,
5679 *name_handle,
5680 attributes);
5681 RETURN_IF_SCHEDULED_EXCEPTION();
5682 }
5683 break;
5684
5685 case kLookupInHolder:
5686 result = holder_handle->GetPropertyPostInterceptor(
5687 *receiver_handle,
5688 *name_handle,
5689 attributes);
5690 RETURN_IF_SCHEDULED_EXCEPTION();
5691 break;
5692
5693 default:
5694 UNREACHABLE();
5695 }
5696 }
5697
5698 return result;
5699 }
5700
5701
5702 Object* JSObject::GetPropertyWithInterceptor(
5703 JSObject* receiver,
5704 String* name,
5705 PropertyAttributes* attributes) {
5706 HandleScope scope;
5707 Handle<JSObject> receiver_handle(receiver);
5708 Handle<JSObject> holder_handle(this);
5709 Handle<String> name_handle(name);
5710
5711 Object* result = GetPropertyWithInterceptorProper(receiver, name, attributes);
5712 if (result) return result;
5713
5714 result = holder_handle->GetPropertyPostInterceptor(
5651 *receiver_handle, 5715 *receiver_handle,
5652 *name_handle, 5716 *name_handle,
5653 attributes); 5717 attributes);
5654 RETURN_IF_SCHEDULED_EXCEPTION(); 5718 RETURN_IF_SCHEDULED_EXCEPTION();
5655 return raw_result; 5719 return result;
5656 } 5720 }
5657 5721
5658 5722
5659 bool JSObject::HasRealNamedProperty(String* key) { 5723 bool JSObject::HasRealNamedProperty(String* key) {
5660 // Check access rights if needed. 5724 // Check access rights if needed.
5661 if (IsAccessCheckNeeded() && 5725 if (IsAccessCheckNeeded() &&
5662 !Top::MayNamedAccess(this, key, v8::ACCESS_HAS)) { 5726 !Top::MayNamedAccess(this, key, v8::ACCESS_HAS)) {
5663 Top::ReportFailedAccessCheck(this, v8::ACCESS_HAS); 5727 Top::ReportFailedAccessCheck(this, v8::ACCESS_HAS);
5664 return false; 5728 return false;
5665 } 5729 }
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after
7461 // No break point. 7525 // No break point.
7462 if (break_point_objects()->IsUndefined()) return 0; 7526 if (break_point_objects()->IsUndefined()) return 0;
7463 // Single beak point. 7527 // Single beak point.
7464 if (!break_point_objects()->IsFixedArray()) return 1; 7528 if (!break_point_objects()->IsFixedArray()) return 1;
7465 // Multiple break points. 7529 // Multiple break points.
7466 return FixedArray::cast(break_point_objects())->length(); 7530 return FixedArray::cast(break_point_objects())->length();
7467 } 7531 }
7468 #endif 7532 #endif
7469 7533
7470 } } // namespace v8::internal 7534 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698