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 8361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8372 // Bit positions in flag. | 8372 // Bit positions in flag. |
8373 static const int kAllCanReadBit = 0; | 8373 static const int kAllCanReadBit = 0; |
8374 static const int kAllCanWriteBit = 1; | 8374 static const int kAllCanWriteBit = 1; |
8375 static const int kProhibitsOverwritingBit = 2; | 8375 static const int kProhibitsOverwritingBit = 2; |
8376 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; | 8376 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; |
8377 | 8377 |
8378 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); | 8378 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); |
8379 }; | 8379 }; |
8380 | 8380 |
8381 | 8381 |
| 8382 enum AccessorDescriptorType { |
| 8383 kDescriptorBitmaskCompare, |
| 8384 kDescriptorPointerCompare, |
| 8385 kDescriptorPrimitiveValue, |
| 8386 kDescriptorObjectDereference, |
| 8387 kDescriptorPointerDereference, |
| 8388 kDescriptorPointerShift, |
| 8389 kDescriptorReturnObject |
| 8390 }; |
| 8391 |
| 8392 |
| 8393 struct BitmaskCompareDescriptor { |
| 8394 uint32_t bitmask; |
| 8395 uint32_t compare_value; |
| 8396 uint8_t size; // Must be in {1,2,4}. |
| 8397 }; |
| 8398 |
| 8399 |
| 8400 struct PointerCompareDescriptor { |
| 8401 void* compare_value; |
| 8402 }; |
| 8403 |
| 8404 |
| 8405 struct PrimitiveValueDescriptor { |
| 8406 v8::DeclaredAccessorDescriptorDataType data_type; |
| 8407 uint8_t bool_offset; // Must be in [0,7], used for kDescriptorBoolType. |
| 8408 }; |
| 8409 |
| 8410 |
| 8411 struct ObjectDerefenceDescriptor { |
| 8412 uint8_t internal_field; |
| 8413 }; |
| 8414 |
| 8415 |
| 8416 struct PointerShiftDescriptor { |
| 8417 int16_t byte_offset; |
| 8418 }; |
| 8419 |
| 8420 |
| 8421 struct DeclaredAccessorDescriptorData { |
| 8422 AccessorDescriptorType type; |
| 8423 union { |
| 8424 struct BitmaskCompareDescriptor bitmask_compare_descriptor; |
| 8425 struct PointerCompareDescriptor pointer_compare_descriptor; |
| 8426 struct PrimitiveValueDescriptor primitive_value_descriptor; |
| 8427 struct ObjectDerefenceDescriptor object_dereference_descriptor; |
| 8428 struct PointerShiftDescriptor pointer_shift_descriptor; |
| 8429 }; |
| 8430 }; |
| 8431 |
| 8432 |
| 8433 class DeclaredAccessorDescriptor; |
| 8434 |
| 8435 |
| 8436 class DeclaredAccessorDescriptorIterator { |
| 8437 public: |
| 8438 explicit DeclaredAccessorDescriptorIterator( |
| 8439 DeclaredAccessorDescriptor* descriptor); |
| 8440 const DeclaredAccessorDescriptorData* Next(); |
| 8441 bool Complete() const { return length_ == offset_; } |
| 8442 private: |
| 8443 uint8_t* array_; |
| 8444 const int length_; |
| 8445 int offset_; |
| 8446 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptorIterator); |
| 8447 }; |
| 8448 |
| 8449 |
8382 class DeclaredAccessorDescriptor: public Struct { | 8450 class DeclaredAccessorDescriptor: public Struct { |
8383 public: | 8451 public: |
8384 // TODO(dcarney): Fill out this class. | 8452 DECL_ACCESSORS(serialized_data, ByteArray) |
8385 DECL_ACCESSORS(internal_field, Smi) | |
8386 | 8453 |
8387 static inline DeclaredAccessorDescriptor* cast(Object* obj); | 8454 static inline DeclaredAccessorDescriptor* cast(Object* obj); |
8388 | 8455 |
| 8456 static Handle<DeclaredAccessorDescriptor> Create( |
| 8457 Isolate* isolate, |
| 8458 const DeclaredAccessorDescriptorData& data, |
| 8459 Handle<DeclaredAccessorDescriptor> previous); |
| 8460 |
8389 // Dispatched behavior. | 8461 // Dispatched behavior. |
8390 DECLARE_PRINTER(DeclaredAccessorDescriptor) | 8462 DECLARE_PRINTER(DeclaredAccessorDescriptor) |
8391 DECLARE_VERIFIER(DeclaredAccessorDescriptor) | 8463 DECLARE_VERIFIER(DeclaredAccessorDescriptor) |
8392 | 8464 |
8393 static const int kInternalFieldOffset = HeapObject::kHeaderSize; | 8465 static const int kSerializedDataOffset = HeapObject::kHeaderSize; |
8394 static const int kSize = kInternalFieldOffset + kPointerSize; | 8466 static const int kSize = kSerializedDataOffset + kPointerSize; |
8395 | 8467 |
8396 private: | 8468 private: |
8397 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor); | 8469 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor); |
8398 }; | 8470 }; |
8399 | 8471 |
8400 | 8472 |
8401 class DeclaredAccessorInfo: public AccessorInfo { | 8473 class DeclaredAccessorInfo: public AccessorInfo { |
8402 public: | 8474 public: |
8403 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor) | 8475 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor) |
8404 | 8476 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8950 } else { | 9022 } else { |
8951 value &= ~(1 << bit_position); | 9023 value &= ~(1 << bit_position); |
8952 } | 9024 } |
8953 return value; | 9025 return value; |
8954 } | 9026 } |
8955 }; | 9027 }; |
8956 | 9028 |
8957 } } // namespace v8::internal | 9029 } } // namespace v8::internal |
8958 | 9030 |
8959 #endif // V8_OBJECTS_H_ | 9031 #endif // V8_OBJECTS_H_ |
OLD | NEW |