LCOV - code coverage report
Current view: top level - src - property.h (source / functions) Hit Total Coverage
Test: app.info Lines: 4 4 100.0 %
Date: 2017-10-20 Functions: 0 0 -

          Line data    Source code
       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
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_PROPERTY_H_
       6             : #define V8_PROPERTY_H_
       7             : 
       8             : #include <iosfwd>
       9             : 
      10             : #include "src/factory.h"
      11             : 
      12             : namespace v8 {
      13             : namespace internal {
      14             : 
      15             : // Abstraction for elements in instance-descriptor arrays.
      16             : //
      17             : // Each descriptor has a key, property attributes, property type,
      18             : // property index (in the actual instance-descriptor array) and
      19             : // optionally a piece of data.
      20             : class Descriptor final BASE_EMBEDDED {
      21             :  public:
      22             :   Descriptor() : details_(Smi::kZero) {}
      23             : 
      24             :   Handle<Name> GetKey() const { return key_; }
      25             :   Handle<Object> GetValue() const { return value_; }
      26             :   PropertyDetails GetDetails() const { return details_; }
      27             : 
      28      329604 :   void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); }
      29             : 
      30             :   static Descriptor DataField(Handle<Name> key, int field_index,
      31             :                               PropertyAttributes attributes,
      32             :                               Representation representation);
      33             : 
      34             :   static Descriptor DataField(Handle<Name> key, int field_index,
      35             :                               PropertyAttributes attributes,
      36             :                               PropertyConstness constness,
      37             :                               Representation representation,
      38             :                               Handle<Object> wrapped_field_type);
      39             : 
      40             :   static Descriptor DataConstant(Handle<Name> key, Handle<Object> value,
      41             :                                  PropertyAttributes attributes) {
      42             :     return Descriptor(key, value, kData, attributes, kDescriptor, kConst,
      43     1152404 :                       value->OptimalRepresentation(), 0);
      44             :   }
      45             : 
      46             :   static Descriptor DataConstant(Handle<Name> key, int field_index,
      47             :                                  Handle<Object> value,
      48             :                                  PropertyAttributes attributes);
      49             : 
      50             :   static Descriptor AccessorConstant(Handle<Name> key, Handle<Object> foreign,
      51             :                                      PropertyAttributes attributes) {
      52             :     return Descriptor(key, foreign, kAccessor, attributes, kDescriptor, kConst,
      53             :                       Representation::Tagged(), 0);
      54             :   }
      55             : 
      56             :  private:
      57             :   Handle<Name> key_;
      58             :   Handle<Object> value_;
      59             :   PropertyDetails details_;
      60             : 
      61             :  protected:
      62             :   void Init(Handle<Name> key, Handle<Object> value, PropertyDetails details) {
      63             :     DCHECK(key->IsUniqueName());
      64             :     DCHECK_IMPLIES(key->IsPrivate(), !details.IsEnumerable());
      65             :     key_ = key;
      66             :     value_ = value;
      67             :     details_ = details;
      68             :   }
      69             : 
      70             :   Descriptor(Handle<Name> key, Handle<Object> value, PropertyDetails details)
      71     7632766 :       : key_(key), value_(value), details_(details) {
      72             :     DCHECK(key->IsUniqueName());
      73             :     DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable());
      74             :   }
      75             : 
      76             :   Descriptor(Handle<Name> key, Handle<Object> value, PropertyKind kind,
      77             :              PropertyAttributes attributes, PropertyLocation location,
      78             :              PropertyConstness constness, Representation representation,
      79             :              int field_index)
      80             :       : key_(key),
      81             :         value_(value),
      82             :         details_(kind, attributes, location, constness, representation,
      83     8754728 :                  field_index) {
      84             :     DCHECK(key->IsUniqueName());
      85             :     DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable());
      86             :   }
      87             : 
      88             :   friend class DescriptorArray;
      89             :   friend class Map;
      90             :   friend class MapUpdater;
      91             : };
      92             : 
      93             : }  // namespace internal
      94             : }  // namespace v8
      95             : 
      96             : #endif  // V8_PROPERTY_H_

Generated by: LCOV version 1.10