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

Side by Side Diff: src/lookup.h

Issue 490533002: Use LookupIterator to transition to accessors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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/lookup.cc » ('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_H_ 5 #ifndef V8_LOOKUP_H_
6 #define V8_LOOKUP_H_ 6 #define V8_LOOKUP_H_
7 7
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 13 matching lines...) Expand all
24 // Convience combinations of bits. 24 // Convience combinations of bits.
25 CHECK_PROPERTY = 0, 25 CHECK_PROPERTY = 0,
26 CHECK_HIDDEN_SKIP_INTERCEPTOR = CHECK_HIDDEN_PROPERTY | CHECK_ACCESS_CHECK, 26 CHECK_HIDDEN_SKIP_INTERCEPTOR = CHECK_HIDDEN_PROPERTY | CHECK_ACCESS_CHECK,
27 CHECK_DERIVED_SKIP_INTERCEPTOR = 27 CHECK_DERIVED_SKIP_INTERCEPTOR =
28 CHECK_HIDDEN_SKIP_INTERCEPTOR | CHECK_DERIVED_PROPERTY, 28 CHECK_HIDDEN_SKIP_INTERCEPTOR | CHECK_DERIVED_PROPERTY,
29 CHECK_DERIVED = CHECK_DERIVED_SKIP_INTERCEPTOR | CHECK_INTERCEPTOR, 29 CHECK_DERIVED = CHECK_DERIVED_SKIP_INTERCEPTOR | CHECK_INTERCEPTOR,
30 CHECK_HIDDEN = CHECK_HIDDEN_SKIP_INTERCEPTOR | CHECK_INTERCEPTOR 30 CHECK_HIDDEN = CHECK_HIDDEN_SKIP_INTERCEPTOR | CHECK_INTERCEPTOR
31 }; 31 };
32 32
33 enum State { 33 enum State {
34 ACCESS_CHECK,
35 INTERCEPTOR,
36 JSPROXY,
34 NOT_FOUND, 37 NOT_FOUND,
35 PROPERTY, 38 PROPERTY,
36 INTERCEPTOR, 39 // Set state_ to BEFORE_PROPERTY to ensure that the next lookup will be a
37 ACCESS_CHECK, 40 // PROPERTY lookup.
38 JSPROXY 41 BEFORE_PROPERTY = INTERCEPTOR
39 }; 42 };
40 43
41 enum PropertyKind { 44 enum PropertyKind {
42 DATA, 45 DATA,
43 ACCESSOR 46 ACCESSOR
44 }; 47 };
45 48
46 enum PropertyEncoding { 49 enum PropertyEncoding {
47 DICTIONARY, 50 DICTIONARY,
48 DESCRIPTOR 51 DESCRIPTOR
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 number_(DescriptorArray::kNotFound) { 96 number_(DescriptorArray::kNotFound) {
94 Next(); 97 Next();
95 } 98 }
96 99
97 Isolate* isolate() const { return isolate_; } 100 Isolate* isolate() const { return isolate_; }
98 State state() const { return state_; } 101 State state() const { return state_; }
99 Handle<Name> name() const { return name_; } 102 Handle<Name> name() const { return name_; }
100 103
101 bool IsFound() const { return state_ != NOT_FOUND; } 104 bool IsFound() const { return state_ != NOT_FOUND; }
102 void Next(); 105 void Next();
106 void NotFound() {
107 has_property_ = false;
108 state_ = NOT_FOUND;
109 }
103 110
104 Heap* heap() const { return isolate_->heap(); } 111 Heap* heap() const { return isolate_->heap(); }
105 Factory* factory() const { return isolate_->factory(); } 112 Factory* factory() const { return isolate_->factory(); }
106 Handle<Object> GetReceiver() const { 113 Handle<Object> GetReceiver() const {
107 return maybe_receiver_.ToHandleChecked(); 114 return maybe_receiver_.ToHandleChecked();
108 } 115 }
109 Handle<Map> holder_map() const { return holder_map_; } 116 Handle<Map> holder_map() const { return holder_map_; }
110 template <class T> 117 template <class T>
111 Handle<T> GetHolder() const { 118 Handle<T> GetHolder() const {
112 DCHECK(IsFound()); 119 DCHECK(IsFound());
(...skipping 10 matching lines...) Expand all
123 // HasProperty needs to be called before any of the other PROPERTY methods 130 // HasProperty needs to be called before any of the other PROPERTY methods
124 // below can be used. It ensures that we are able to provide a definite 131 // below can be used. It ensures that we are able to provide a definite
125 // answer, and loads extra information about the property. 132 // answer, and loads extra information about the property.
126 bool HasProperty(); 133 bool HasProperty();
127 void PrepareForDataProperty(Handle<Object> value); 134 void PrepareForDataProperty(Handle<Object> value);
128 void TransitionToDataProperty(Handle<Object> value, 135 void TransitionToDataProperty(Handle<Object> value,
129 PropertyAttributes attributes, 136 PropertyAttributes attributes,
130 Object::StoreFromKeyed store_mode); 137 Object::StoreFromKeyed store_mode);
131 void ReconfigureDataProperty(Handle<Object> value, 138 void ReconfigureDataProperty(Handle<Object> value,
132 PropertyAttributes attributes); 139 PropertyAttributes attributes);
140 void TransitionToAccessorProperty(AccessorComponent component,
141 Handle<Object> accessor,
142 PropertyAttributes attributes);
133 PropertyKind property_kind() const { 143 PropertyKind property_kind() const {
134 DCHECK(has_property_); 144 DCHECK(has_property_);
135 return property_kind_; 145 return property_kind_;
136 } 146 }
137 PropertyEncoding property_encoding() const { 147 PropertyEncoding property_encoding() const {
138 DCHECK(has_property_); 148 DCHECK(has_property_);
139 return property_encoding_; 149 return property_encoding_;
140 } 150 }
141 PropertyDetails property_details() const { 151 PropertyDetails property_details() const {
142 DCHECK(has_property_); 152 DCHECK(has_property_);
(...skipping 12 matching lines...) Expand all
155 void WriteDataValue(Handle<Object> value); 165 void WriteDataValue(Handle<Object> value);
156 166
157 void InternalizeName(); 167 void InternalizeName();
158 168
159 private: 169 private:
160 Handle<Map> GetReceiverMap() const; 170 Handle<Map> GetReceiverMap() const;
161 171
162 MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map); 172 MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map);
163 inline State LookupInHolder(Map* map); 173 inline State LookupInHolder(Map* map);
164 Handle<Object> FetchValue() const; 174 Handle<Object> FetchValue() const;
175 void ReloadPropertyInformation();
165 176
166 bool IsBootstrapping() const; 177 bool IsBootstrapping() const;
167 178
168 // Methods that fetch data from the holder ensure they always have a holder. 179 // Methods that fetch data from the holder ensure they always have a holder.
169 // This means the receiver needs to be present as opposed to just the receiver 180 // This means the receiver needs to be present as opposed to just the receiver
170 // map. Other objects in the prototype chain are transitively guaranteed to be 181 // map. Other objects in the prototype chain are transitively guaranteed to be
171 // present via the receiver map. 182 // present via the receiver map.
172 bool is_guaranteed_to_have_holder() const { 183 bool is_guaranteed_to_have_holder() const {
173 return !maybe_receiver_.is_null(); 184 return !maybe_receiver_.is_null();
174 } 185 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 MaybeHandle<Object> maybe_receiver_; 229 MaybeHandle<Object> maybe_receiver_;
219 MaybeHandle<JSReceiver> maybe_holder_; 230 MaybeHandle<JSReceiver> maybe_holder_;
220 231
221 int number_; 232 int number_;
222 }; 233 };
223 234
224 235
225 } } // namespace v8::internal 236 } } // namespace v8::internal
226 237
227 #endif // V8_LOOKUP_H_ 238 #endif // V8_LOOKUP_H_
OLDNEW
« no previous file with comments | « no previous file | src/lookup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698