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

Side by Side Diff: src/lookup-inl.h

Issue 414213002: Add a new api in ObjectTemplate to prohibit interceptor for V8DOM binding (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@master
Patch Set: rework the patch by adding new kind of interceptor Created 6 years, 3 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
« no previous file with comments | « src/lookup.h ('k') | src/objects.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_LOOKUP_INL_H_ 5 #ifndef V8_LOOKUP_INL_H_
6 #define V8_LOOKUP_INL_H_ 6 #define V8_LOOKUP_INL_H_
7 7
8 #include "src/lookup.h" 8 #include "src/lookup.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 12 matching lines...) Expand all
23 !(check_hidden() && next->map()->is_hidden_prototype()) && 23 !(check_hidden() && next->map()->is_hidden_prototype()) &&
24 // Always lookup behind the JSGlobalProxy into the JSGlobalObject, even 24 // Always lookup behind the JSGlobalProxy into the JSGlobalObject, even
25 // when not checking other hidden prototypes. 25 // when not checking other hidden prototypes.
26 !map->IsJSGlobalProxyMap()) { 26 !map->IsJSGlobalProxyMap()) {
27 return NULL; 27 return NULL;
28 } 28 }
29 29
30 return next; 30 return next;
31 } 31 }
32 32
33 LookupIterator::State LookupIterator::LookupRealNameInHolder(Map* map,
34 JSReceiver* holder) {
35 if (map->is_dictionary_map()) {
36 if (holder == NULL) return UNKNOWN;
37 NameDictionary* dict = JSObject::cast(holder)->property_dictionary();
38 number_ = dict->FindEntry(name_);
39 if (number_ == NameDictionary::kNotFound) return NOT_FOUND;
40 property_details_ = dict->DetailsAt(number_);
41 if (holder->IsGlobalObject()) {
42 if (property_details_.IsDeleted()) return NOT_FOUND;
43 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_));
44 if (cell->value()->IsTheHole()) return NOT_FOUND;
45 }
46 } else {
47 DescriptorArray* descriptors = map->instance_descriptors();
48 number_ = descriptors->SearchWithCache(*name_, map);
49 if (number_ == DescriptorArray::kNotFound) return NOT_FOUND;
50 property_details_ = descriptors->GetDetails(number_);
51 }
52 has_property_ = true;
53 switch (property_details_.type()) {
54 case v8::internal::CONSTANT:
55 case v8::internal::FIELD:
56 case v8::internal::NORMAL:
57 return DATA;
58 case v8::internal::CALLBACKS:
59 return ACCESSOR;
60 }
61 return NOT_FOUND;
62 }
33 63
34 LookupIterator::State LookupIterator::LookupInHolder(Map* map, 64 LookupIterator::State LookupIterator::LookupInHolder(Map* map,
35 JSReceiver* holder) { 65 JSReceiver* holder) {
36 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY); 66 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY);
37 DisallowHeapAllocation no_gc; 67 DisallowHeapAllocation no_gc;
68 LookupIterator::State real_name_state = NOT_FOUND;
38 switch (state_) { 69 switch (state_) {
39 case NOT_FOUND: 70 case NOT_FOUND:
40 if (map->IsJSProxyMap()) return JSPROXY; 71 if (map->IsJSProxyMap()) return JSPROXY;
41 if (map->is_access_check_needed()) return ACCESS_CHECK; 72 if (map->is_access_check_needed()) return ACCESS_CHECK;
42 // Fall through. 73 // Fall through.
43 case ACCESS_CHECK: 74 case ACCESS_CHECK:
44 if (check_interceptor() && map->has_named_interceptor()) { 75 if (check_interceptor() && map->has_named_interceptor()) {
76 Handle<JSReceiver> curHolder = maybe_holder_.ToHandleChecked();
77 if (curHolder->IsJSObject() && ((Handle<JSObject>::cast(curHolder))
78 ->GetNamedInterceptor()->do_not_interceptor_real_name())) {
79 // try to get real name property
80 real_name_state = LookupRealNameInHolder(map, holder);
81 if (real_name_state == DATA || real_name_state == ACCESSOR)
82 return real_name_state;
83 }
45 return INTERCEPTOR; 84 return INTERCEPTOR;
46 } 85 }
47 // Fall through. 86 // Fall through.
48 case INTERCEPTOR: 87 case INTERCEPTOR:
49 if (map->is_dictionary_map()) { 88 return LookupRealNameInHolder(map, holder);
50 if (holder == NULL) return UNKNOWN;
51 NameDictionary* dict = JSObject::cast(holder)->property_dictionary();
52 number_ = dict->FindEntry(name_);
53 if (number_ == NameDictionary::kNotFound) return NOT_FOUND;
54 property_details_ = dict->DetailsAt(number_);
55 if (holder->IsGlobalObject()) {
56 if (property_details_.IsDeleted()) return NOT_FOUND;
57 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_));
58 if (cell->value()->IsTheHole()) return NOT_FOUND;
59 }
60 } else {
61 DescriptorArray* descriptors = map->instance_descriptors();
62 number_ = descriptors->SearchWithCache(*name_, map);
63 if (number_ == DescriptorArray::kNotFound) return NOT_FOUND;
64 property_details_ = descriptors->GetDetails(number_);
65 }
66 has_property_ = true;
67 switch (property_details_.type()) {
68 case v8::internal::CONSTANT:
69 case v8::internal::FIELD:
70 case v8::internal::NORMAL:
71 return DATA;
72 case v8::internal::CALLBACKS:
73 return ACCESSOR;
74 }
75 case ACCESSOR: 89 case ACCESSOR:
76 case DATA: 90 case DATA:
77 case UNKNOWN: 91 case UNKNOWN:
78 return NOT_FOUND; 92 return NOT_FOUND;
79 case JSPROXY: 93 case JSPROXY:
80 case TRANSITION: 94 case TRANSITION:
81 UNREACHABLE(); 95 UNREACHABLE();
82 } 96 }
83 UNREACHABLE(); 97 UNREACHABLE();
84 return state_; 98 return state_;
85 } 99 }
86 } 100 }
87 } // namespace v8::internal 101 } // namespace v8::internal
88 102
89 #endif // V8_LOOKUP_INL_H_ 103 #endif // V8_LOOKUP_INL_H_
OLDNEW
« no previous file with comments | « src/lookup.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698