| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/double.h" | 7 #include "src/double.h" |
| 8 #include "src/factory.h" | 8 #include "src/factory.h" |
| 9 #include "src/hydrogen-infer-representation.h" | 9 #include "src/hydrogen-infer-representation.h" |
| 10 #include "src/property-details-inl.h" | 10 #include "src/property-details-inl.h" |
| (...skipping 4624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4635 | 4635 |
| 4636 | 4636 |
| 4637 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, | 4637 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, |
| 4638 Representation representation) { | 4638 Representation representation) { |
| 4639 DCHECK(offset >= 0); | 4639 DCHECK(offset >= 0); |
| 4640 return HObjectAccess(kBackingStore, offset, representation, | 4640 return HObjectAccess(kBackingStore, offset, representation, |
| 4641 Handle<String>::null(), false, false); | 4641 Handle<String>::null(), false, false); |
| 4642 } | 4642 } |
| 4643 | 4643 |
| 4644 | 4644 |
| 4645 HObjectAccess HObjectAccess::ForField(Handle<Map> map, | 4645 HObjectAccess HObjectAccess::ForField(Handle<Map> map, int index, |
| 4646 LookupResult* lookup, | 4646 Representation representation, |
| 4647 Handle<String> name) { | 4647 Handle<String> name) { |
| 4648 DCHECK(lookup->IsField() || lookup->IsTransitionToField()); | |
| 4649 int index; | |
| 4650 Representation representation; | |
| 4651 if (lookup->IsField()) { | |
| 4652 index = lookup->GetLocalFieldIndexFromMap(*map); | |
| 4653 representation = lookup->representation(); | |
| 4654 } else { | |
| 4655 Map* transition = lookup->GetTransitionTarget(); | |
| 4656 int descriptor = transition->LastAdded(); | |
| 4657 index = transition->instance_descriptors()->GetFieldIndex(descriptor) - | |
| 4658 map->inobject_properties(); | |
| 4659 PropertyDetails details = | |
| 4660 transition->instance_descriptors()->GetDetails(descriptor); | |
| 4661 representation = details.representation(); | |
| 4662 } | |
| 4663 if (index < 0) { | 4648 if (index < 0) { |
| 4664 // Negative property indices are in-object properties, indexed | 4649 // Negative property indices are in-object properties, indexed |
| 4665 // from the end of the fixed part of the object. | 4650 // from the end of the fixed part of the object. |
| 4666 int offset = (index * kPointerSize) + map->instance_size(); | 4651 int offset = (index * kPointerSize) + map->instance_size(); |
| 4667 return HObjectAccess(kInobject, offset, representation, name, false, true); | 4652 return HObjectAccess(kInobject, offset, representation, name, false, true); |
| 4668 } else { | 4653 } else { |
| 4669 // Non-negative property indices are in the properties array. | 4654 // Non-negative property indices are in the properties array. |
| 4670 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; | 4655 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; |
| 4671 return HObjectAccess(kBackingStore, offset, representation, name, | 4656 return HObjectAccess(kBackingStore, offset, representation, name, |
| 4672 false, false); | 4657 false, false); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4782 break; | 4767 break; |
| 4783 case HObjectAccess::kExternalMemory: | 4768 case HObjectAccess::kExternalMemory: |
| 4784 os << "[external-memory]"; | 4769 os << "[external-memory]"; |
| 4785 break; | 4770 break; |
| 4786 } | 4771 } |
| 4787 | 4772 |
| 4788 return os << "@" << access.offset(); | 4773 return os << "@" << access.offset(); |
| 4789 } | 4774 } |
| 4790 | 4775 |
| 4791 } } // namespace v8::internal | 4776 } } // namespace v8::internal |
| OLD | NEW |