OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 isolate->SetTopLookupResult(this); | 200 isolate->SetTopLookupResult(this); |
201 } | 201 } |
202 | 202 |
203 ~LookupResult() { | 203 ~LookupResult() { |
204 ASSERT(isolate()->top_lookup_result() == this); | 204 ASSERT(isolate()->top_lookup_result() == this); |
205 isolate()->SetTopLookupResult(next_); | 205 isolate()->SetTopLookupResult(next_); |
206 } | 206 } |
207 | 207 |
208 Isolate* isolate() const { return isolate_; } | 208 Isolate* isolate() const { return isolate_; } |
209 | 209 |
| 210 void CopyFrom(LookupResult* res, JSObject* new_holder) { |
| 211 isolate_ = res->isolate_; |
| 212 lookup_type_ = res->lookup_type_; |
| 213 number_ = res->number_; |
| 214 cacheable_ = res->cacheable_; |
| 215 details_ = res->details_; |
| 216 holder_ = new_holder; |
| 217 } |
| 218 |
210 void DescriptorResult(JSObject* holder, PropertyDetails details, int number) { | 219 void DescriptorResult(JSObject* holder, PropertyDetails details, int number) { |
211 lookup_type_ = DESCRIPTOR_TYPE; | 220 lookup_type_ = DESCRIPTOR_TYPE; |
212 holder_ = holder; | 221 holder_ = holder; |
213 details_ = details; | 222 details_ = details; |
214 number_ = number; | 223 number_ = number; |
215 } | 224 } |
216 | 225 |
217 bool CanHoldValue(Handle<Object> value) { | 226 bool CanHoldValue(Handle<Object> value) { |
218 return value->FitsRepresentation(details_.representation()); | 227 return value->FitsRepresentation(details_.representation()); |
219 } | 228 } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 } | 477 } |
469 | 478 |
470 Object* GetValueFromMap(Map* map) const { | 479 Object* GetValueFromMap(Map* map) const { |
471 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); | 480 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
472 ASSERT(number_ < map->NumberOfOwnDescriptors()); | 481 ASSERT(number_ < map->NumberOfOwnDescriptors()); |
473 return map->instance_descriptors()->GetValue(number_); | 482 return map->instance_descriptors()->GetValue(number_); |
474 } | 483 } |
475 | 484 |
476 void Iterate(ObjectVisitor* visitor); | 485 void Iterate(ObjectVisitor* visitor); |
477 | 486 |
478 private: | 487 protected: |
479 Isolate* isolate_; | 488 Isolate* isolate_; |
480 LookupResult* next_; | 489 LookupResult* next_; |
481 | 490 |
482 // Where did we find the result; | 491 // Where did we find the result; |
483 enum { | 492 enum { |
484 NOT_FOUND, | 493 NOT_FOUND, |
485 DESCRIPTOR_TYPE, | 494 DESCRIPTOR_TYPE, |
486 TRANSITION_TYPE, | 495 TRANSITION_TYPE, |
487 DICTIONARY_TYPE, | 496 DICTIONARY_TYPE, |
488 HANDLER_TYPE, | 497 HANDLER_TYPE, |
489 INTERCEPTOR_TYPE | 498 INTERCEPTOR_TYPE |
490 } lookup_type_; | 499 } lookup_type_; |
491 | 500 |
492 JSReceiver* holder_; | 501 JSReceiver* holder_; |
493 int number_; | 502 int number_; |
494 bool cacheable_; | 503 bool cacheable_; |
495 PropertyDetails details_; | 504 PropertyDetails details_; |
496 }; | 505 }; |
497 | 506 |
498 | 507 |
499 } } // namespace v8::internal | 508 } } // namespace v8::internal |
500 | 509 |
501 #endif // V8_PROPERTY_H_ | 510 #endif // V8_PROPERTY_H_ |
OLD | NEW |