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 8585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8596 // Bit positions in flag. | 8596 // Bit positions in flag. |
8597 static const int kAllCanReadBit = 0; | 8597 static const int kAllCanReadBit = 0; |
8598 static const int kAllCanWriteBit = 1; | 8598 static const int kAllCanWriteBit = 1; |
8599 static const int kProhibitsOverwritingBit = 2; | 8599 static const int kProhibitsOverwritingBit = 2; |
8600 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; | 8600 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; |
8601 | 8601 |
8602 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); | 8602 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); |
8603 }; | 8603 }; |
8604 | 8604 |
8605 | 8605 |
| 8606 enum AccessorDescriptorType { |
| 8607 kDescriptorBitmaskCompare, |
| 8608 kDescriptorPointerCompare, |
| 8609 kDescriptorPrimitiveValue, |
| 8610 kDescriptorObjectDereference, |
| 8611 kDescriptorPointerDereference, |
| 8612 kDescriptorPointerShift, |
| 8613 kDescriptorReturnObject |
| 8614 }; |
| 8615 |
| 8616 |
| 8617 struct BitmaskCompareDescriptor { |
| 8618 uint32_t bitmask; |
| 8619 uint32_t compare_value; |
| 8620 uint8_t size; // Must be in {1,2,4}. |
| 8621 }; |
| 8622 |
| 8623 |
| 8624 struct PointerCompareDescriptor { |
| 8625 void* compare_value; |
| 8626 }; |
| 8627 |
| 8628 |
| 8629 struct PrimitiveValueDescriptor { |
| 8630 v8::DeclaredAccessorDescriptorDataType data_type; |
| 8631 uint8_t bool_offset; // Must be in [0,7], used for kDescriptorBoolType. |
| 8632 }; |
| 8633 |
| 8634 |
| 8635 struct ObjectDerefenceDescriptor { |
| 8636 uint8_t internal_field; |
| 8637 }; |
| 8638 |
| 8639 |
| 8640 struct PointerShiftDescriptor { |
| 8641 int16_t byte_offset; |
| 8642 }; |
| 8643 |
| 8644 |
| 8645 struct DeclaredAccessorDescriptorData { |
| 8646 AccessorDescriptorType type; |
| 8647 union { |
| 8648 struct BitmaskCompareDescriptor bitmask_compare_descriptor; |
| 8649 struct PointerCompareDescriptor pointer_compare_descriptor; |
| 8650 struct PrimitiveValueDescriptor primitive_value_descriptor; |
| 8651 struct ObjectDerefenceDescriptor object_dereference_descriptor; |
| 8652 struct PointerShiftDescriptor pointer_shift_descriptor; |
| 8653 }; |
| 8654 }; |
| 8655 |
| 8656 |
| 8657 class DeclaredAccessorDescriptor; |
| 8658 |
| 8659 |
| 8660 class DeclaredAccessorDescriptorIterator { |
| 8661 public: |
| 8662 explicit DeclaredAccessorDescriptorIterator( |
| 8663 DeclaredAccessorDescriptor* descriptor); |
| 8664 const DeclaredAccessorDescriptorData* Next(); |
| 8665 bool Complete() const { return length_ == offset_; } |
| 8666 private: |
| 8667 uint8_t* array_; |
| 8668 const int length_; |
| 8669 int offset_; |
| 8670 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptorIterator); |
| 8671 }; |
| 8672 |
| 8673 |
8606 class DeclaredAccessorDescriptor: public Struct { | 8674 class DeclaredAccessorDescriptor: public Struct { |
8607 public: | 8675 public: |
8608 // TODO(dcarney): Fill out this class. | 8676 DECL_ACCESSORS(serialized_data, ByteArray) |
8609 DECL_ACCESSORS(internal_field, Smi) | |
8610 | 8677 |
8611 static inline DeclaredAccessorDescriptor* cast(Object* obj); | 8678 static inline DeclaredAccessorDescriptor* cast(Object* obj); |
8612 | 8679 |
| 8680 static Handle<DeclaredAccessorDescriptor> Create( |
| 8681 Isolate* isolate, |
| 8682 const DeclaredAccessorDescriptorData& data, |
| 8683 Handle<DeclaredAccessorDescriptor> previous); |
| 8684 |
8613 // Dispatched behavior. | 8685 // Dispatched behavior. |
8614 DECLARE_PRINTER(DeclaredAccessorDescriptor) | 8686 DECLARE_PRINTER(DeclaredAccessorDescriptor) |
8615 DECLARE_VERIFIER(DeclaredAccessorDescriptor) | 8687 DECLARE_VERIFIER(DeclaredAccessorDescriptor) |
8616 | 8688 |
8617 static const int kInternalFieldOffset = HeapObject::kHeaderSize; | 8689 static const int kSerializedDataOffset = HeapObject::kHeaderSize; |
8618 static const int kSize = kInternalFieldOffset + kPointerSize; | 8690 static const int kSize = kSerializedDataOffset + kPointerSize; |
8619 | 8691 |
8620 private: | 8692 private: |
8621 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor); | 8693 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor); |
8622 }; | 8694 }; |
8623 | 8695 |
8624 | 8696 |
8625 class DeclaredAccessorInfo: public AccessorInfo { | 8697 class DeclaredAccessorInfo: public AccessorInfo { |
8626 public: | 8698 public: |
8627 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor) | 8699 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor) |
8628 | 8700 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9174 } else { | 9246 } else { |
9175 value &= ~(1 << bit_position); | 9247 value &= ~(1 << bit_position); |
9176 } | 9248 } |
9177 return value; | 9249 return value; |
9178 } | 9250 } |
9179 }; | 9251 }; |
9180 | 9252 |
9181 } } // namespace v8::internal | 9253 } } // namespace v8::internal |
9182 | 9254 |
9183 #endif // V8_OBJECTS_H_ | 9255 #endif // V8_OBJECTS_H_ |
OLD | NEW |