OLD | NEW |
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_PROPERTY_H_ | 5 #ifndef V8_PROPERTY_H_ |
6 #define V8_PROPERTY_H_ | 6 #define V8_PROPERTY_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 Representation::Tagged()) {} | 103 Representation::Tagged()) {} |
104 }; | 104 }; |
105 | 105 |
106 | 106 |
107 class LookupResult FINAL BASE_EMBEDDED { | 107 class LookupResult FINAL BASE_EMBEDDED { |
108 public: | 108 public: |
109 explicit LookupResult(Isolate* isolate) | 109 explicit LookupResult(Isolate* isolate) |
110 : isolate_(isolate), | 110 : isolate_(isolate), |
111 next_(isolate->top_lookup_result()), | 111 next_(isolate->top_lookup_result()), |
112 lookup_type_(NOT_FOUND), | 112 lookup_type_(NOT_FOUND), |
113 holder_(NULL), | |
114 transition_(NULL), | 113 transition_(NULL), |
115 details_(NONE, DATA, Representation::None()) { | 114 details_(NONE, DATA, Representation::None()) { |
116 isolate->set_top_lookup_result(this); | 115 isolate->set_top_lookup_result(this); |
117 } | 116 } |
118 | 117 |
119 ~LookupResult() { | 118 ~LookupResult() { |
120 DCHECK(isolate()->top_lookup_result() == this); | 119 DCHECK(isolate()->top_lookup_result() == this); |
121 isolate()->set_top_lookup_result(next_); | 120 isolate()->set_top_lookup_result(next_); |
122 } | 121 } |
123 | 122 |
124 Isolate* isolate() const { return isolate_; } | 123 Isolate* isolate() const { return isolate_; } |
125 | 124 |
126 void DescriptorResult(JSObject* holder, PropertyDetails details, int number) { | 125 void DescriptorResult(PropertyDetails details, int number) { |
127 lookup_type_ = DESCRIPTOR_TYPE; | 126 lookup_type_ = DESCRIPTOR_TYPE; |
128 holder_ = holder; | |
129 transition_ = NULL; | 127 transition_ = NULL; |
130 details_ = details; | 128 details_ = details; |
131 number_ = number; | 129 number_ = number; |
132 } | 130 } |
133 | 131 |
134 void TransitionResult(JSObject* holder, Map* target) { | 132 void TransitionResult(Map* target) { |
135 lookup_type_ = TRANSITION_TYPE; | 133 lookup_type_ = TRANSITION_TYPE; |
136 number_ = target->LastAdded(); | 134 number_ = target->LastAdded(); |
137 details_ = target->instance_descriptors()->GetDetails(number_); | 135 details_ = target->instance_descriptors()->GetDetails(number_); |
138 holder_ = holder; | |
139 transition_ = target; | 136 transition_ = target; |
140 } | 137 } |
141 | 138 |
142 void NotFound() { | 139 void NotFound() { |
143 lookup_type_ = NOT_FOUND; | 140 lookup_type_ = NOT_FOUND; |
144 details_ = PropertyDetails(NONE, DATA, 0); | 141 details_ = PropertyDetails(NONE, DATA, 0); |
145 holder_ = NULL; | |
146 transition_ = NULL; | 142 transition_ = NULL; |
147 } | 143 } |
148 | 144 |
149 Representation representation() const { | 145 Representation representation() const { |
150 DCHECK(IsFound()); | 146 DCHECK(IsFound()); |
151 return details_.representation(); | 147 return details_.representation(); |
152 } | 148 } |
153 | 149 |
154 // Property callbacks does not include transitions to callbacks. | 150 // Property callbacks does not include transitions to callbacks. |
155 bool IsAccessorConstant() const { | 151 bool IsAccessorConstant() const { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 221 |
226 void Iterate(ObjectVisitor* visitor); | 222 void Iterate(ObjectVisitor* visitor); |
227 | 223 |
228 private: | 224 private: |
229 Isolate* isolate_; | 225 Isolate* isolate_; |
230 LookupResult* next_; | 226 LookupResult* next_; |
231 | 227 |
232 // Where did we find the result; | 228 // Where did we find the result; |
233 enum { NOT_FOUND, DESCRIPTOR_TYPE, TRANSITION_TYPE } lookup_type_; | 229 enum { NOT_FOUND, DESCRIPTOR_TYPE, TRANSITION_TYPE } lookup_type_; |
234 | 230 |
235 JSReceiver* holder_; | |
236 Map* transition_; | 231 Map* transition_; |
237 int number_; | 232 int number_; |
238 PropertyDetails details_; | 233 PropertyDetails details_; |
239 }; | 234 }; |
240 | 235 |
241 | 236 |
242 std::ostream& operator<<(std::ostream& os, const LookupResult& r); | 237 std::ostream& operator<<(std::ostream& os, const LookupResult& r); |
243 } } // namespace v8::internal | 238 } } // namespace v8::internal |
244 | 239 |
245 #endif // V8_PROPERTY_H_ | 240 #endif // V8_PROPERTY_H_ |
OLD | NEW |